summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2020-04-07 21:11:06 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2020-04-07 21:28:12 +0100
commit30b9c088b0a8955290b1c97983fd5624aa44d32f (patch)
treee6431a80800ddb2bcb0545e637ed1dab3c9eea71 /include
parent02400588e413a7aafa14f61408b272c8a131a85e (diff)
downloadnetsurf-30b9c088b0a8955290b1c97983fd5624aa44d32f.tar.gz
netsurf-30b9c088b0a8955290b1c97983fd5624aa44d32f.tar.bz2
Plot style: Add half lighten/darken helper variants.
Diffstat (limited to 'include')
-rw-r--r--include/netsurf/plot_style.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h
index 6f2977f63..15069a52b 100644
--- a/include/netsurf/plot_style.h
+++ b/include/netsurf/plot_style.h
@@ -124,6 +124,11 @@ typedef struct plot_font_style {
} plot_font_style_t;
+/* Darken a colour by taking seven eighths of each channel's intensity */
+#define half_darken_colour(c1) \
+ ((((7 * (c1 & 0xff00ff)) >> 3) & 0xff00ff) | \
+ (((7 * (c1 & 0x00ff00)) >> 3) & 0x00ff00))
+
/* Darken a colour by taking three quarters of each channel's intensity */
#define darken_colour(c1) \
((((3 * (c1 & 0xff00ff)) >> 2) & 0xff00ff) | \
@@ -134,6 +139,12 @@ typedef struct plot_font_style {
((((9 * (c1 & 0xff00ff)) >> 4) & 0xff00ff) | \
(((9 * (c1 & 0x00ff00)) >> 4) & 0x00ff00))
+/* Lighten a colour by taking seven eighths of each channel's intensity
+ * and adding a full one eighth intensity */
+#define half_lighten_colour(c1) \
+ (((((7 * (c1 & 0xff00ff)) >> 3) + 0x200020) & 0xff00ff) | \
+ ((((7 * (c1 & 0x00ff00)) >> 3) + 0x002000) & 0x00ff00))
+
/* Lighten a colour by taking 12/16ths of each channel's intensity
* and adding a full 4/16ths intensity */
#define lighten_colour(c1) \