Using images for background of component [SOLVED]

Hi,
I have a simple question: how can I use images (for example for background of component).
Thanks for reply

Where you have a class member

Image    m_Background;

Load the image in the class constructor, then in paint():

void CYourComponent::paint (Graphics& g)
{
    if (m_Background.isValid())
        g.drawImageAt (m_Background, 0, 0);

    :
}

Rail

2 Likes

Yes I know, but I do not know how to load an image (for example png) to Image class.

static Image ImageCache::getFromFile (const File & file)

https://bill-auger.github.io/JUCE/doxygen/doc/classImageCache.html#acc266a65cf61dd0a2f68e68840b4a5c4

Rail

1 Like

Thanks for your reply, I found what I need.

Image splash = ImageFileFormat::loadFrom(BinaryData::splashscreen_png, (size_t) BinaryData::splashscreen_pngSize);

I apologize for the confusion