Add GetThemeColorBlendShade3ubv function

Differential Revision: https://developer.blender.org/D2484

Used by part of T49043
This commit is contained in:
Luca Rood
2017-02-01 20:40:49 -02:00
parent 4935e2449b
commit 57573df0d3
2 changed files with 20 additions and 0 deletions

View File

@@ -348,6 +348,9 @@ void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigne
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
// get three color values, range 0-255, complete with shading offset for the RGB components and blending
void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3]);
// get four color values, scaled to 0.0-1.0 range
void UI_GetThemeColor4fv(int colorid, float col[4]);
// get four color values, range 0.0-1.0, complete with shading offset for the RGB components

View File

@@ -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;