diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-01-08 14:14:30 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-01-08 14:14:30 +0300 |
commit | 7079047538da71961102478a23cccdbd62c7cf9d (patch) | |
tree | 2479933f0d78b8a863c61bdaf9a17b4b2e310404 /source/blender/blenlib | |
parent | 1b83b9c8b09bf56a029d11d5cae2d7dea56bb785 (diff) |
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color.c | 20 |
2 files changed, 23 insertions, 0 deletions
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 ********************************* */ |