Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-26 15:01:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-26 15:01:01 +0400
commit63788b47d6e805a97aac1501d3e64e1ada7e40b3 (patch)
tree4a0f33da8af8081ec87cc9846dc83cc39f8b2289 /source/blender/blenlib
parente727056c2e34857dd5556e66c9858506eb63e987 (diff)
add vector versions of hsv_to_rgb, rgb_to_hsv & rgb_to_hsv_compat
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_color.h3
-rw-r--r--source/blender/blenlib/intern/math_color.c18
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index afdb5d40bd5..746a2b958ea 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -54,6 +54,7 @@ extern "C" {
/******************* Conversion to RGB ********************/
void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b);
+void hsv_to_rgb_v(const float hsv[3], float r_rgb[3]);
void hex_to_rgb(char *hexcol, float *r, float *g, float *b);
void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb);
void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace);
@@ -65,7 +66,9 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b);
void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv);
void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace);
void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv);
+void rgb_to_hsv_v(const float rgb[3], float r_hsv[3]);
void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv);
+void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3]);
unsigned int rgb_to_cpack(float r, float g, float b);
unsigned int hsv_to_cpack(float h, float s, float v);
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index abd9c1ea5b8..152fc98945f 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -90,6 +90,12 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
}
}
+/* convenience function for now */
+void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
+{
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], &r_rgb[0], &r_rgb[1], &r_rgb[2]);
+}
+
void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv)
{
float y, u, v;
@@ -252,6 +258,12 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
*lv = v;
}
+/* convenience function for now */
+void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
+{
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], &r_hsv[0], &r_hsv[1], &r_hsv[2]);
+}
+
void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv)
{
float orig_h = *lh;
@@ -272,6 +284,12 @@ void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *l
}
}
+/* convenience function for now */
+void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3])
+{
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &r_hsv[0], &r_hsv[1], &r_hsv[2]);
+}
+
/*http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html */
void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int colorspace)