Implementing SVG attribute "stroke-miterlimit" ( tdf#48066)

Armin Le Grand armin_le_grand at me.com
Fri Apr 1 14:51:09 UTC 2016


Hi Regina,

the MiterMinimumAngle influences only the miter mode, thus I do not 
understand the 'still not changed to Bevel' comment. In SVG import, the 
primitives and thus the LineAttribute as part of it containing the 
MiterMinimumAngle is directly created, the exactly same instance will be 
used in the renderer and be available in the decomposition.
I am not sure at which system you are, but the value needs to be used 
either in

     VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect

and then handed through

     OutputDevice::DrawPolyLineDirect

like the other values, down to the renderer sal implementation (Gdiplus 
for windows).
Or - when getting decomposed in

     PolygonStrokePrimitive2D::create2DDecomposition

and then handed over to

     basegfx::tools::createAreaGeometry

also like the other values. Thus, still some hand-through 
implementations needed to pass the value to the places where needed. At 
that places, currently a default is used.

basegfx::tools::createAreaGeometry has an input value for 
fMiterMinimumAngle already.

With OutputDevice::DrawPolyLineDirect it needs to be handed over to 
diverse implementations of DrawPolyLine, there seems to be one for

OpenGLSalGraphicsImpl::DrawPolyLine
SalGraphics::DrawPolyLine

in principle all which use the same parameters (e.g. including 
basegfx::B2DLineJoin). For me, OpenGLSalGraphicsImpl is new and I am not 
sure how/where it is used.
SalGraphics::DrawPolyLine uses SalGraphics::drawPolyLine (small 1st 
letter) which is

     virtual bool                drawPolyLine(
                                     const basegfx::B2DPolygon&,
                                     double fTransparency,
                                     const basegfx::B2DVector& rLineWidths,
                                     basegfx::B2DLineJoin,
                                     css::drawing::LineCap) = 0;

and has diverse system-specific implementations that need to be adapted. 
In those implementations usually the default value for MiterMinimumAngle 
is used (see WinSalGraphicsImpl::drawPolyLine).

Unfortunaltely it is not easy in vcl to do that, the compiler is your 
friend. It was already a lot of work to add methods to the whole chain 
that use more modern parameters. It is also necessary to adapt all 
implementations for all target plattforms and to test compilation on all 
plattforms, since this touches plattform-dependent code that is not 
built on all plattforms.

Theoretically it would also need to be added to MetaPolyLineAction, but 
the Metafile actions have the problem to be saved/loaded, so this is 
hard to to backwards compatible. You would need to create a new version 
of MetaPolyLineAction, see other examples with MetaActions.

Hard stuff....
I hope this helps!

Regards,
Armin

Am 01.04.2016 um 16:04 schrieb Regina Henschel:
> Hi,
>
> Armin Le Grand schrieb:
>> Hi Regina,
>>
>> Am 24.03.2016 um 16:35 schrieb Regina Henschel:
>>> Hi Armin,
>>>
>>> I need an advice/opinion _where_ to hold the information:
>>
>> Definitely in drawinglayer::attribute::LineAttribute, same place where
>> basegfx::B2DLineJoin is held. A double, defaulted to 15.0 and read
>> access will be fine. For setting it, add a 5th parameter to the
>> constructor, defaulted to 15.0. The LineAttribute is a read-only, not
>> later changeable class to keep things simple. It is better/safer to
>> create another one when a value needs to be changed than starting to
>> keep track of changes and add notification or other stuff.
>
> I'm now at the stage, where createAreaGeometryForJoin() in 
> b2dlinegeometry is called with the correct angle in its parameter 
> fMiterMinimumAngle. But in the inserted svg image, the join is still 
> not changed to Bevel. What places do I need to change in addition? Is 
> there something to do in module canvas or vcl or something additional 
> in svgio or ...?
>
> Kind regards
> Regina
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice

-- 
--
ALG (PGP Key: EE1C 4B3F E751 D8BC C485 DEC1 3C59 F953 D81C F4A2)



More information about the LibreOffice mailing list