qt RGB565 转rgb

define RGB565_MASK_RED 0xF800

define RGB565_MASK_GREEN 0x07E0

define RGB565_MASK_BLUE 0x001F

uint8_t Rgb565ToRgb888(uint16_t rgb565)
{
uint8_t rgb24[3] = { 0 };

rgb24[0] = (rgb565 & RGB565_MASK_RED) >> 11;

rgb24[1] = (rgb565 & RGB565_MASK_GREEN) >> 5;

rgb24[2] = (rgb565 & RGB565_MASK_BLUE);

//往高位移动填满单字节的8位
rgb24[2] <<= 3;
rgb24[1] <<= 2;
rgb24[0] <<= 3;
//返回:RGB
printf("%d%s%d%s%d%s",rgb24[0],",",rgb24[1],",",rgb24[2],","); fflush(stdout);

}

posted @ 2023-12-08 23:27  zhaocundang  阅读(67)  评论(0编辑  收藏  举报