cancel
Showing results for 
Search instead for 
Did you mean: 

How to create ARGB8888 dynamic bitmap on RGB565 platform?

amb
Associate III

Framebuffer is RGB565,Can I make a dynamic bitmap of ARGB8888? 

I made one by cacheable container and display the dynamic bitmap by a texturemapper but the image came out is not correct,something did appear on screen,but size and color not right. but if I change bitmap type to rgb565,the image show correctly,but with black background and  no alpha ,not what I wanted. There is enough  cache,I confirm the dynamic bitmap is created successfully on both type.I tried to display the dynamic bitmap by a Image widget,but the result is the same.

In this forum,I can see a solution,to register a LCD32bpp class and set it as Auxiliary LCD in the hal.

But I didn't found any thread on this subject.

How to use off screen rendering of a textarea in a... - STMicroelectronics Community

Can I get any help from any @st guys?

4 REPLIES 4
JohanAstrup
ST Employee

Hello @amb.

You are correct that you need to create an LCD32bpp object and pass it to the auxiliary LCD.

When TouchGFX renders a dynamic bitmap, it uses the auxiliary LCD. The auxiliary LCD is natively in the same format as the framebuffer. This means that the dynamic bitmaps are rendered to RAM in this format, which in this case means all dynamic bitmaps are in RGB565 format.

The format of the auxiliary LCD can be changed as follows:

#include <platform/driver/lcd/LCD32bpp.hpp>

static LCD32bpp lcd32;
HAL::getInstance()->setAuxiliaryLCD(&lcd32);

You can do it anywhere in the GUI code.

The downside of changing the format of the auxiliary LCD is that all dynamic bitmaps in the application will now be in 32bpp. However, you can change back and forth between formats at runtime. You can give it a nullpointer to reset to the default format.

Best regards,
Johan

Hello @JohanAstrup 

In my application,I have a few rgb565 dynamic bitmaps as the background,and I need only one ARGB dynamic bitmap as addon infomation layer.

As you said ,if I create rgb565 dynamic bitmap,I need to call HAL::getInstance()->setAuxiliaryLCD(null) and if I create ARGB565 dynamic bitmap,I need to call HAL::getInstance()->setAuxiliaryLCD(&lcd32),Is that correct?

How do I refresh content in container?Just call cacheableContainer.updateCache() ? Or I have to call setAuxiliaryLCD() before refresh?

I am still confused about this ,can you give some more information?

JohanAstrup
ST Employee

Good question!
I have checked, and the main LCD will actually be used as fallback if the color format of the dynamic bitmap does not match the color format of the auxiliary LCD. There, set up the auxiliary LCD to 32bpp, and then you should be able to render both 16bpp and 32bpp dynamic bitmaps, assuming your color depth is still 16bpp.

Please try it out and let me know if you experience any issues with the scenario described above.

Best regards,
Johan

I have tried your solution,but didn't work.

Here is my code structure:

 
static LCD32bpp lcd32;
Screen1View::Screen1View()
{	tickcount=0;

	dynamicBitmapRGB565 = Bitmap::dynamicBitmapCreate(768, 768, Bitmap::RGB565);

	HAL::getInstance()->setAuxiliaryLCD(&lcd32);
	dynamicBitmapsFace = Bitmap::dynamicBitmapCreate(200, 150, Bitmap::ARGB8888);

	hdgFace.setCacheBitmap(dynamicBitmapsFace);
	hdgFace.enableCachedMode(true);
	hdgFace.updateCache();

	rotator.setBitmap(dynamicBitmapsFace);
	rotator.setWidth(200);
	rotator.setHeight(150);
	rotator.setBitmapPosition(0.0f, 0.0f);
	rotator.setVisible(true);
	rotator.invalidate();
	HAL::getInstance()->setAuxiliaryLCD(0);
}

It should look like this:

20250906123207.png

but instead it looks:

20250906123233.png

hdgFace is a cacheable Container size 200*150. these two lines,one circle and one box with border are drawn to hdgFace.the box with border looks normal,but the other object is only half size on X axis.