Hello,
while using using CELL with multi-images is valid and good advice, especially with icons or animations for which
one of several images is to be displayed at a given position, this is not all there is to it.
If I understood correctly, every image needs to be assigned a bitmap handle.
Actually no, you could display as many images as you have memory for without ever changing the bitmap-handle.
Bitmap handle. The initial value is 0. The valid value range is from 0 to 31.
Description
By default, bitmap handles 16 to 31 are used for built-in font and 15 is used as scratch bitmap handle by co-processor engine commands CMD_GRADIENT, CMD_BUTTON and CMD_KEYS.
Graphics context
What I understand from this is that I can at most load 15 images at the same time?
No, you can setup and use 32 different bitmap-handles but this is not the amount of images
you can display at the same time.
Yes, 15 is scratch and should be avoided.
Yes, 16 to 31 are assigned to fonts but you can re-assign any one of these if you do not use that font.
So, why is this not the amount of images that can be displayed at the same time?
Because bitmap-handles are a way to store information for later use:
4.1 Graphics State
Note that the bitmap drawing state is special: Although the bitmap handle is part of the graphics
context, the parameters for each bitmap handle are not part of the graphics context. They are
neither saved nor restored by SAVE_CONTEXT and RESTORE_CONTEXT. These parameters are
changed using the BITMAP_SOURCE, BITMAP_LAYOUT/BITMAP_LAYOUT_H and
BITMAP_SIZE/BITMAP_SIZE_H commands. Once these parameters are set up, they can be
utilized at any display list by referencing the same bitmap handle until they were changed.
So while yes, the bitmap-handle is where the raster-engine gets the information from,
you can overwrite this information as often as you like:
CLEAR(1, 1, 1)
CMD_SETBITMAP(0, ARGB1555, 60, 60) /* translates to a couple of display-list commands */
BEGIN(BITMAPS)
VERTEX2F(1504, 1802)
BITMAP_SOURCE(7200) /* works as all images in this set have the same format and resolution */
VERTEX2F(1556, 3396)
BITMAP_SOURCE(14400)
VERTEX2F(3016, 1364)
BITMAP_SOURCE(21600)
VERTEX2F(2925, 2926)
BITMAP_SOURCE(28800)
VERTEX2F(4941, 222)
END()
If executed like this without anything else, bitmap-handle 0 is used for all of the images.