Add some RGB color macros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4056 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
2b4d02f66c
commit
6c6c0ba3d9
@ -747,8 +747,8 @@ EXTERN int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
*
|
||||
* Input Parameters:
|
||||
* hwnd - The window that will receive the bitmap image
|
||||
* dest - Describes the rectangular on the display that will receive the
|
||||
* the bit map.
|
||||
* dest - Describes the rectangular region on the display that will
|
||||
* receive the bit map.
|
||||
* src - The start of the source image. This is an array source
|
||||
* images of size CONFIG_NX_NPLANES.
|
||||
* origin - The origin of the upper, left-most corner of the full bitmap.
|
||||
|
@ -50,16 +50,34 @@
|
||||
#define RGBTO24(r,g,b) \
|
||||
((uint32_t)((r) & 0xff) << 16 | (uint32_t)((g) & 0xff) << 8 | (uint32_t)((b) & 0xff))
|
||||
|
||||
/* And these macros perform the inverse transformation */
|
||||
|
||||
#define RBG24RED(rgb) (((rgb) >> 16) & 0xff)
|
||||
#define RBG24GREEN(rgb) (((rgb) >> 8) & 0xff)
|
||||
#define RBG24BLUE(rgb) ( (rgb) & 0xff)
|
||||
|
||||
/* This macro creates RGB16 (5:6:5) from 8:8:8 RGB */
|
||||
|
||||
#define RGBTO16(r,g,b) \
|
||||
((((uint16_t)(r) << 11) & 0xf800) | (((uint16_t)(r) << 5) & 0x07e0) | ((uint16_t)(r) & 0x001f))
|
||||
|
||||
/* And these macros perform the inverse transformation */
|
||||
|
||||
#define RBG16RED(rgb) (((rgb) >> 8) & 0xf8)
|
||||
#define RBG16GREEN(rgb) (((rgb) >> 3) & 0xfc)
|
||||
#define RBG16BLUE(rgb) (((rgb) << 3) & 0xf8)
|
||||
|
||||
/* This macro creates RGB8 (3:3:2) from 8:8:8 RGB */
|
||||
|
||||
#define RGBTO8(r,g,b) \
|
||||
((((uint8_t)(r) << 5) & 0xe0) | (((uint8_t)(r) << 2) & 0x1c) | ((uint8_t)(r) & 0x03))
|
||||
|
||||
/* And these macros perform the inverse transformation */
|
||||
|
||||
#define RBG8RED(rgb) ( (rgb) & 0xe0)
|
||||
#define RBG8GREEN(rgb) (((rgb) << 3) & 0xe0)
|
||||
#define RBG8BLUE(rgb) (((rgb) << 6) & 0xc0)
|
||||
|
||||
/* This macro converts RGB24 (8:8:8) to RGB16 (5:6:5):
|
||||
*
|
||||
* 00000000 RRRRRRRR BBBBBBBB GGGGGGGG -> RRRRRBBB BBBGGGGG
|
||||
|
Loading…
x
Reference in New Issue
Block a user