praeclarum / NGraphics

NGraphics is a cross platform library for rendering vector graphics on .NET. It provides a unified API for both immediate and retained mode graphics using high quality native renderers.
MIT License
705 stars 133 forks source link

Specific SVG path data not processed correctly #103

Closed tabrs closed 4 years ago

tabrs commented 5 years ago

Hi, following SVG was not processed correctly

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 160">
    <path d="M152.042,146.481c3.63,0,5.7-4.131,4.148-7.229L84.114,15.324a4.865,4.865,0,0,0-8.3,0L3.742,139.25c-2.074,3.1.519,7.229,4.148,7.229Z" fill="#990000"/>
</svg>

Expected behavior is to draw something like this image

Tested on Xamarin Forms 4.0 Android project on NGraphics 1.6.0-beta1 Processed directly on device - Samsung Tab 2 Active on API 27 (Android 8.1)

tabrs commented 5 years ago

As an addition - another example. Just adding in case you'll be able to trace the issue. `

`

What was drawn image

What was expected image

tabrs commented 5 years ago

In case it will help somehow - I've changed a path data to following and NGraphics processed it correctly

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 160"><path d="M26.56,80L80,26.56L133.44,80l-9.69,9.38L86.56,52.19v81.25H73.44V52.19l-37.5,37.19L26.56,80z"/></svg>

Anyway, just to make it clear - all browsers and vector graphics apps processed any following samples correctly.

I've tried to compare these two and following has shown up image

First one (okay) exported in Adobe Illustrator CC.2019 in usual way - File -> Save As.. Second one (buggy) exported in the same app as File -> Export As.. (minified exporter for web)

Cheers!

praeclarum commented 4 years ago

Hello! Sorry for the long delay but I fixed this today. The problem lied in the parsing of numbers with negative signs with spaces. Thank you for the detailed descriptions!