gradient angles

Michael Stahl mstahl at redhat.com
Mon Jul 30 07:21:18 PDT 2012


On 29/07/12 19:25, Regina Henschel wrote:
> Hi Christine,
> 
> continuing..
> 
> Christina Roßmanith schrieb:
>> Hi,
>>
>> just to be sure before I continue my work:
>>
>> SVG gradient with angle=0° changes color from left to right
>>       (I'm taking this from
>> http://www.w3.org/TR/SVG/pservers.html#LinearGradientElement)
>>
>> ODF gradient with angle=0° changes color from top to bottom
>>       (I can't find any meaning of the angle attribute here
>> http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416460_253892949)
> 
> I have now looked, which way PowerPoint2013 does it:
> The angle of 0° in the UI means that the gradient vector goes from left 
> to right.
> The angle in the UI rotates this gradient vector clockwise on screen. 
> Values from 0 to 359.9 are allowed.
> 
> In file format it is the same as from LO, for example:
> draw:angle="700" results from
>    PP UI-angle=20° clockwise on screen
>    LO UI-angle=70° counterclockwise on screen
> draw:angle="3300" results form
>    PP UI-angle=120° clockwise on screen
>    LO UI-angle=330° counterclockwise on screen

that is a very interesting discovery!

so it seems MSO also has the defect of storing draw:angle with the
wrong units of 0.1°.

i've installed Calligra Stage 2.4.3 and played with it, and in the .odp
file i get linear gradients like this:

>   <svg:linearGradient draw:name="gradient1" svg:spreadMethod="pad" svg:x1="65.9558%" svg:x2="39.8039%" svg:y1="24.8957%" svg:y2="70.0815%">
>    <svg:stop svg:offset="0.11" svg:stop-color="#dc143c"/><svg:stop svg:offset="0.473324" svg:stop-color="#00ced1"/><svg:stop svg:offset="0.589196" svg:stop-color="#00ff00"/>
>   </svg:linearGradient>
>   <svg:linearGradient draw:name="gradient2" svg:spreadMethod="pad" svg:x1="0%" svg:x2="166.923%" svg:y1="0%" svg:y2="164.085%">
>    <svg:stop svg:offset="0" svg:stop-color="#ffffff"/><svg:stop svg:offset="1" svg:stop-color="#00ff00"/>
>   </svg:linearGradient>

so it appears there is another way to represent gradients in ODF 1.2
that is directly from SVG and doesn't use draw:angle at all; the UI for
it doesn't display an angle either but you see a line where you can move
start/end points and double click on the line at a position to insert
color stops.

it appears OOo and derived suites like LO don't support reading
svg:linearGradient/svg:radialGradient at all.

> So it seems, that PP follows the way how it is stored in file, but has a 
> different UI.
> 
> My conclusion is, that a mail to OASIS is needed with the points:
> (1) Define "axis at which the gradient values are interpolated" as vector
> (2) Define untransformed direction of this vector as going in positive 
> y-axis direction.
> (3) Define direction of rotation as clockwise in respect to the internal 
> coordinate system
> (4) Do not define draw:angle as SVG-angle but as double to be multiplied 
> with 0.1°.
> 
> What do you think?

so it seems that all office suites that implement draw:angle do it wrong
in the same way, by using 0.1° as the unit instead of 1°, and one of the
affected suites is from MSFT which we have no way to fix.

therefore i retract my earlier suggestion to fix the defect in LO, and
second your proposal to suggest OASIS to change the spec.



More information about the LibreOffice mailing list