From 7079047538da71961102478a23cccdbd62c7cf9d Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 8 Jan 2010 11:14:30 +0000 Subject: Animation Channels Drawing Tweak: A solid color backdrop is now drawn behind the mute/protect toggles and sliders, reducing the visual clutter with long names still appearing behind the UI widgets. --- source/blender/blenlib/BLI_math_color.h | 3 +++ source/blender/blenlib/intern/math_color.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 7444e01c3a6..2123765643e 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -74,6 +74,9 @@ void linearrgb_to_srgb_v3_v3(float *col_to, float *col_from); int constrain_rgb(float *r, float *g, float *b); void minmax_rgb(short c[3]); +void rgb_byte_to_float(char *in, float *out); +void rgb_float_to_byte(float *in, char *out); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 6dbd9c1381f..a4bd11a4bc8 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -274,6 +274,26 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b) *b /= 255.0f; } +void rgb_byte_to_float(char *in, float *out) +{ + out[0]= ((float)in[0]) / 255.0f; + out[1]= ((float)in[1]) / 255.0f; + out[2]= ((float)in[2]) / 255.0f; +} + +void rgb_float_to_byte(float *in, char *out) +{ + int r, g, b; + + r= (int)(in[0] * 255.0); + g= (int)(in[1] * 255.0); + b= (int)(in[2] * 255.0); + + out[0]= (char)((r <= 0)? 0 : (r >= 255)? 255 : r); + out[1]= (char)((g <= 0)? 0 : (g >= 255)? 255 : g); + out[2]= (char)((b <= 0)? 0 : (b >= 255)? 255 : b); +} + /* ********************************* color transforms ********************************* */ -- cgit v1.2.3