diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-26 15:01:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-26 15:01:01 +0400 |
commit | 63788b47d6e805a97aac1501d3e64e1ada7e40b3 (patch) | |
tree | 4a0f33da8af8081ec87cc9846dc83cc39f8b2289 /source/blender/editors/interface/interface_widgets.c | |
parent | e727056c2e34857dd5556e66c9858506eb63e987 (diff) |
add vector versions of hsv_to_rgb, rgb_to_hsv & rgb_to_hsv_compat
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 4d483b69ca2..87c2f2dc20b 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1885,7 +1885,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* color */ ui_get_but_vectorf(but, rgb); copy_v3_v3(hsv, ui_block_hsv_get(but->block)); - rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2); + rgb_to_hsv_compat_v(rgb, hsv); copy_v3_v3(hsvo, hsv); /* exception: if 'lock' is set @@ -1911,7 +1911,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) ui_hsvcircle_vals_from_pos(hsv, hsv + 1, rect, centx + co * radius, centy + si * radius); CLAMP(hsv[2], 0.0f, 1.0f); /* for display only */ - hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2); + hsv_to_rgb_v(hsv, col); glColor3fv(col); glVertex2f(centx + co * radius, centy + si * radius); } @@ -2081,37 +2081,31 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha) static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) { - float rgb[3], h, s, v; + float rgb[3]; float x = 0.0f, y = 0.0f; float *hsv = ui_block_hsv_get(but->block); - float hsvn[3]; + float hsv_n[3]; - h = hsv[0]; - s = hsv[1]; - v = hsv[2]; + copy_v3_v3(hsv_n, hsv); ui_get_but_vectorf(but, rgb); - rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v); - - hsvn[0] = h; - hsvn[1] = s; - hsvn[2] = v; + rgb_to_hsv_compat_v(rgb, hsv_n); - ui_draw_gradient(rect, hsvn, but->a1, 1.f); + ui_draw_gradient(rect, hsv_n, but->a1, 1.0f); switch ((int)but->a1) { case UI_GRAD_SV: - x = v; y = s; break; + x = hsv_n[2]; y = hsv_n[1]; break; case UI_GRAD_HV: - x = h; y = v; break; + x = hsv_n[0]; y = hsv_n[2]; break; case UI_GRAD_HS: - x = h; y = s; break; + x = hsv_n[0]; y = hsv_n[1]; break; case UI_GRAD_H: - x = h; y = 0.5; break; + x = hsv_n[0]; y = 0.5; break; case UI_GRAD_S: - x = s; y = 0.5; break; + x = hsv_n[1]; y = 0.5; break; case UI_GRAD_V: - x = v; y = 0.5; break; + x = hsv_n[2]; y = 0.5; break; } /* cursor */ @@ -2140,7 +2134,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) color_profile = BLI_PR_NONE; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2); + rgb_to_hsv_v(rgb, hsv); v = hsv[2]; if (color_profile) |