RGB565,RGB888
2014-03-19 08:23
447 查看
// 颜色的转换
/* create 24 bit 8/8/8 format pixel (0x00RRGGBB) from RGB triplet*/
#define RGB2PIXEL888(r,g,b) \
(((r) << 16) | ((g) << 8) | (b))
/* create 16 bit 5/6/5 format pixel from RGB triplet */
#define RGB2PIXEL565(r,g,b) \
((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
/* create 24 bit 8/8/8 format pixel from RGB colorval (0x00RRGGBB)*/
#define COLOR2PIXEL888(c) \
((((c) & 0xff) << 16) | ((c) & 0xff00) | (((c) & 0xff0000) >> 16))
/* create 16 bit 5/6/5 format pixel from RGB colorval (0x00RRGGBB)*/
#define COLOR2PIXEL565(c) \
((((c) & 0xf8) << 8) | (((c) & 0xfc00) >> 5) | (((c) & 0xf80000) >> 19))
/* return 8/8/8 bit r, g, or b, component of 24 bit pixel */
#define PIXEL888RED(pixel) (Uint8)(((pixel) >> 16) & 0xff)
#define PIXEL888GREEN(pixel) (Uint8)(((pixel) >> 8) & 0xff)
#define PIXEL888BLUE(pixel) (Uint8)((pixel) & 0xff)
/* return 5/6/5 bit r, g or b component of 16 bit pixel*/
#define PIXEL565RED(pixel) (Uint8)(((pixel) >> 11) & 0x1f)
#define PIXEL565GREEN(pixel) (Uint8)(((pixel) >> 5) & 0x3f)
#define PIXEL565BLUE(pixel) (Uint8)((pixel) & 0x1f)
/* create 24 bit 8/8/8 format pixel (0x00RRGGBB) from RGB triplet*/
#define RGB2PIXEL888(r,g,b) \
(((r) << 16) | ((g) << 8) | (b))
/* create 16 bit 5/6/5 format pixel from RGB triplet */
#define RGB2PIXEL565(r,g,b) \
((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
/* create 24 bit 8/8/8 format pixel from RGB colorval (0x00RRGGBB)*/
#define COLOR2PIXEL888(c) \
((((c) & 0xff) << 16) | ((c) & 0xff00) | (((c) & 0xff0000) >> 16))
/* create 16 bit 5/6/5 format pixel from RGB colorval (0x00RRGGBB)*/
#define COLOR2PIXEL565(c) \
((((c) & 0xf8) << 8) | (((c) & 0xfc00) >> 5) | (((c) & 0xf80000) >> 19))
/* return 8/8/8 bit r, g, or b, component of 24 bit pixel */
#define PIXEL888RED(pixel) (Uint8)(((pixel) >> 16) & 0xff)
#define PIXEL888GREEN(pixel) (Uint8)(((pixel) >> 8) & 0xff)
#define PIXEL888BLUE(pixel) (Uint8)((pixel) & 0xff)
/* return 5/6/5 bit r, g or b component of 16 bit pixel*/
#define PIXEL565RED(pixel) (Uint8)(((pixel) >> 11) & 0x1f)
#define PIXEL565GREEN(pixel) (Uint8)(((pixel) >> 5) & 0x3f)
#define PIXEL565BLUE(pixel) (Uint8)((pixel) & 0x1f)
相关文章推荐
- RGB888->RGB565->RGB888
- RGB888->RGB565
- RGB565 与 RGB888的相互转换
- RGB888->RGB565->RGB888
- RGB888 转 RGB565
- RGB565颜色表,附RGB888转RGB565工具,RGB24转RGB565工具
- RGB565 与RGB888的区别
- RGB565 与RGB888的区别
- RGB888转RGB565
- RGB565 & RGB888
- RGB565 与RGB888的区别
- RGB565 与 RGB888的相互转换
- RGB565->RGB888
- RGB888转RGB565,wince BMP控件显示位图
- rgb888与rgb565转换的影响
- RGB888转RGB565
- JAVA中颜色RGB888转RGB565的简单方法
- ARM平台YUV转RGB888
- RGB格式转化(888-》666)
- RGB565 to RGB24, RGB555 & RGB24