BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: FT813 is it possible to load about 20 images at the same time?  (Read 12235 times)

harry

  • Newbie
  • *
  • Posts: 9
    • View Profile

Hi,

If I understood correctly, every image needs to be assigned a bitmap handle.
According to the FT813 programmers guide section 4.6:


Quote
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?

This is too low for my application because I am displaying icons and I sometimes need to display more than 15 items at the same time.

Have I understood correctly and is there a workaround for this?

P.S. Converting multiple icons into one image is not an option because the position and number of icons changes dynamically.

Best wishes
 
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: FT813 is it possible to load about 20 images at the same time?
« Reply #1 on: May 17, 2021, 09:43:59 AM »

Hi,

A good way to do this (especially for icons which are likely the same size) is to use bitmap cells where you can use more than one image per handle.

To use bitmap cells, make an image which is one icon wide and n icons tall, and so you have all the icons stacked vertically with no gaps between.

Then load this as an image in the usual way. When you set the bitmap parameters, bitmap layout is the stride and height of one icon. bitmap size is the width and height of the entire block of n icons.

Then you can display each icon by specifying an index value. if you have three 60 x 60 icons as shown below, you can set index 0, 1 or 2 to display them. 0 will be the top icon.

VERTEX2II has parameters handle and cell and so can be used as shown below. But it can only reach coordinates up to 511.

An alternative is to use the cell instruction as shown here:
CELL(0)
VERTEX2F(100,100)


Code: [Select]
CLEAR(1, 1, 1)
CMD_DLSTART()
BITMAP_HANDLE(0)
BITMAP_SOURCE(0)
BITMAP_LAYOUT(RGB332, 60, 60)
BITMAP_LAYOUT_H(0, 0)
BITMAP_SIZE(NEAREST, BORDER, BORDER, 60, 180)
BITMAP_SIZE_H(0, 0)
BEGIN(BITMAPS)
VERTEX2II(10, 10, 0, 2)
END()
DISPLAY
SWAP

Best Regards, BRT Community
Logged

harry

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FT813 is it possible to load about 20 images at the same time?
« Reply #2 on: May 17, 2021, 10:54:33 AM »

Hi,

A good way to do this (especially for icons which are likely the same size) is to use bitmap cells where you can use more than one image per handle.

To use bitmap cells, make an image which is one icon wide and n icons tall, and so you have all the icons stacked vertically with no gaps between.

Then load this as an image in the usual way. When you set the bitmap parameters, bitmap layout is the stride and height of one icon. bitmap size is the width and height of the entire block of n icons.

Then you can display each icon by specifying an index value. if you have three 60 x 60 icons as shown below, you can set index 0, 1 or 2 to display them. 0 will be the top icon.

VERTEX2II has parameters handle and cell and so can be used as shown below. But it can only reach coordinates up to 511.

An alternative is to use the cell instruction as shown here:
CELL(0)
VERTEX2F(100,100)


Code: [Select]
CLEAR(1, 1, 1)
CMD_DLSTART()
BITMAP_HANDLE(0)
BITMAP_SOURCE(0)
BITMAP_LAYOUT(RGB332, 60, 60)
BITMAP_LAYOUT_H(0, 0)
BITMAP_SIZE(NEAREST, BORDER, BORDER, 60, 180)
BITMAP_SIZE_H(0, 0)
BEGIN(BITMAPS)
VERTEX2II(10, 10, 0, 2)
END()
DISPLAY
SWAP

Best Regards, BRT Community

Thank you very much.
I'll try this.

Best wishes
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 393
    • View Profile
Re: FT813 is it possible to load about 20 images at the same time?
« Reply #3 on: May 17, 2021, 04:28:40 PM »

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.

Quote
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.

Quote
Quote
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:

Quote
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.


Logged

harry

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FT813 is it possible to load about 20 images at the same time?
« Reply #4 on: May 19, 2021, 11:08:41 AM »

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.
.
.
.

Great! That was a lot of good information. I'll try the different options.
Logged