9
0
Fork 0

Add some RGB color macros

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4056 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-10-21 20:55:39 +00:00
parent 199253c929
commit 5b4bc9bea5
2 changed files with 20 additions and 2 deletions

View File

@ -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.

View File

@ -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