cancel
Showing results for 
Search instead for 
Did you mean: 

Colorize bitmap dynamically

Gom
Associate II

Hi

I have an image which is completely white, its shape is only defined by its alpha channel. What I'd like to do, is draw this image and dynamically change white to any color, while preserving its alpha channel. And it needs to be fast, as I'd like to animate color transitions. Does TouchGFX provide an optimized (ChromArt) way to draw something with a custom color applied?

As I haven't found anything so far, I came up with the following idea. I convert my source image to a dynamic bitmap in L8_ARGB8888 format: indices are alpha levels, and the palette is filled dynamically with the desired color, 1 alpha level per palette entry. This way, to adjust the color at runtime, I just need to write 256 pixels (the palette) instead of the whole bitmap.

This works fine but animated transitions are not smooth with a STM32F7. I definitely need a more optimized solution, can someone help me?

Thanks

3 REPLIES 3
Romain DIELEMAN
ST Employee

Hi,

I am not sure if this would be what you are looking for, but the box widget in TouchGFX Designer is just a rectangle (with set size and position) which you can assign a single color for all contained pixels and alpha. In terms of performance it is one of the lightweight widgets since it does not have to read any pixel data or do any complicated calculations.

The Chrom-ART peripheral is available with high performance STM32 families so it depends on what MCU you have. What is your setup?

/Romain

Gom
Associate II

Hi

Thanks for the reply. But I don't want a simple colored box, I want a colorized image. In other words, a bitmap + color.

My MCU is a STM32F746BG.

Gom
Associate II

I found interesting information about the L8_ARGB8888 format in this thread. However I failed to use the given ChromArtDMA class in my project (all I get is a black screen). Any help on how to make it work, or adapt the DMA class I use, to support accelerated L8 pixel transfers?