I'm just trying out some SVG stuff and I have found that I can't render any strokes that are not continuous, can JUCE deal with different stroke types? In Inkscape I have created a plain svg which looks like dashStroke.png, yet is renders as a solid line(see renderedStroke.png). I couldn't attach the .svg file so I've included it inline.
yes.. but the PathStrokeType class doesn't contain info about dashes, you'd need to deal with that separately, and call a different method to create the stroke.
Hi Jules. I took a look at this. As you can see from the screenshot something is not quite right! Is it Ok to create the dashed path in the parsePath() method? As you can see I'm losing the solid fill, and the width of the dashed lines are too large. Can you spot any obvious problems?
Well no.. that's not going to work. Having a very quick look, it'd probably require additions to the DrawableShape class to support dashes for it to actually work correctly. At the moment that class can only have a solid outline.
Thanks Jules. What I did was add an Array<float> to DrawableShape. In SVGParser::parseShape() I check for dashed strokes. If they exists I parse the data and set the float array in DrawableShape. Then in the DrawableShape::Paint() method I do this:
I've also need dashes support for the SVGs I get from my graphic designer.
* Here's my attempt at adding a dashLengths property to DrawableShape: https://github.com/soundradix/JUCE/commit/fd9fe5207a6ae4a097dc27575252bec698371cc1
* Here's the parsing of dashes from SVG: https://github.com/soundradix/JUCE/commit/2d1e2a603f25f40aa67123cf5b759734e9c6dadd