Sprite colors wrong, TFT colors OK on Arduino Due, ILI9488 SPI #3595
-
Hi, When I like to add a sprites: I tried to play around with setSwapBytes and setColorDepth. I use the same code as in examples but get different results. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
Hi,
|
Beta Was this translation helpful? Give feedback.
-
Hier ondervind ik exact dezelfde problemen. Ook met een ILI9488 SPI display. |
Beta Was this translation helpful? Give feedback.
-
I found the problem. The colors need to be given in BRG instead of RGB. `
|
Beta Was this translation helpful? Give feedback.
I found the problem. The colors need to be given in BRG instead of RGB.
Maybe there is a better solution but this function converts the color:
`
/**
@brief Converts a 16-bit RGB color value to BRG (Blue-Red-Green).
This function takes a 16-bit color value in RGB 565 format (5 bits Red, 6 bits Green, 5 bits Blue)
and converts it to BRG format by rearranging the color components.
@param color A 16-bit color value in RGB 565 format.
@return uint16_t The converted color value in BRG 565 format.
*/
uint16_t rgb_to_brg(uint16_t color) {
// Extract individual color components (5-6-5 bits)
uint8_t r5 = (color >> 11) & 0x1F; // 5 bits for Red
uint8_t g6 = (color >> 5) & 0x3F; // 6 bits…