Hi,
I am trying to read and display an image and I can’t understand why this is not working. So this is what I am doing.
- I have a png file of a knob saved on my desktop.
- I created an assets folder in the introjucer and saved the png file there too.
In my PluginEditor.h
private:
Image knob;
ImageComponent imageComponent;
Then in the PluginEditor.cpp, I have this in the constructor
knob = ImageFileFormat::loadFrom(File::File("…/…/…/…/Desktop/Knob.png"));
if (knob.isValid())
imageComponent.setImage(knob);
addAndMakeVisible(&imageComponent);
}
And in the resized function I have
void ProjectAudioProcessorEditor::resized()
{
imageComponent.setBounds(10, 10, 50, 50);
}
So, I ran it a bunch of times and nothing shows up. And setting breakpoints to check if knob loaded correctly, it is null. Can you guys help me? I am stuck. Why is the knob null?
Thanks in advance!