Question about SVGs

Hi, I’m fairly new to this stuff but having an issue with a DrawableButton

If I load an SVG using ImageFitted then the image is scaled to fit the button and is centered, but want the original image size

If I use ImageRaw then I get the correct size but the image is not centered

Is there any way to do this so that it’s not resized but centered?

Another issue is that, for instance, I load an image of 16x6 - I can see this in the SVG file so it’s correct - when I load it into a Drawable and try and get the size, it returns something slightly different so can’t see anyway of getting the original size without parsing the XML myself.

Thx for any thoughts and input.
Lee

From what I recall, many of JUCE’s widgets have a border (or padding) that can get a little frustrating when it comes to things like DrawableButtons. So if your svg is 16x6, and you set the button to be 16x6, the rendered result may be smaller.
JUCE also has issues with certain svg features (namely shadows and effects) so be wary of that.
Improving svg rendering is on the JUCE 9 roadmap

1 Like

hi, thanks, yes aware of all that.

don’t think this is border or padding issue, just can’t find a way of centering without scaling.

Do you have a viewBox specified on the SVG? IIRC removing that can make JUCE more reliable in centring SVGs…

1 Like

hi - thanks, I did have some in some of the svgs. I removed these and unfortunately made no difference.