Implementing SVG attribute "stroke-miterlimit" ( tdf#48066)
Armin Le Grand
armin_le_grand at me.com
Fri Apr 8 15:51:23 UTC 2016
Hi Regina,
yes, the MiterLimits are different in different systems, but all are
somehow specified using the angle between the two vectors involved. I
remember to have seen some definitions, most using the same and 15 as
default value. The ways to be compatible with MS are:
- find a definition somewhere, mqaybe in forums or newsgroups (I have
none, sorry)
- reverse engineer by trying out. Probability is high that there is a
(linear?) relationship between the values, so it might be a simple scaling
HTH!
Regards,
Armin
Am 07.04.2016 um 14:35 schrieb Regina Henschel:
> Hi all,
>
> I have made some progress. But a new problem comes up.
>
> I have changed WinSalGraphicsImpl::drawPolyLine [3] so that it gets an
> additional parameter fMiterMinimumAngle (same meaning as in
> createAreaGeometryForJoin) and uses it for gdi+. The rendering in
> edit-mode in Draw and Impress is correct then with gdi+ on Windows.
> Even Text in SVG works out of the box. [BTW: The current rendering
> using gdi+ is wrong, see my report bug#99102.]
>
> The behavior of gdi+ is described in [1]. To get the same kind of
> behavior as in LO, when the miter limit is exceeded, the LineJoin type
> 'LineJoinMiterClipped' has to be used.
>
> Being only in LibreOffice and SVG, that would be no problem. But MS
> seems to use different defaults. The rendering in PowerPoint looks
> like gdi+ type 'LineJoinMiter'. The specification for 'lim' in
> ECMA-376, Part 1, chapter 20.1.8.43, has no details, and I have not
> found details otherwhere.
>
> This gdi+ type 'LineJoinMiter' kind of clipping (see the image in the
> article [1]) will be used in SVG 2 [2] too under the identifier
> 'miter-clip'.
>
> So my question: Ignore interoperability with MS? If not, how to solve it?
>
> Kind regards
> Regina
>
> [1]
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms534148%28v=vs.85%29.aspx
>
> [2] https://www.w3.org/TR/svg-strokes/#StrokeShape
>
> [3]
> diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
> index 7febbe8..36ecb31 100644
> --- a/vcl/win/gdi/gdiimpl.cxx
> +++ b/vcl/win/gdi/gdiimpl.cxx
> @@ -2031,7 +2031,8 @@ bool WinSalGraphicsImpl::drawPolyLine(
> double fTransparency,
> const basegfx::B2DVector& rLineWidths,
> basegfx::B2DLineJoin eLineJoin,
> - css::drawing::LineCap eLineCap)
> + css::drawing::LineCap eLineCap,
> + double fMiterMinimumAngle)
> {
> const sal_uInt32 nCount(rPolygon.count());
>
> @@ -2064,9 +2065,9 @@ bool WinSalGraphicsImpl::drawPolyLine(
> }
> case basegfx::B2DLineJoin::Miter :
> {
> - const Gdiplus::REAL aMiterLimit(15.0);
> + const Gdiplus::REAL
> aMiterLimit(1/sin(fMiterMinimumAngle/2.0));
> Gdiplus::DllExports::GdipSetPenMiterLimit(pTestPen, aMiterLimit);
> - Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen,
> Gdiplus::LineJoinMiter);
> + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen,
> Gdiplus::LineJoinMiterClipped);
> break;
> }
> case basegfx::B2DLineJoin::Round :
>
> _______________________________________________
> 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