SVG Rendering Error

Having the same problem here. Adding back the transform fixes linear gradient not working.

1 Like

Exact the same problem here. The gradient renders the wrong way when i render the svg in juce:

It renders the right way when i adding .followedBy (transform); in the parser and revert the JUCE bug fix as described above.

@ed95 Please have another look at it. I really need only the basic SVG features. I can’t release products because of this and i don’t want to patch the JUCE library if possible.

Link to the SVG for testing:
https://tal-software.com/downloads/background.svg

This is how i embed the SVG:

MemoryBlock svgSavePreset(BinaryData::background_svg, BinaryData::background_svgSize);
XmlDocument xmlDocument2(svgSavePreset.toString());
std::unique_ptr<XmlElement> svgXml = xmlDocument2.getDocumentElement();
backgroundSvg = Drawable::createFromSVG(*svgXml);
addAndMakeVisible(backgroundSvg.get());
this->backgroundSvg->setBounds(0, 0, TAL_PLUGIN_WIDTH, TAL_PLUGIN_HEIGHT);
this->backgroundSvg->setTransformToFit(Rectangle<float>(0, 0, TAL_PLUGIN_WIDTH, TAL_PLUGIN_HEIGHT), RectanglePlacement::stretchToFit);
2 Likes

I’m also quite interested into fixing at least the basic SVG features, like the gradient.

1 Like

I find that when exporting SVGs from inkscape, if you select the optimised export option it plays a little nicer with JUCE (and it reduces the size of your binaries). There’s also some other things you can do to remove <g> elements from the SVG which I find can help.

This is a workaround of course, not a fix. I’d also like to see better support for SVGs. But if you’re in need of a quick fix those might be some things to try.

1 Like

Thanks for the tip. I will try this as a work around.

It still would be great to have a fix for this soon.

1 Like