unsigned char r,g,b;
unsigned short tar;
...
tar = ((b>>3)<<10)|((g>>3)<<5)|(r>>3); // rgb: 555
tar = ((b>>3)<<11)|((g>>2)<<5)|(r>>3); // rgb: 5b5
16bit颜色转换方法
最新推荐文章于 2023-12-13 15:14:31 发布
unsigned char r,g,b;
unsigned short tar;
...
tar = ((b>>3)<<10)|((g>>3)<<5)|(r>>3); // rgb: 555
tar = ((b>>3)<<11)|((g>>2)<<5)|(r>>3); // rgb: 5b5