summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-10-02 23:33:46 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-10-02 23:33:46 +0100
commit506a0e7d940abb6a95a890caf024743a993c8dcd (patch)
treed9b84c6e18eadca4461ae979bca23b4d52a85387 /desktop
parentf19e827983518a65a65aa7ab663c59a921b02fa4 (diff)
downloadnetsurf-506a0e7d940abb6a95a890caf024743a993c8dcd.tar.gz
netsurf-506a0e7d940abb6a95a890caf024743a993c8dcd.tar.bz2
Add accessors for individual colour channels.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/plot_style.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/desktop/plot_style.h b/desktop/plot_style.h
index 71243a9a9..45813d40d 100644
--- a/desktop/plot_style.h
+++ b/desktop/plot_style.h
@@ -75,9 +75,21 @@
((c0 & 0x00ff00) * ( p)) ) >> 8) & 0x00ff00))
/* get a bitmap pixel (image/bitmap.h) into a plot colour */
-#define pixel_to_colour(b) \
+#define pixel_to_colour(b) \
b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)
+/* Get the red channel from a colour */
+#define red_from_colour(c) \
+ ((c ) & 0xff)
+
+/* Get the green channel from a colour */
+#define green_from_colour(c) \
+ ((c >> 8) & 0xff)
+
+/* Get the blue channel from a colour */
+#define blue_from_colour(c) \
+ ((c >> 16) & 0xff)
+
/**
* Colour type: XBGR
*/