diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-24 07:49:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-24 07:49:56 +0400 |
commit | 734a4aa428da5c4a3e05eddbb643c0d26df3e69d (patch) | |
tree | 032de0df22bb1e89c6ecb306762ef8558884eed1 /source/blender/imbuf/intern/divers.c | |
parent | fc95ebbc556426b072fc41435bb76cadb16a56df (diff) |
fix [#27746] Black and White Render doesn't work and/or Saves as a Blank screen
convert to grayscale when saving renders rather then only writing the red channel.
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 20 |
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); + } + } +} |