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: FT800 Bitmap Handles  (Read 9525 times)

adouglas_ptl

  • Newbie
  • *
  • Posts: 2
    • View Profile
FT800 Bitmap Handles
« on: July 13, 2020, 11:02:24 AM »

Hello,

I am using the FT800 chip and am trying to load different icons to be displayed on the screen.  I have several different icons which all fit into one of 3 size categories.  Consequently, my plan was to use three different bitmap handles to display the different sized icons.

However, whenever I set the bitmap handle to anything other than 0, it does not seem to work and the icons appear to be loaded to bitmap handle 0 anyway.  This of course causes a problem because the different sized icons are all in the same bitmap handle and therefore do not all display properly.

I am using CMD_INFLATE to load the icons on to the chip and it all appears to work fine apart from the bitmap handle issue.  My code is written as follows:

1. Perform all required chip initialisation.
2. Set the required bitmap handle (e.g. to 1).
3. Send CMD_INFLATE followed by required RAM_G address where image will be stored.
4. Send all the bytes of data from compressed icon file (with padding if required).
5. Get the end address of decompressed data using CMD_GETPTR to know the next RAM_G address to use.
6. Repeat steps 2-5 until all icons are loaded.
7. Use BITMAP_SOURCE, BITMAP_LAYOUT and BITMAP_SIZE to configure all the appropriate settings.
8. Send BEGIN(BITMAPS) and then use VERTEX2II to try and display an icon at the required location.

As stated above, when using bitmap handle 0 with VERTEX2II the icons appear but using any other handle, it does not appear to work.  Is there something else I need to do to set the bitmap handle before writing the icon data, etc?

Thanks in advance!

Amy
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 745
    • View Profile
Re: FT800 Bitmap Handles
« Reply #1 on: July 13, 2020, 03:27:57 PM »

Hello,

Could you advise how large your images are when de-compressed? Also, could you post some code snippets of how you load the images to the bitmap handles and then how you display them?

If you prefer not to post code, you can email us at support.emea@brtchip.com

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: FT800 Bitmap Handles
« Reply #2 on: July 13, 2020, 05:01:09 PM »

While this should work I would also like to point you to CELL.
Either as command for VERTEX2F or as parameter for VERTEX2II.

With this you can combine icons of the same size into one binary.
For a project I combined 9 54x20 images into one image and converted it to L8 format.

Code: [Select]
#define MEM_BUTTONS 0x00005500 /* buttons, 54x180 L8, 9 cells , 9720 / 0x25f8 */
#define HANDLE_BUTTONS 5

/* somwhere in init() */
EVE_cmd_inflate(MEM_BUTTONS, buttons, sizeof(buttons));

/* part of the static display-list that is injected with cmd_append */
EVE_cmd_dl(BITMAP_HANDLE(HANDLE_BUTTONS));
EVE_cmd_dl(BITMAP_SOURCE(MEM_BUTTONS));
EVE_cmd_dl(BITMAP_SIZE(EVE_NEAREST, EVE_BORDER, EVE_BORDER, 54, 20));
EVE_cmd_dl(BITMAP_LAYOUT(EVE_L8, 54, 20));

/* part of the dynamically generated display-list */
EVE_cmd_dl(DL_BEGIN | EVE_BITMAPS);
EVE_cmd_dl(BITMAP_HANDLE(HANDLE_BUTTONS));
EVE_cmd_dl(TAG(10));
EVE_cmd_dl(CELL(1));
EVE_cmd_dl(VERTEX2F(46, 110));
EVE_cmd_dl(TAG(11));
EVE_cmd_dl(CELL(2));
EVE_cmd_dl(VERTEX2F(46, 175));

This has two advantages, first is it uses less of RAM_G for odd-resolution images, that is anything not divisible by 8.
And then the packed binary is smaller so it uses less space in your controller and is transferred faster over SPI.

Well, and yes of course you can easily change the icon on the fly, even use this for animations.
« Last Edit: July 14, 2020, 10:27:26 AM by Rudolph »
Logged