In the docs there is a note about colour-ids for juce::DrawableButton::ButtonStyle::ImageOnButtonBackground: Note that if you use this style, the colour IDs that control the button colour are TextButton::buttonColourId and TextButton::buttonOnColourId.
Maybe this is defaulted to some transparent colour?
Ah, i think i know whats going on- i had the same problem a while ago.
The juce::Path::loadPathFromData method is intended to be used to restore a path that was previously created with juce::Path::storePathToStream.
If you want to load a SVG, you can use:
auto icon = juce::Drawable::createFromImageData (BinaryData::boxTone_classic_svg, size_t (BinaryData::boxTone_classic_svgSize));
button.setImages (icon.get());
I’m guessing here, but woudn’t that place the drawablePath within a one pixel wide rectangle? What about calling drawablePath.setTransformToFit (getLocalBounds().toFloat(), juce::RectanglePlacement{}); in resized(), does it help?
This was the answer! Loading the SVGs from BinaryData using this method fixes the issue. Thank you @vallant !!
JUCE team, if you’re listening, it would be great to add a note about this in the docs. Seeing the signature of the method juce::Path::loadPathFromData, I assumed it was meant for loading paths from binary data, and there’s nothing in the docs to indicate otherwise.
And you can 100% do that. The problem is that you assume that a Path and an SVG are synonymous when they are different things. A path is a relatively simple string of movement instructions, usually describing a polygon of some kind. An SVG is a collection of paths, images, text, etc.