fodg + gradient + angle
Michael Stahl
mstahl at redhat.com
Sat Jul 28 08:24:06 PDT 2012
On 28/07/12 11:21, Michael Meeks wrote:
> Hi Christina :-)
>
> On Fri, 2012-07-27 at 21:39 +0200, Christina Roßmanith wrote:
>> a gradient angle given without a unith should be interpreted as degrees,
>> but in my example a value of draw:angle="90" shows up in LibO as 9
>> degrees. If I change it to draw:angle="90deg" the value is read correctly.
you mean this angle here from ODF 1.2 part1, right:
> 19.112 draw:angle
> The draw:angle attribute specifies an angle that rotates the axis at which the gradient values are interpolated. This attribute is ignored for radial style gradients.
> The draw:angle attribute is usable with the following elements: <draw:gradient> 16.40.1 and <draw:opacity> 16.40.7.
> The draw:angle attribute has the data type angle 18.3.1.
> 18.3.1 angle
> An angle, as defined in §4.1 of [SVG]. An angle is a double value that may be followed immediately by one of the following angle unit identifiers: deg (degrees), grad (gradiants) or rad (radians). If no unit identifier is specified, the value is assumed to be in degrees.
> Note: OpenDocument v1.1 did not support angle specifications that contain an angle unit identifier. Angle unit identifiers should be omitted for compatibility with OpenDocument v1.1.
the code here looks like it's importing that, but since it just uses
convertNumber, which does not handle any units and just ignores them, i
don't understand how "90" would result in something different than
"90deg". (there's an identical bit of code in TransGradientStyle.cxx)
> xmloff/source/style/GradientStyle.cxx: case XML_TOK_GRADIENT_ANGLE:
> xmloff/source/style/GradientStyle.cxx- {
> xmloff/source/style/GradientStyle.cxx- sal_Int32 nValue;
> xmloff/source/style/GradientStyle.cxx- ::sax::Converter::convertNumber( nValue, rStrValue, 0, 3600 );
> xmloff/source/style/GradientStyle.cxx- aGradient.Angle = sal_Int16( nValue );
> xmloff/source/style/GradientStyle.cxx- }
> xmloff/source/style/GradientStyle.cxx- break;
>
> To here - so ...
>
>> Thus the question is: Where do I have to look to fix it?
>
> Is it possible that that 3600 should be 360 ? or is there some tends of
> a degree-as-int going on there ? :-)
it looks like we don't implement support for units like "deg" or "rad"
or "grad" at all; this should be added to sax::Converter, something like
a convertAngle function.
then if it is indeed the case that we import the number as 1/10 degree
and not degree as specified (which i haven't checked, but the "3600"
looks very much like that), we have a bigger problem. in that case we
need to change the import and export to do it correctly, and put a
special case hack into the import to check the generator and fix up
wrong values from old OOo/LO versions.
More information about the LibreOffice
mailing list