gradient angles

Regina Henschel rb.henschel at t-online.de
Sun Jul 29 14:40:56 PDT 2012


Hi Christina,

Christina Roßmanith schrieb:
> Am 29.07.2012 18:25, schrieb Regina Henschel:
>> Hi Christina,
>>
>> I'm not sure about what you want to know.
>>
>> 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)
>>
>> The svg:gradient does not has an angle, but a start point and an end
>> point. The start point has the color of the 0%-stop color and the end
>> point has the color of the 100%-stop color.
> You are right, there is no angle but transforms are applied to the
> gradient vector (and normal). So the question is what is the direction
> of the gradient vector in absence of any transform and the w3c test
> suite gives the answer: from left to right (along the positive x axis?)

There is a picture which explains it in SVG 1.1 Section 13 Gradients and 
Patterns
http://www.w3.org/TR/SVG/pservers.html

>>
>>>
>>> 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 think, that the specification is not clear about the untransformed
>> direction of the gradient vector. "Gradient vector" is for me the
>> direction from start color to end color in the way, that a line with
>> points of same color is perpendicular to the gradient vector.
>>
>> LibreOffice handles it in the way, that the untransformed gradient
>> vector is in direction of the positive y-axis, that is on screen from
>> top to bottom.
> That means I have to rotate the gradient orientation 90° ccw when
> importing svg gradients.

Do you want to import a svg-picture? Or do you want to implement feature 
"ODF1.2 16.40.2<svg:linearGradient>"? Or what are you working on?

I ask, because there are further attributes, which cannot be impressed 
directly in a LO gradient: intermediate stop-colors, spreadMethod, and 
gradientUnits, which has to be considered to, when calculating an angle.

It is no rotation at all. But you have to convert between two-point 
vector and angle.

>>
>> The draw:angle is the angle the gradient vector is rotated. Where it
>> has the same rule as other rotations, that it is on screen against
>> clock, which will be clockwise in calculation because of the top-down
>> direction of the y-axis.
>>
>> LibreOffice handles the angle unit as 0.1°, whereas in ODF1.2 the
>> angle unit defaults to 1°.
> That might explain why in a fodg file which I've modified by hand a
> gradient angle of "90" is interpreted as "9".

The spec has to be changed to meet the practice. Do you know an ODF1.2 
application, that interprets the angle in degree? Shall I write a mail 
to OASIS to change it to 0.1°?

Kind regards
Regina



More information about the LibreOffice mailing list