cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple bitmaps with the same pixel data but different color lookup tables

AWies.1
Associate III

I have the following problem to solve: I have buttons for selecting device 1, device 2, device 3, etc. Each device can have the status OK, warning, error, and then two additional states. So I like to show the status of the device by using different color buttons. Currently I have different versions of the buttons, in green, yellow, red, etc. and it works. This however wastes a lot of precious FLASH memory space. For the buttons the pixel data is the same, only the color lookup table is different. Is there a more elegant way of creating the button bitmaps with different colors? I would like to have the pixel data and the lookup tables in FLASH memory and then dynamically combine them to the bitmaps.

7 REPLIES 7
AWies.1
Associate III

Another thing: I could not find documentation about the format of the color lookup table...

What's the source format? BMP

Is the image monochrome or shaded?

Other systems typically render buttons on the fly, taking a template or edge profiles, and then add text, colour etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AWies.1
Associate III

No source format. 8-bit pixel data. I was thinking of using the dynamicBitmapCreateExternal(w, h, *pixel, format) function to create a dynamic bitmap, but then the color lookup table (CLUT) is expected to start 4 bytes after the end of the pixel data. So I cannot use the pixel data from another button and then add the lookup table. I would need to copy the data into some memory location first and then add the lookup table. This defeats the purpose of reducing the FLASH and RAM footprint... I was hoping for a function like dynamicBitmapCreateExternalWithCLUT(w, h, *pixel, *clut, format).

MM..1
Chief II

I too ask for this and specify question howto add bitmat to bitmapdatabase without designer

const touchgfx::Bitmap::BitmapData bitmap_database[] =
{
    { _nbutu_44_l, _nbutu_44_l_extra_data, 120, 480, 0, 0, 120, (uint8_t)(touchgfx::Bitmap::L8) >> 3, 480, (uint8_t)(touchgfx::Bitmap::L8) & 0x7 },
    { _nbutu_44_r, _nbutu_44_r_extra_data, 120, 480, 0, 0, 120, (uint8_t)(touchgfx::Bitmap::L8) >> 3, 480, (uint8_t)(touchgfx::Bitmap::L8) & 0x7 },
};

when you see first pointer is date , second is CLUT, then when create new line with new only CLUT pointer ...

But how to add into generated const array?

AWies.1
Associate III

Unfortunately there is no way to add to this array, since it is in the generated section of the code. I was thinking of copying the content of this array and then adding my own bitmaps. But then there is no indicator which tells me how large the array is (though I could back calculate by the size of it), and I do not know what happens if I call the function for registering the bitmap database again. Will this add to the database, or overwrite it, or fail? That part of the code is hidden in the library...

MM..1
Chief II

Hi i dont ask you, but TFX creators. Now i see only one way for us, in designer add all images , generate code, then replace this array and remove equal image data leave only CLUT extra in generated images cpp files. Store images folder generated for next recovery...

in my example remove _nbutu_44_r part in cpp and in database use _l in both images

const touchgfx::Bitmap::BitmapData bitmap_database[] =
{
    { _nbutu_44_l, _nbutu_44_l_extra_data, 120, 480, 0, 0, 120, (uint8_t)(touchgfx::Bitmap::L8) >> 3, 480, (uint8_t)(touchgfx::Bitmap::L8) & 0x7 },
    { _nbutu_44_l, _nbutu_44_r_extra_data, 120, 480, 0, 0, 120, (uint8_t)(touchgfx::Bitmap::L8) >> 3, 480, (uint8_t)(touchgfx::Bitmap::L8) & 0x7 },
};

AWies.1
Associate III

I am now trying to solve this issue by using dynamic bitmaps. My idea is to create the bitmap, then copy the original data into the location for the dynamic bitmap, and then change the CLUT. In principle, it works, but I suddenly get display errors, which look like buffer underruns. Intermittently what is shown on the screen is disrupted. It happens randomly. I went back to a version without dynamic bitmaps, and everything is fine again.

For the screen I am using double-buffer, video memory is located in an external SDRAM, in two separate paged, which is hooked up 16-bit wide (out of I/O lines for 32-bit...). The SDRAM is running at 100MHz. My display is 800x480 pixel @ currently 30Hz, ARGB. The bandwidth of the SDRAM should be sufficient to support this resolution, and long as no other periphery is stealing too much bus bandwidth. There is nothing else connected to the FMC, only the SDRAM. Additionally, I set the priority of the AXI QoS register to 0x0F, which is highest priority. I am still getting the display errors. Additonnally, it does not make a difference whether I place the bitmap buffer in the SDRAM or internal RAM.

What could be going on here?

Alex