Hey all, I hired a designer to help with the GUI and we’re getting really weird behavior when he exports to SVG. Here is an asset as it looks when opened in Inkscape:
And here is what it looks like as rendered by JUCE:
This is so wacky that I am inclined to believe that I am doing something wrong. But for other assets it works out just fine. I am simply loading the .svg with juce::Drawable::createFromSVGFile(juce::File(path_to_svg)) and then calling addAndMakeVisible and setBounds where appropriate.
Thanks for the direct answer. I wonder what it would take to fix this issue. What part of the SVG support is limited? Is it the parsing or the rendering? Would something like this this be of any use?
It seems like it shouldn’t be tons of trouble to dig into the JUCE code a little bit and address these shortcomings in a new git branch. Parse, render, wrap into JUCE classes. Simple, right? What am I missing?
SVG is surprisingly rich, and apparently it’s even Turing complete. Different browsers and programs also render SVG files differently, and without looking deeply into it my guess would be that the library which you linked to also supports SVG on face value just like JUCE does but when really you dig into it some things might be lacking (but am also willing to be pleasantly surprised if it turns out that it supports and render everything correctly).
Other than trying to minimize the examples until you find the root cause of what’s missing in JUCE and try to fix it, report it, or work around it (i.e for example by telling the graphic designer to try to avoid blurs), I can also suggest giving this tool svg-simplify a shot - I made it for exactly the same use case (SVG files which JUCE didn’t support). And also if there’s something simple it can do for you and doesn’t feel free to request in the issues.
JUCE does support gradients.
An example for something JUCE doesn’t support is gradient masks, which this tool can sometimes turn into fills of gradients with alpha channels. As for shadows and glow I hadn’t come across SVGs with those yet in our designs.