diff options
author | Luca Rood <dev@lucarood.com> | 2017-02-02 01:40:49 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-02-02 01:40:49 +0300 |
commit | 57573df0d3c45629080996704fa8d32b458dcfa5 (patch) | |
tree | 831dc4a9ea78a3f2f3be8949464a98a6842c25e6 /source/blender/editors/interface/resources.c | |
parent | 4935e2449b2c0d52eb27f4889533d72c8e12df94 (diff) |
Add GetThemeColorBlendShade3ubv function
Differential Revision: https://developer.blender.org/D2484
Used by part of T49043
Diffstat (limited to 'source/blender/editors/interface/resources.c')
-rw-r--r-- | source/blender/editors/interface/resources.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 999556025db..38df7620ed6 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1491,6 +1491,23 @@ void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]) col[2] = b; } +void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3]) +{ + const unsigned char *cp1, *cp2; + + cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); + cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); + + CLAMP(fac, 0.0f, 1.0f); + col[0] = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]); + col[1] = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]); + col[2] = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]); + + CLAMP(col[0], 0, 255); + CLAMP(col[1], 0, 255); + CLAMP(col[2], 0, 255); +} + void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]) { int r, g, b, a; |