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:
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r--source/blender/imbuf/intern/divers.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 90ee2692cf0..7fc7669601d 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -490,3 +490,23 @@ float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc)
return fbuf;
}
}
+
+
+/* no profile conversion */
+void IMB_color_to_bw(struct ImBuf *ibuf)
+{
+ float *rctf= ibuf->rect_float;
+ unsigned char *rct= (unsigned char *)ibuf->rect;
+ int i;
+ if(rctf) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
+ rctf[0]= rctf[1]= rctf[2]= rgb_to_grayscale(rctf);
+ }
+ }
+
+ if(rct) {
+ for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
+ rct[0]= rct[1]= rct[2]= rgb_to_grayscale_byte(rct);
+ }
+ }
+}