From 506a0e7d940abb6a95a890caf024743a993c8dcd Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 2 Oct 2013 23:33:46 +0100 Subject: Add accessors for individual colour channels. --- desktop/plot_style.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3