Support RGB222 format

Description

I have an LCD which uses RGB222 format (1 byte, 64 colors). I see that there’s not direct support in LVGL for this format. I wonder what would be the best way to support this particular format when using lv_color8_t datatype. I’m thinking the easiest would be to redefine all colors by forming an lv_color8_t with the expected format. In that case? How would I redefine every color which is used in the style?
I could do this programatically since it involves some simple bit shifting.
The alternative would be to do this on runtime inside the flush callback, but that would be really wasteful.
Also, what are the chances of adding this format to LVGL eventually? Would it collide too much with current interpretation of lv_color8_t? In my case the bits are padded to the left (MSB), I wonder if there could be a variation with the bits padded to the right, which would complicate things.

What MCU/Processor/Board and compiler are you using?

nRF52832 on NuttX, LCD7301 TFT LCD with transflective 176x176 64 color panel.

What LVGL version are you using?

latest stable

What do you want to achieve?

Draw in RGB222 without wasting performance

What have you tried so far?

Just planning still

Code to reproduce

N/A

Screenshot and/or video

N/A

Any ideas? Should I file an issue for this?
I kind of hacked it by using the pixel CB and modify the pixels sent to the display in-flight, but this is far from ideal as it is quite wasteful. I could also define my own theme and override colors but I think that certain color handling operations won’t be handled correctly.

(cc @kisvegabor)

Hi,

What’s the size of your display? If it’s small you can use set_px_cb in the display driver.

It’d be possible to support RGB222 similar to RGB332. People sometimes concern about LVGL supports only a few color formats, so I’m open to extending it. However, we need to careful to implement what really needs.

It is 176x176. Yes, I’m using set_px_cb to alter the colors on the fly as I mentioned, but I’d prefer to avoid it if possible.

Now, adding a custom color format is possible but it’s hacky and needs deep-diving into LVGL.
This topic was already raised several times so I added “better color format management” to our ROADMAP for v9.

It will take some time while it will be really added, but at least it’s on the ROADMAP now.

Great, thank you