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:
authorPeter Schlaile <peter@schlaile.de>2012-03-17 23:31:28 +0400
committerPeter Schlaile <peter@schlaile.de>2012-03-17 23:31:28 +0400
commit8bf1615ce3aa44e9f68b1c8483edeabaa290307a (patch)
tree6950d6ea08986c79d4e2637a555d922efb5d6e0a /source/blender/imbuf/intern/divers.c
parent02abb636a35b2f3dfcb430a87219f5d15cf35a77 (diff)
== Sequencer ==
Bugfix: [#28159] sequencer strip crop values on proxy not scene render size Also: IMB saturation change moved into imbuf-module.
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r--source/blender/imbuf/intern/divers.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 45f58ee9d17..bd9b32e77f4 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -750,3 +750,30 @@ void IMB_buffer_float_clamp(float *buf, int width, int height)
buf[i] = MIN2(1.0, buf[i]);
}
}
+
+/**************************** alter saturation *****************************/
+
+void IMB_saturation(ImBuf * ibuf, float sat)
+{
+ int i;
+ unsigned char *rct= (unsigned char *)ibuf->rect;
+ float *rctf= ibuf->rect_float;
+ float hsv[3];
+
+ if(rct) {
+ float rgb[3];
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
+ rgb_uchar_to_float(rgb, rct);
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
+ rgb_float_to_uchar(rct, rgb);
+ }
+ }
+
+ if(rctf) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
+ rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
+ hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
+ }
+ }
+}