[Bf-committers] [PATCH] source/blender/imbuf/intern/iris.c: add support for zsize=2 images

Melchior FRANZ bf-committers@blender.org
Tue, 23 Mar 2004 02:20:31 +0100


Hi,

Blender does currently not know how to deal with zsize=2 sgi images.
These are grayscale images with alpha layer. As of now, the first channel
is interpreted as red, and the alpha layer as green. See here for a test
image (should be black & white; compare with GIMP):

  http://members.aon.at/mfranz/gray-alpha.rgb  (18kB)

m.



Index: iris.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/imbuf/intern/iris.c,v
retrieving revision 1.6
diff -u -p -r1.6 iris.c
--- iris.c      4 Dec 2003 18:18:05 -0000       1.6
+++ iris.c      23 Mar 2004 01:17:55 -0000
@@ -382,6 +382,14 @@ struct ImBuf *imb_loadiris(unsigned char
                        rect[1] = rect[2] = rect[3];
                        rect += 4;
                }
+       } else if (image.zsize == 2){
+               /* grayscale with alpha */
+               rect = (uchar *) ibuf->rect;
+               for (x = ibuf->x * ibuf->y; x > 0; x--) {
+                       rect[0] = rect[2];
+                       rect[1] = rect[2] = rect[3];
+                       rect += 4;
+               }
        } else if (image.zsize == 3){
                /* add alpha */
                rect = (uchar *) ibuf->rect;