From 1e6b0f1d76198cf1770d92684bd70ed35d981d0d Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Feb 2020 18:21:00 +0000 Subject: Plot style: Add helper to swap red and blue channels. --- include/netsurf/plot_style.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h index bc8604114..fee7a1078 100644 --- a/include/netsurf/plot_style.h +++ b/include/netsurf/plot_style.h @@ -188,6 +188,12 @@ typedef struct plot_font_style { #define blue_from_colour(c) \ ((c >> 16) & 0xff) +/* Swap red and blue channels in a colour */ +#define colour_rb_swap(c) \ + (((0x000000ff & c) << 16) | \ + ((0x0000ff00 & c) ) | \ + ((0x00ff0000 & c) >> 16)) + /** Colour components */ enum plot_colour_component { PLOT_COLOUR_COMPONENT_RED, -- cgit v1.2.3