diff options
author | Peter Schlaile <peter@schlaile.de> | 2012-03-17 23:31:28 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2012-03-17 23:31:28 +0400 |
commit | 8bf1615ce3aa44e9f68b1c8483edeabaa290307a (patch) | |
tree | 6950d6ea08986c79d4e2637a555d922efb5d6e0a /source/blender/imbuf | |
parent | 02abb636a35b2f3dfcb430a87219f5d15cf35a77 (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')
-rw-r--r-- | source/blender/imbuf/IMB_imbuf.h | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index a68bbb97b62..a0c737b44fc 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -375,6 +375,7 @@ void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */ void IMB_convert_profile(struct ImBuf *ibuf, int profile); float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc); void IMB_color_to_bw(struct ImBuf *ibuf); +void IMB_saturation(struct ImBuf *ibuf, float sat); /* converting pixel buffers */ void IMB_buffer_byte_from_float(unsigned char *rect_to, const float *rect_from, 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); + } + } +} |