Hello Mike,
interesting in this context is the motivation why do you want to stop storing images in the flash? I assume following two reasons:
Reason 1: Insufficient flash size
Reason 2: Exchange images in the target system
If the first case is true, can you provide us more details concerning your HW? How much flash is available? Anyway, there are two configuration techniques to save flash:
1. Configure the bitmaps to be stored in Compressed format.
2. Configure the pixel format how bitmap data is stored. For example, Index8 format can be up to 4 times more efficient than Native format. Please note: the possibility to configure the format has been added in Embedded Wizard 9.20.
In case your motivation is the requirement to exchange the image files in the target system (for example, you want your customer to be able to customize some images, etc.), then the here in this thread discussed Extern Bitmap is the right approach. In this case I would:
1. On your SD Card store all the image files.
2. The SD card should also manage for each file additional attribute information: FrameSize and FrameDelay. This allows your customer to not only change the image contents but also their size, etc.
3. In the GUI application you limit to specify the name of the desired image file, e.g. "WelcomeLogo".
4. The implementation of the EwLoadExternBitmap() function searches on SD card for the corresponding image file. Similarly the function also searches in the attributes associated to the image file for the frame size and frame delay values. Concrete, the function does:
a. Read the attributes associated to the image file (frame size, frame delay)
b. Open and load the image file by using e.g. libPNG decoder, etc.
c. Query the actual size of the image (width, height)
d. Calculate the number of frames contained in the image. Assuming, the frames are stored in columns and rows side-by-side:
int cols = image_width / frame_width;
int rows = image_height / frame_height;
int frames = cols * rows;
e. Create an Embedded Wizard Bitmap with the previously estimated frame size (step a) and the calculated number of frames (step d).
f. For each frame lock the Embedded Wizard bitmap and copy there the corresponding frame area from the image file. Assuming in the image file the frames are arranged in columns and rows, the first frame (number 0) could be found at the top left corner of the image. The next frame on its right. If all frames within the row are processed the next frame is found at the left edge of the next row. This is the usual arrangement. In fact, however, it is up to you how you manage the frames. You can even store the frames in separate files within sub-directories. etc.
This approach avoids the necessity of providing any attribute information via Extern Bitmap interface. In your GUI application you limit to specify the desired image e.g. "WelcomeLogo". How large the image is, whether it does contain multiple frames and how many frames they are, it is a detail which can be changed when the images are replaced on the SD card. For example the welcome logo could be replaced by a short animation sequence composed of multiple frames. Therefore, I would manage the image attributes together with the image files on the SD card.
You could manage for this purpose an attribute file where for each image file you store the associated attributes. Or, more pragmatic, you can encode the attributes directly in the name of the image file. For example, the following file name could be interpreted as composed of four parts: the name of the image as it will be addressed from the GUI application (WelcomeLogo), the frame width (320), frame height (240) and the frame delay in milliseconds (50):
WelcomeLogo-320-240-50.png
The GUI application asks for the image named WelcomeLogo. The implementation of EwLoadExternBitmap() searches the SD card for the file starting with WelcomeLogo- and once known its complete name, decodes from the name the attributes for the frame width, frame height and frame delay. When you exchange the image files later you only need to adapt the attributes directly in the image file name. This approach is just a suggestion and you can implement any other kind of attribute management.
I hope this explanation helps you further. In order to provide you better indication it could help us to better know your exact motivation for not to store the image files in flash.
Best regards
Paul Banach