From cdd24fd459d15b8a00498b284d00c202cf872022 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 17 Dec 2022 22:50:52 +0000 Subject: Expose colour_mix() to backends (and others) Quite a few backends currently generate colours by multiplying the foreground colour by a fraction, effectively mixing it with black. On a black background, this might be reasonably replaced by mixing the background colour with white, but that's rather arithmetically fiddly. Happily, I already have a function for that and just need to expose it. --- puzzles.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'puzzles.h') diff --git a/puzzles.h b/puzzles.h index 9d02cd5..cbe7f88 100644 --- a/puzzles.h +++ b/puzzles.h @@ -374,6 +374,9 @@ char *fgetline(FILE *fp); char *bin2hex(const unsigned char *in, int inlen); unsigned char *hex2bin(const char *in, int outlen); +/* Mixes two colours in specified proportions. */ +void colour_mix(const float src1[3], const float src2[3], float p, + float dst[3]); /* Sets (and possibly dims) background from frontend default colour, * and auto-generates highlight and lowlight colours too. */ void game_mkhighlight(frontend *fe, float *ret, -- cgit v1.1