Image button & SVG error

I cannot make Image button with SVG file.

I use latest Jucer and Juce by git and macosx 10.6.4 & mac and iPad, iphone.

I can make Image button with PNG file not SVG file.
I also can make Image(Graphics) with SVG file.

Jucer can show SVG when I make Image(Graphics), but cannot show Image Button.


Jucer’s code’s imageButton->setImages has 12 parameters, but
Juce_amalgamated.h line 43765 has 13 parameters. (float hitTestAlphaThreshold = 0.0f)

It’s probably just the wrong scale. E.g. if your SVG is a page with a small picture in the middle, that entire page will be shrunk to fit in the button, so the image might be too small to see.

Jucer’s code’s imageButton->setImages has 12 parameters, but
Juce_amalgamated.h line 43765 has 13 parameters. (float hitTestAlphaThreshold = 0.0f)[/quote]

Did you use the pre-built binary of the Jucer from git? The last time I checked it, it was not up-to date and the generated code for ImageButtons didn’t build with the most recent juce sources. After building the jucer project myself everything worked fine.

Hi!!! steffen!!!

do you mention that you build extras/the jucer?
I also build but doesnot work fine…

Hi!!! jules!!!

I don’t think so.
because Graphics->new image works fine with the same SVG file.

Sorry toshi, I don’t understand what you mean. Maybe send me the SVG file and I’ll have a look?

Old thread, but I’m having the same problem in tip version. Is ImageButton class supposed to be able to load .SVG data?

If I create a resource from a .PNG file, it works fine both as Drawable and as ImageButton, but if I create a resource from an .SVG file, it only works as Drawable, not with ImageButton (although Jucer seems to suggest it should work).

I guess some glue is needed to make SVG work with ImageButtons?

Same issue here in Introjucer.

Add an imagebutton to the gui editor, set the normal image to a svg file by using -- create new image resource -- and selecting the file, nothing shows up in the button.

Export the svg as png in a 3dparty app, set the png as the image, displays fine.


Set the svg as the image of a image component, displays fine.


Isn't this an issue that I fixed a couple of days ago?


Tried with a version of the introducer that was compiled on 23.Dec. Still can´t make this work.

Maybe i´m doing something wrong?

I used this image for testing:

Created a clean project, added a GUI component, added a image button and set the svg as the image.

Still can´t make it appear though.



Nikolai Bergstrøm

But the ImageButton only shows Images.. SVG is a vector format - it gets loaded as a Drawable, so for that you'd need to use a DrawableButton.


Thanks for getting back to me that fast.

That makes sense, i guess.

But I can´t add a DrawableButton in the introducer (or?) so in that case this whole topic is pointless. smiley

I´ll just add the drawables as Generic in introducer, and add the image loading in "manual" code.


So, my very late christmas-wish-list would be:

Possible to add a DrawableButton, just like a ImageButton in the introducer.

And make it possible for the ImageButton and DrawableButton to use images from the binary resources in the project, not only images emedded in the component.


Happy New Year