Skip to main content
pk84
Associate III
March 7, 2023
Question

LTDC_PIXEL_FORMAT_RGB888, framebuffer format?

  • March 7, 2023
  • 11 replies
  • 3138 views

Hello,

I'm using LTDC_Display_1Layer example.

In case I use "LTDC_PIXEL_FORMAT_RGB888" in which format should I store a picture in the framebuffer?

I did following, but the pictures is not displayed correctly. 24bit value of a pixel is stored in one 32bit array position. Is that wrong?

const uint32_t RGB888_1024x600[614400] =
 
{
 
	0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff,
 
 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff,
 
 
 
..
 
 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff
 
};

This topic has been closed for replies.

11 replies

KnarfB
Super User
March 7, 2023

RGB888 is, and has ever been, a 24-bit pixel format, not a 32-bit one. Either pack your pixels manually to 24-bit, say in a uint8_t array, or use LTDC_PIXEL_FORMAT_ARGB8888 which is a 32-bit format with a 4th alpha (blending) byte.

hth

KnarfB

pk84
pk84Author
Associate III
March 7, 2023

Thank you. Still does not work with ARGB8888, at which position should be the 8bit alpha value?

Should it have the bold position, see below:

0x00ffffff

KnarfB
Super User
March 7, 2023
#define LCD_COLOR_BLUE ((uint32_t)0xFF0000FF)
#define LCD_COLOR_GREEN ((uint32_t)0xFF00FF00)
#define LCD_COLOR_RED ((uint32_t)0xFFFF0000)

pk84
pk84Author
Associate III
March 7, 2023

How must the pixels be arranged in the array?

At the moment it's simply first pixel up to last pixel...

KnarfB
Super User
March 7, 2023

Basically: yes, line by line. The lines in RAM may be longer than the actually visible part due to alignment. Depends on the setup. What board are you using?

hth

KnarfB

pk84
pk84Author
Associate III
March 7, 2023

It's a custom board, see current display:

(layerCfg.WindowsX1 / Y1 set to 480 / 272 and layerCfg.Backcolor.Green = 255;)

0693W00000aILmpQAG.jpg

pk84
pk84Author
Associate III
March 7, 2023

Or does somebody know how can I generate from a picture (bmp, jpg, png) a LTDC_PIXEL_FORMAT_ARGB8888 compatible output/ C-File?

pk84
pk84Author
Associate III
March 8, 2023

See attachment. I managed to convert a bmp-picture to ARGB888.

But the ARGB888 480x272 picture array, even with "LTDC_PIXEL_FORMAT_ARGB8888" the picture is not displayed correctly. I see only several lines in different colors...

What do I miss?

pk84
pk84Author
Associate III
March 8, 2023

I think the root cause is the conversion tool I use, where can I find a tool which convert picture to compatible LTDC format, as "LTDC_PIXEL_FORMAT_ARGB8888" ??