Impress/Features/ShapeGradientEnhancementForMS2003Filter
Sheet Protection Options
Specification Status | |
Author | Jianyuan Li |
Last Change | See wiki history |
Status | draft |
Abstract
Contents
References
Reference Document | Check | Location (URL) |
Issue ID (required) | available | Issue 119498 |
Test case specification (required) | n/a |
Contacts
Role | Name | E-Mail Address |
Developer | Jianyuan Li | lijianyuan1983@gmail.com |
Quality Assurance | nobody | |
Documentation | nobody | |
User Experience | nobody |
Basic gradient concept comparison between AOO and MS
Basic gradient concept comparison between AOO and MS is as follows:
MS2003 | AOO |
---|---|
Type |
Type |
Color 1 |
From color |
Color 2 |
To color |
Focus |
Center XY |
Fill to |
NA |
Angle |
Angle |
The left one is ShadeShape gradient and the right one is ShadeScale gradient. For more details, see the introduction for Type.
Type: Below table show a mapping relationship between MS 2003 and AOO gradient type. For AOO other types Radial, Elliptical and Square will be mapped like Rect.
AOO | MS2003 | Meaning |
---|---|---|
Linear Axial |
ShadeScale | A gradient fill that starts on the outline of the shape and ends at a point defined within the shape. The fill angle is scaled by the aspect ratio of the shape |
Rect | ShadeCenter ShadeShape |
A gradient fill that starts and ends based on the bounds of the shape A gradient fill that starts on the outline of the shape and ends at a point defined within the shape |
Colors: For color dynamic changed (not predefined) gradient, there are only two variant color “Color 1”/”From color” and “Color 2”/”To color”. They can be set as any color. In above picture, both gradient form color and end color is blue and black.
Focus/Center XY: MS focus is a signed integer value that specifies the relative position of the last color in the shaded fill. It is defined only for ShadeScale type. AOO Center XY is a relative position (0 ~ 100) of the center rectangular of rect gradient per the origin point of a shape. Above right gradient shape’s focus is 100.
Fill to: There are left, right, top and bottom “fillTo”. The fillToLeft property specifies the relative position of the left boundary of the center rectangle in a concentric shaded fill. It is defined for ShadeCenter and ShadeShape. Above left gradient shape’s “Fill to” for the four directions are all 0.5.
Angle: For MS 2003, angle property specifies the angle of the shaded fill that rotates the gradient vector in a counterclockwise direction and will be represented with minus number. Zero degree represents a vertical vector from bottom to top. For AOO, it is also a counterclockwise direction while it will be represented with a positive number between 0~360.
Detailed Specification
Basic gradient type support from 25% to 100%
For MS 2003, 22 kinds of gradient type are supported. Only five gradient types can be imported correctly. In this feature, all other types will be supported both for import and export of MS 2003 filter. Due to feature gap for shape gradient between MS 2003 and AOO, from color and to color need be swapped in some conditions. AOO does not support “Focus” and “FillTo” which will impact the gradient color position. So they should be considered on import. “Center XY” does not supported by MS 2003 which will impact gradient export. Angle is supported both by MS 2003 and AOO. But how to represent a counterclockwise angle is not the same. So above properties will be considered when import and export to obtain a correct result.
Rotated gradient
MS 2003 support whole gradient will be rotated when a shape is rotated whole AOO does not. If this property is not considered, all gradient type will be imported incorrectly. In this feature, the shape rotated angle will be taken as part of gradient angle to keep the fidelity. There are two points which should be kept in mind. One is clockwise and counterclockwise will impact the import result. The other is to make clear that rotation angle and gradient angle relationship -- plus or minus. When export, just export the gradient angle will be okay.
Transparency gradient
For transparency, there is no feature gap. Now only from color is imported and to color is ignored. So the import and export result will be in chaos. In this feature, to color will be taken into consideration and a new item “XFillFloatTransparenceItem” (for basic color transparency, the item is “XFillTransparenceItem”) will set into core function to set gradient transparency. This item should be considered to get the correct output result on export.
Solid transparency gradient
In AOO, a special gradient can be created with using gradient related item. It can be constructed with solid color and transparency item. Transparency item can contain some gradient info like normal gradient in AOO. But related info will not be saved into the same item as normal gradient in document mode. So when export, this special situation must be considered. What needs to be is just set from and to color as the same color as solid color on export. Transparency related data can be obtained in transparency item.
File Format
XLS
Open Issues
For shapeCenter type, it will be imported as bitmap other than gradient. The effect looks pretty good and it can be changed with shape rotation. I have tried imported as a gradient. The effect is changed a lot when import. So here I want to just keep it. But there is an open issue. Its transparency will be handled as one color transparency. Only from color transparency is imported. Even if both from and to color transparency is considered for import, export also cannot work as expected because MS 2003 does not support this scenario (Bitmap with two color transparency).