GIFReader.st
changeset 315 506e0ce38534
parent 312 7bddcba30299
child 331 304f9c439efa
--- a/GIFReader.st	Fri Jul 05 18:10:36 1996 +0200
+++ b/GIFReader.st	Fri Jul 05 23:07:28 1996 +0200
@@ -105,89 +105,6 @@
 
 !GIFReader methodsFor:'reading from file'!
 
-buildMask
-    |maskArray bytesPerMaskRow|
-
-    bytesPerMaskRow := (width+7) // 8.
-
-    maskArray := ByteArray new:bytesPerMaskRow * height.
-
-%{
-    int __w = __intVal(__INST(width));
-    int __h = __intVal(__INST(height));
-    int __x, __y;
-    int __outBits, __nOut;
-    unsigned char *__inP, *__outP, *__nextOutRow;
-    int __bpr = __intVal(bytesPerMaskRow);
-    int __maskPixel = __intVal(__INST(maskPixelValue));
-#ifdef DEBUG
-    unsigned char *outEnd;
-#endif
-
-    if (! __isByteArray(__INST(data))) goto fail;
-    if (! __isByteArray(maskArray)) goto fail;
-
-    __inP = __ByteArrayInstPtr(__INST(data))->ba_element;
-    __outP = __ByteArrayInstPtr(maskArray)->ba_element;
-
-#ifdef DEBUG
-    outEnd = __outP + (__byteArraySize(maskArray));
-#endif
-/*
-printf("outP: %x outEnd: %x sz: %d\n", __outP, outEnd, __byteArraySize(maskArray));
-*/
-
-    for (__y=__h; __y>0; __y--) {
-        __outBits = 0;
-        __nOut = 8;
-        __nextOutRow = __outP + __bpr;
-
-        for (__x=__w; __x>0; __x--) {
-            __outBits <<= 1;
-            if (*__inP != __maskPixel) {
-                __outBits |= 1;
-            }
-            __inP++;
-
-/*
- printf("x: %d  bits: %x\n", __x, __outBits);
-*/
-            if (--__nOut == 0) {
-#ifdef DEBUG
-                if (__outP >= outEnd) {
-                 printf("oops\n");
-                 goto fail;
-                }
-#endif
-                *__outP = __outBits;
-
-                __outP++;
-                __nOut = 8;
-                __outBits = 0;
-            }
-        }
-
-        if (__nOut != 8) {
-            __outBits <<= __nOut;
-
-#ifdef DEBUG
-            if (__outP >= outEnd) {
-             printf("oops2\n");
-             goto fail;
-            }
-#endif
-            *__outP = __outBits;
-
-        }
-        __outP = __nextOutRow;
-    }
-fail: ;
-%}.
-    mask := Depth1Image width:width height:height fromArray:maskArray.
-
-    "Created: 21.6.1996 / 11:43:47 / cg"
-!
-
 checkGreyscaleColormap
     "return true, if colormap is actually a greymap.
      Could be used to convert it into a greyScale image - which is not yet done."
@@ -399,7 +316,7 @@
         "/ ok, there is a maskValue
         "/ build a Depth1Image for it.
         "/
-        self buildMask
+        self buildMaskFromColor:maskPixelValue
     ].
 
     "
@@ -407,7 +324,8 @@
      GIFReader fromFile:'../fileIn/bitmaps/garfield.gif'
     "
 
-    "Modified: 5.7.1996 / 14:19:35 / cg"
+    "Modified: 5.7.1996 / 12:32:33 / cg"
+    "Modified: 5.7.1996 / 17:32:01 / stefan"
 !
 
 makeGreyscale
@@ -543,6 +461,6 @@
 !GIFReader  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.38 1996-07-05 15:27:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.39 1996-07-05 21:07:28 stefan Exp $'
 ! !
 GIFReader initialize!