summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-10-21 20:55:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-10-21 20:55:39 +0000
commit16afd5674368ca9e20ca420d34ffad99a60e6c5e (patch)
tree7ade1d6fe6cf29832187056d9dcfdf45d684de41
parentf13bd38d6f502947c0fbeede02f14e5ea7159bd4 (diff)
downloadnuttx-16afd5674368ca9e20ca420d34ffad99a60e6c5e.tar.gz
nuttx-16afd5674368ca9e20ca420d34ffad99a60e6c5e.tar.bz2
nuttx-16afd5674368ca9e20ca420d34ffad99a60e6c5e.zip
Add some RGB color macros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4056 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/include/nuttx/nx/nx.h4
-rw-r--r--nuttx/include/nuttx/rgbcolors.h18
2 files changed, 20 insertions, 2 deletions
diff --git a/nuttx/include/nuttx/nx/nx.h b/nuttx/include/nuttx/nx/nx.h
index c848b91e5..d582256fb 100644
--- a/nuttx/include/nuttx/nx/nx.h
+++ b/nuttx/include/nuttx/nx/nx.h
@@ -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.
diff --git a/nuttx/include/nuttx/rgbcolors.h b/nuttx/include/nuttx/rgbcolors.h
index 7dc6ef42d..0a154a8b5 100644
--- a/nuttx/include/nuttx/rgbcolors.h
+++ b/nuttx/include/nuttx/rgbcolors.h
@@ -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