UI: panel tabs, use simple color interpolation that ignores alpha
This commit is contained in:
parent
311883fc3b
commit
2f01be2b2f
|
@ -189,6 +189,11 @@ void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const fl
|
|||
void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float v4[4], const float w[4]);
|
||||
void interp_v3_v3v3v3_uv(float p[3], const float v1[3], const float v2[3], const float v3[3], const float uv[2]);
|
||||
|
||||
void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t);
|
||||
void interp_v3_v3v3_uchar(unsigned char target[3], const unsigned char a[3], const unsigned char b[3], const float t);
|
||||
void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t);
|
||||
void interp_v4_v4v4_uchar(unsigned char target[4], const unsigned char a[4], const unsigned char b[4], const float t);
|
||||
|
||||
void mid_v3_v3v3(float r[3], const float a[3], const float b[3]);
|
||||
void mid_v2_v2v2(float r[2], const float a[2], const float b[2]);
|
||||
void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3]);
|
||||
|
|
|
@ -109,6 +109,33 @@ void interp_v3_v3v3v3_uv(float p[3], const float v1[3], const float v2[3], const
|
|||
p[2] = v1[2] + ((v2[2] - v1[2]) * uv[0]) + ((v3[2] - v1[2]) * uv[1]);
|
||||
}
|
||||
|
||||
void interp_v3_v3v3_uchar(char unsigned target[3], const unsigned char a[3], const unsigned char b[3], const float t)
|
||||
{
|
||||
float s = 1.0f - t;
|
||||
|
||||
target[0] = (char)floorf(s * a[0] + t * b[0]);
|
||||
target[1] = (char)floorf(s * a[1] + t * b[1]);
|
||||
target[2] = (char)floorf(s * a[2] + t * b[2]);
|
||||
}
|
||||
void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t)
|
||||
{
|
||||
interp_v3_v3v3_char((char *)target, (const char *)a, (const char *)b, t);
|
||||
}
|
||||
|
||||
void interp_v4_v4v4_uchar(char unsigned target[4], const unsigned char a[4], const unsigned char b[4], const float t)
|
||||
{
|
||||
float s = 1.0f - t;
|
||||
|
||||
target[0] = (char)floorf(s * a[0] + t * b[0]);
|
||||
target[1] = (char)floorf(s * a[1] + t * b[1]);
|
||||
target[2] = (char)floorf(s * a[2] + t * b[2]);
|
||||
target[3] = (char)floorf(s * a[3] + t * b[3]);
|
||||
}
|
||||
void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t)
|
||||
{
|
||||
interp_v4_v4v4_char((char *)target, (const char *)a, (const char *)b, t);
|
||||
}
|
||||
|
||||
void mid_v3_v3v3(float v[3], const float v1[3], const float v2[3])
|
||||
{
|
||||
v[0] = 0.5f * (v1[0] + v2[0]);
|
||||
|
|
|
@ -1419,34 +1419,34 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
|
|||
|
||||
/* Primary theme colors */
|
||||
unsigned char theme_col_back[4];
|
||||
unsigned char theme_col_text[4];
|
||||
unsigned char theme_col_text_hi[4];
|
||||
unsigned char theme_col_text[3];
|
||||
unsigned char theme_col_text_hi[3];
|
||||
|
||||
/* Tab colors */
|
||||
unsigned char theme_col_tab_bg[4];
|
||||
unsigned char theme_col_tab_active[4];
|
||||
unsigned char theme_col_tab_inactive[4];
|
||||
unsigned char theme_col_tab_active[3];
|
||||
unsigned char theme_col_tab_inactive[3];
|
||||
|
||||
/* Secondary theme colors */
|
||||
unsigned char theme_col_tab_outline[4];
|
||||
unsigned char theme_col_tab_divider[4]; /* line that divides tabs from the main area */
|
||||
unsigned char theme_col_tab_highlight[4];
|
||||
unsigned char theme_col_tab_highlight_inactive[4];
|
||||
unsigned char theme_col_tab_outline[3];
|
||||
unsigned char theme_col_tab_divider[3]; /* line that divides tabs from the main area */
|
||||
unsigned char theme_col_tab_highlight[3];
|
||||
unsigned char theme_col_tab_highlight_inactive[3];
|
||||
|
||||
|
||||
|
||||
UI_GetThemeColor4ubv(TH_BACK, theme_col_back);
|
||||
UI_GetThemeColor4ubv(TH_TEXT, theme_col_text);
|
||||
UI_GetThemeColor4ubv(TH_TEXT_HI, theme_col_text_hi);
|
||||
UI_GetThemeColor3ubv(TH_TEXT, theme_col_text);
|
||||
UI_GetThemeColor3ubv(TH_TEXT_HI, theme_col_text_hi);
|
||||
|
||||
UI_GetThemeColor4ubv(TH_TAB_BACK, theme_col_tab_bg);
|
||||
UI_GetThemeColor4ubv(TH_TAB_ACTIVE, theme_col_tab_active);
|
||||
UI_GetThemeColor4ubv(TH_TAB_INACTIVE, theme_col_tab_inactive);
|
||||
UI_GetThemeColor4ubv(TH_TAB_OUTLINE, theme_col_tab_outline);
|
||||
UI_GetThemeColor3ubv(TH_TAB_ACTIVE, theme_col_tab_active);
|
||||
UI_GetThemeColor3ubv(TH_TAB_INACTIVE, theme_col_tab_inactive);
|
||||
UI_GetThemeColor3ubv(TH_TAB_OUTLINE, theme_col_tab_outline);
|
||||
|
||||
blend_color_interpolate_byte(theme_col_tab_divider, theme_col_back, theme_col_tab_outline, 0.3f);
|
||||
blend_color_interpolate_byte(theme_col_tab_highlight, theme_col_back, theme_col_text_hi, 0.2f);
|
||||
blend_color_interpolate_byte(theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
|
||||
interp_v3_v3v3_uchar(theme_col_tab_divider, theme_col_back, theme_col_tab_outline, 0.3f);
|
||||
interp_v3_v3v3_uchar(theme_col_tab_highlight, theme_col_back, theme_col_text_hi, 0.2f);
|
||||
interp_v3_v3v3_uchar(theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
|
||||
|
||||
is_alpha = (ar->overlap && (theme_col_back[3] != 255));
|
||||
|
||||
|
|
Loading…
Reference in New Issue