SVG Not appearing

IN HEADER

std::unique_ptr<juce::Drawable> mySvg;

IN CALL to Paint

mySvg->drawWithin(g, myFrame.toFloat(), RectanglePlacement(RectanglePlacement::xRight), 0.5f);

IN THE CONSTRUCTOR

mySvg= Drawable::createFromImageData(MYSVGS::TestImage_svg, MYSVGS::TestImage_svgSize);

This sequence of calls works perfectly fine in a simple test project I built.

However, in another project the SVG doesn’t show up at all.

What are some things I should be looking into? At the moment, I’m busy commenting out code until something works. I’m not the most adept person at graphics

SOLUTION: The problem was in the call to paint(). I needed to reverse the order of my calls to set the background color and then draw the image

THIS WORKS

 //Set background
setColour(ResizableWindow::backgroundColourId, getLookAndFeel().findColour(ResizableWindow::backgroundColourId).juce::Colour::greyLevel(1.0));
g.fillAll(getLookAndFeel().findColour(ResizableWindow::backgroundColourId));

// LOGO
//
mySvg->drawWithin(g, myFrame.toFloat(), RectanglePlacement(RectanglePlacement::xRight), 0.5f);

THIS DOES NOT WORK

// LOGO
//
mySvg->drawWithin(g, myFrame.toFloat(), RectanglePlacement(RectanglePlacement::xRight), 0.5f);

//Set background
setColour(ResizableWindow::backgroundColourId, getLookAndFeel().findColour(ResizableWindow::backgroundColourId).juce::Colour::greyLevel(1.0));
g.fillAll(getLookAndFeel().findColour(ResizableWindow::backgroundColourId));
1 Like