Parameters for GetFromMemory?


#1

Hi, I loaded the image as part of my project. Its under "myproject\images\image.png". How to speccify it in the GetfromMemory function??

Image myImage(ImageCache::getFromMemory(<What to specify here??>));

Thanks in advance for your reply.


#2

You need to make sure you loaded the image as a "binary resource" (That's a tick in the Introjucer Source configuration - where you can choose whether a file should be compiled as a C++ source and/or added as a binary resource instead)

Then the Introjucer will generate a static array in BinaryData.cpp containing your file's content, named name_of_your_image_png

In the code you then do this:

Image myImage = ImageCache::getFromMemory (BinaryData::name_of_your_image_png,    
                                           BinaryData::name_of_your_image_pngSize);