Fill interface

Hello i have my own background image for my interface, But when i try to adjust the size to fill the background, It won’t do it,

void CompressorAudioProcessorEditor::paint (juce::Graphics& g)

{

// (Our component is opaque, so we must completely fill the background with a solid colour)

g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));

g.setColour (juce::Colours::white);



Background = juce::ImageCache::getFromMemory(BinaryData::Background_png, BinaryData::Background_pngSize);

g.drawImageWithin(Background, 0, 0, getWidth(), getHeight(), juce::RectanglePlacement::stretchToFit);

I’m not sure where the problem with this code is, however I personally find that it’s more convenient to use an ImageComponent for backgrounds. You can easily assign an image to it, and then just set its size and location with the setBounds() function like any other juce component.

I would note that drawImageWithin() tries to keep the aspect ratio of the original image, which may be getting in the way of what you want, so you might want to try the plain drawImage() here if you don’t want to go down the ImageComponent route.

Thanks