Reading SVG Files

I’m trying to read an SVG file and assign line colors and line thicknesses to the different paths. Inspired by the help patch “Sample the path of an SVG”, I’ve managed to isolate the individual <path> elements from the SVG, and extract their data somewhat successfully.

However, I’m having trouble getting the nodes ParseSVGPathData and FromSVGPathData to work. I’ve attached a screenshot of my patch — any idea what I might be doing wrong?

Also, for my better understanding:
What is the actual difference between ParseSVGPathData and FromSVGPathData?
They seem to take the same input (string) and return an SKPath, but I’m not sure when to use one over the other.

Hi Vincent,

i guess we need to clean up a bit and update the helppatch.
ParseSVGPathData is marked experimental and probably should be removed in favor of FromSVGPathData and its counterpart ToSVGPathData.

Unfortunatelly Skia’s SVG parsing capabilities are very limited, FromSVGPathData can make a path only out of a string from the d attribute:

Best,
Anton

Ah, good to know. Thanks, that was helpful. I wasn’t aware of the thing with the “d” attribute. I used the python svg library to create the svg in the first place and there is a way to create the drawing so that it can be parsed in vvvv. So yeah, on step further…