Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 02 Sep 2016 17:42:18 +0100
branchjv
changeset 7542 9e125aa140f9
parent 7541 39940e2446a5 (current diff)
parent 7537 bdc9ada5cde7 (diff)
child 7543 16c25df685f0
Merge
Depth32Image.st
DeviceGraphicsContext.st
Form.st
GraphicsContext.st
GraphicsMedium.st
Image.st
SimpleView.st
WinWorkstation.st
WindowSensor.st
XWorkstation.st
XftFontDescription.st
--- a/Depth16Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth16Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
 	      All Rights Reserved
@@ -78,6 +76,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixelValue.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -94,6 +94,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
--- a/Depth1Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth1Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -71,7 +69,7 @@
 !Depth1Image methodsFor:'accessing-pixels'!
 
 pixelAtX:x y:y
-    "retrieve a pixelValue at x/y; return a number.
+    "retrieve a pixelValue at x/y; return a pixel value.
      The interpretation of the returned value depends on the photometric
      and the colormap. See also Image>>atX:y:)
      Pixels start at 0@0 for upper left pixel, end at
@@ -120,6 +118,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set a pixels value at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -133,20 +133,20 @@
     OBJ w = __INST(width);
 
     if (__isByteArray(b) && __bothSmallInteger(x, y) && __isSmallInteger(w) ) {
-	int _w = __intVal(w);
-	int _y = __intVal(y);
-	int _x = __intVal(x);
-	int _idx;
+        int _w = __intVal(w);
+        int _y = __intVal(y);
+        int _x = __intVal(x);
+        int _idx;
 
-	_idx = ((_w + 7) >> 3) * _y + (_x >> 3);
-	if ((unsigned)_idx < __byteArraySize(b)) {
-	    if (aPixelValue == __MKSMALLINT(0)) {
-		__ByteArrayInstPtr(b)->ba_element[_idx] &= ~(0x80 >> (_x & 7));
-	    } else {
-		__ByteArrayInstPtr(b)->ba_element[_idx] |= (0x80 >> (_x & 7));
-	    }
-	    RETURN( self );
-	}
+        _idx = ((_w + 7) >> 3) * _y + (_x >> 3);
+        if ((unsigned)_idx < __byteArraySize(b)) {
+            if (aPixelValue == __MKSMALLINT(0)) {
+                __ByteArrayInstPtr(b)->ba_element[_idx] &= ~(0x80 >> (_x & 7));
+            } else {
+                __ByteArrayInstPtr(b)->ba_element[_idx] |= (0x80 >> (_x & 7));
+            }
+            RETURN( self );
+        }
     }
 %}.
     "fall back code for nonByteArray or nonInteger arguments"
@@ -157,9 +157,9 @@
     byte := bytes at:index.
     mask := #(16r80 16r40 16r20 16r10 16r08 16r04 16r02 16r01) at:((x \\ 8) + 1).
     aPixelValue == 0 ifTrue:[
-	byte := byte bitAnd:(mask bitInvert)
+        byte := byte bitAnd:(mask bitInvert)
     ] ifFalse:[
-	byte := byte bitOr:mask
+        byte := byte bitOr:mask
     ].
     bytes at:index put:byte
 ! !
@@ -196,7 +196,7 @@
 
     |f c0 c1|
 
-    f := Form width:width height:height fromArray:self bits onDevice:aDevice.
+    f := Form imageForm width:width height:height fromArray:self bits onDevice:aDevice.
     c0 := self colorFromValue:0.
     c1 := self colorFromValue:1.
     c0 brightness > 0.5 ifTrue:[
@@ -614,11 +614,12 @@
 
     "all colors are available, this is easy now"
 
-    form := Form onDevice:aDevice.
+    form := Form imageForm onDevice:aDevice.
     form notNil ifTrue:[
         form
             colorMap:(Array with:color0 with:color1);
-            width:width height:height fromArray:self bits.
+            width:width height:height fromArray:self bits;
+            forgetBits.
 
         "/ remember deviceForm
         (device isNil or:[deviceForm isNil]) ifTrue:[
--- a/Depth24Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth24Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -111,7 +111,7 @@
 !
 
 pixelAtX:x y:y
-    "retrieve a pixel at x/y; return a color.
+    "retrieve a pixel at x/y; return a pixel value.
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel.
      The pixel value contains r/g/b in msb order (i.e. r at high, b at low bits)"
@@ -153,12 +153,35 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set a pixel at x/y to aPixelValue, which is 24 bits RGB.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
     |index "{ Class: SmallInteger }"
-     val   "{ Class: SmallInteger }" |
-
+     val   "{ Class: SmallInteger }"|
+
+%{  /* NOCONTEXT */
+    OBJ b = __INST(bytes);
+    OBJ w = __INST(width);
+
+    if (__isByteArrayLike(b)
+     && __bothSmallInteger(x, y)
+     && __bothSmallInteger(w, aPixelValue)
+     && (__INST(pixelFunction)==nil) ) {
+        int _idx;
+
+        _idx = ((__intVal(w) * __intVal(y)) + __intVal(x))*3;
+        if (((unsigned)(_idx+2)) < __byteArraySize(b)) {
+            unsigned char *pPix = &(__ByteArrayInstPtr(b)->ba_element[_idx]);
+            unsigned int _pix = __intVal(aPixelValue);
+            pPix[0] = (_pix>>16) & 0xFF;
+            pPix[1] = (_pix>>8) & 0xFF;
+            pPix[2] = (_pix) & 0xFF;
+            RETURN( self );
+        }
+    }
+%}.
     index := 1 + (((width * y) + x) * 3).
     val := aPixelValue.
     bytes at:(index + 2) put:(val bitAnd:16rFF).
@@ -166,8 +189,6 @@
     bytes at:(index + 1) put:(val bitAnd:16rFF).
     val := val bitShift:-8.
     bytes at:(index) put:val.
-
-    "Created: 24.4.1997 / 17:06:33 / cg"
 !
 
 rgbValueAtX:x y:y
@@ -304,8 +325,8 @@
 
     numFix := fixColors size.
     numFix == 256 ifTrue:[
-	"/ algorithm below only handles 255 colors.
-	numFix := 255.
+        "/ algorithm below only handles 255 colors.
+        numFix := 255.
     ].
 
     fixColorArray := fixColors asArray.
@@ -320,9 +341,9 @@
 
     deviceDepth := aDevice depth.
     deviceDepth == 8 ifFalse:[
-	(aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
-	    ^ nil
-	]
+        (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+            ^ nil
+        ]
     ].
 
     idsUsed := ByteArray new:(fixIds size).
@@ -351,131 +372,131 @@
      && __isByteArrayLike(fixRed)
      && __isByteArrayLike(fixGreen)
      && __isByteArrayLike(fixBlue) ) {
-	failed = false;
-
-	srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-	dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
-	idP = __ByteArrayInstPtr(fixIds)->ba_element;
-	usedIdP = __ByteArrayInstPtr(idsUsed)->ba_element;
-	redP = __ByteArrayInstPtr(fixRed)->ba_element;
-	greenP = __ByteArrayInstPtr(fixGreen)->ba_element;
-	blueP = __ByteArrayInstPtr(fixBlue)->ba_element;
-	cacheP = __ByteArrayInstPtr(cache)->ba_element;
-	__numFix = __intVal(numFix);
-
-	for (__y=__intVal(h); __y>0; __y--) {
-	    __eR = __eG = __eB = 0;
-	    for (__x=__w; __x>0; __x--) {
-		int cacheIdx, clrIdx;
-		int __wantR, __wantG, __wantB;
-
-		__wantR = srcP[0] + __eR;
-		if (__wantR > 255) __wantR = 255;
-		else if (__wantR < 0) __wantR = 0;
-
-		__wantG = srcP[1] + __eG;
-		if (__wantG > 255) __wantG = 255;
-		else if (__wantG < 0) __wantG = 0;
-
-		__wantB = srcP[2] + __eB;
-		if (__wantB > 255) __wantB = 255;
-		else if (__wantB < 0) __wantB = 0;
-
-		/*
-		 * compute cache index
-		 */
-		cacheIdx = ((__wantR & 0xF8) >> 3);
-		cacheIdx = (cacheIdx << 5) | ((__wantG & 0xF8) >> 3);
-		cacheIdx = (cacheIdx << 4) | ((__wantB & 0xF0) >> 4);
-
-		clrIdx = cacheP[cacheIdx];
-		if (clrIdx == 0xFF) {   /* invalid slot */
-		    unsigned minErr, minIdx;
-		    int i;
-
-		    /*
-		     * must search ...
-		     */
-		    minErr = 0x7FFFFFF; minIdx = 0;
-		    for (i=0; i<__numFix; i++) {
-			unsigned cR, cG, cB, e;
-			int eR, eG, eB;
-
-			cR = redP[i]; cG = greenP[i]; cB = blueP[i];
-			eR = cR - __wantR;
-			if (eR < 0) eR = -eR;
-
-			eG = cG - __wantG;
-			if (eG < 0) eG = -eG;
-
-			eB = cB - __wantB;
-			if (eB < 0) eB = -eB;
-
-			e = eR + eG + eB;
-			if (e < minErr) {
-			    minErr = e;
-			    minIdx = i;
-			    if (e < 7) {
-				break;
-			    }
-			}
-		    }
-
-		    /*
-		     * minIdx is now index into fixColors
-		     */
-		    cacheP[cacheIdx] = clrIdx = minIdx;
+        failed = false;
+
+        srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+        dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
+        idP = __ByteArrayInstPtr(fixIds)->ba_element;
+        usedIdP = __ByteArrayInstPtr(idsUsed)->ba_element;
+        redP = __ByteArrayInstPtr(fixRed)->ba_element;
+        greenP = __ByteArrayInstPtr(fixGreen)->ba_element;
+        blueP = __ByteArrayInstPtr(fixBlue)->ba_element;
+        cacheP = __ByteArrayInstPtr(cache)->ba_element;
+        __numFix = __intVal(numFix);
+
+        for (__y=__intVal(h); __y>0; __y--) {
+            __eR = __eG = __eB = 0;
+            for (__x=__w; __x>0; __x--) {
+                int cacheIdx, clrIdx;
+                int __wantR, __wantG, __wantB;
+
+                __wantR = srcP[0] + __eR;
+                if (__wantR > 255) __wantR = 255;
+                else if (__wantR < 0) __wantR = 0;
+
+                __wantG = srcP[1] + __eG;
+                if (__wantG > 255) __wantG = 255;
+                else if (__wantG < 0) __wantG = 0;
+
+                __wantB = srcP[2] + __eB;
+                if (__wantB > 255) __wantB = 255;
+                else if (__wantB < 0) __wantB = 0;
+
+                /*
+                 * compute cache index
+                 */
+                cacheIdx = ((__wantR & 0xF8) >> 3);
+                cacheIdx = (cacheIdx << 5) | ((__wantG & 0xF8) >> 3);
+                cacheIdx = (cacheIdx << 4) | ((__wantB & 0xF0) >> 4);
+
+                clrIdx = cacheP[cacheIdx];
+                if (clrIdx == 0xFF) {   /* invalid slot */
+                    unsigned minErr, minIdx;
+                    int i;
+
+                    /*
+                     * must search ...
+                     */
+                    minErr = 0x7FFFFFF; minIdx = 0;
+                    for (i=0; i<__numFix; i++) {
+                        unsigned cR, cG, cB, e;
+                        int eR, eG, eB;
+
+                        cR = redP[i]; cG = greenP[i]; cB = blueP[i];
+                        eR = cR - __wantR;
+                        if (eR < 0) eR = -eR;
+
+                        eG = cG - __wantG;
+                        if (eG < 0) eG = -eG;
+
+                        eB = cB - __wantB;
+                        if (eB < 0) eB = -eB;
+
+                        e = eR + eG + eB;
+                        if (e < minErr) {
+                            minErr = e;
+                            minIdx = i;
+                            if (e < 7) {
+                                break;
+                            }
+                        }
+                    }
+
+                    /*
+                     * minIdx is now index into fixColors
+                     */
+                    cacheP[cacheIdx] = clrIdx = minIdx;
 /*
 console_fprintf(stderr, "want %d/%d/%d best: %d [%d/%d/%d]\n", __wantR, __wantG, __wantB, clrIdx, redP[clrIdx], greenP[clrIdx], blueP[clrIdx]);
 */
-		}
-
-		/*
-		 * store the corresponding dither colorId
-		 */
-		*dstP++ = idP[clrIdx];
-		usedIdP[clrIdx] = 1;
-
-		srcP += 3;
-
-		/*
-		 * the new error:
-		 */
-		__eR = __wantR - redP[clrIdx];
-		__eG = __wantG - greenP[clrIdx];
-		__eB = __wantB - blueP[clrIdx];
-	    }
-	}
+                }
+
+                /*
+                 * store the corresponding dither colorId
+                 */
+                *dstP++ = idP[clrIdx];
+                usedIdP[clrIdx] = 1;
+
+                srcP += 3;
+
+                /*
+                 * the new error:
+                 */
+                __eR = __wantR - redP[clrIdx];
+                __eG = __wantG - greenP[clrIdx];
+                __eB = __wantB - blueP[clrIdx];
+            }
+        }
     }
 %}.
     failed ifTrue:[
-	self primitiveFailed.
-	^ nil
+        self primitiveFailed.
+        ^ nil
     ].
 
     "/ not all colors may be really in use ...
     usedColors := fixColors copy.
     idsUsed keysAndValuesDo:[:idx :flag |
-	flag == 0 ifTrue:[
-	    usedColors at:idx put:nil
-	]
+        flag == 0 ifTrue:[
+            usedColors at:idx put:nil
+        ]
     ].
 
-    f := Form width:width height:height depth:aDevice depth onDevice:aDevice.
+    f := Form imageForm width:width height:height depth:aDevice depth onDevice:aDevice.
     f isNil ifTrue:[^ nil].
     f colorMap:usedColors.
     f initGC.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:8
-	depth:aDevice depth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id)
-	x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:8
+        depth:aDevice depth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id)
+        x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 !
 
@@ -506,17 +527,17 @@
     fixB == 0 ifTrue:[ ^ nil].
     "/ simple check
     (fixR * fixG * fixB) ~~ fixColors size ifTrue:[
-	self error:'invalid color array passed'.
-	^ nil
+        self error:'invalid color array passed'.
+        ^ nil
     ].
     fixIds := (fixColors asArray collect:[:clr | clr colorId]) asByteArray.
     idsUsed := ByteArray new:(fixIds size).
 
     deviceDepth := aDevice depth.
     deviceDepth == 8 ifFalse:[
-	(aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
-	    ^ nil
-	]
+        (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+            ^ nil
+        ]
     ].
 
     'Depth24Image [info]: dithering ...' infoPrintCR.
@@ -547,136 +568,136 @@
      && __isByteArrayLike(idsUsed)
      && __bothSmallInteger(fixR, fixG)
      && __isSmallInteger(fixB)) {
-	failed = false;
-
-	srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-	dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
-	idP = __ByteArrayInstPtr(fixIds)->ba_element;
-	usedIdP = __ByteArrayInstPtr(idsUsed)->ba_element;
-	__fR = __intVal(fixR)-1;
-	__fG = __intVal(fixG)-1;
-	__fB = __intVal(fixB)-1;
-
-	__eR = __eG = __eB = 0;
-
-	leftToRight = 1;
-	for (__y=__intVal(h); __y>0; __y--) {
-	    if (leftToRight) {
-		for (__x=__w; __x>0; __x--) {
-		    int __want;
-
-		    /*
-		     * wR, wG and wB is the wanted r/g/b value;
-		     * compute the index into the dId table ..
-		     * values: 0..255; scale to 0..fR-1, 0..fG-1, 0..fB-1
-		     *
-		     * bad kludge: knows how to index into FixColor table
-		     */
-		    __wantR = __want = srcP[0] + __eR;
-
-		    if (__want > 255) __want = 255;
-		    else if (__want < 0) __want = 0;
-
-		    iR = __want * __fR / 128;
-		    iR = (iR / 2) + (iR & 1);
-
-		    __wantG = __want = srcP[1] + __eG;
-		    if (__want > 255) __want = 255;
-		    else if (__want < 0) __want = 0;
-
-		    iG = __want * __fG / 128;
-		    iG = (iG / 2) + (iG & 1);
-
-		    __wantB = __want = srcP[2] + __eB;
-		    if (__want > 255) __want = 255;
-		    else if (__want < 0) __want = 0;
-
-		    iB = __want * __fB / 128;
-		    iB = (iB / 2) + (iB & 1);
-
-		    idx = iR * (__fG+1);
-		    idx = (idx + iG) * (__fB+1);
-		    idx = idx + iB;
-
-		    /*
-		     * store the corresponding dither colorId
-		     */
-		    *dstP++ = idP[idx];
-		    usedIdP[idx] = 1;
-
-		    srcP += 3;
-
-		    /*
-		     * the new error:
-		     */
-		    __eR = __wantR - (iR * 256 / __fR);
-		    __eG = __wantG - (iG * 256 / __fG);
-		    __eB = __wantB - (iB * 256 / __fB);
-		}
-		leftToRight = 0;
-	    } else {
-		srcP += (__w*3);
-		dstP += __w;
-		for (__x=__w; __x>0; __x--) {
-		    int __want;
-
-		    /*
-		     * wR, wG and wB is the wanted r/g/b value;
-		     * compute the index into the dId table ..
-		     * values: 0..255; scale to 0..fR-1, 0..fG-1, 0..fB-1
-		     *
-		     * bad kludge: knows how to index into FixColor table
-		     */
-		    srcP -= 3;
-		    __wantR = __want = srcP[0] + __eR;
-
-		    if (__want > 255) __want = 255;
-		    else if (__want < 0) __want = 0;
-
-		    iR = __want * __fR / 128;
-		    iR = (iR / 2) + (iR & 1);
-
-		    __wantG = __want = srcP[1] + __eG;
-		    if (__want > 255) __want = 255;
-		    else if (__want < 0) __want = 0;
-
-		    iG = __want * __fG / 128;
-		    iG = (iG / 2) + (iG & 1);
-
-		    __wantB = __want = srcP[2] + __eB;
-		    if (__want > 255) __want = 255;
-		    else if (__want < 0) __want = 0;
-
-		    iB = __want * __fB / 128;
-		    iB = (iB / 2) + (iB & 1);
-
-		    idx = iR * (__fG+1);
-		    idx = (idx + iG) * (__fB+1);
-		    idx = idx + iB;
-
-		    /*
-		     * store the corresponding dither colorId
-		     */
-		    *--dstP = idP[idx];
-		    usedIdP[idx] = 1;
-
-		    /*
-		     * the new error:
-		     */
-		    __eR = __wantR - (iR * 256 / __fR);
-		    __eG = __wantG - (iG * 256 / __fG);
-		    __eB = __wantB - (iB * 256 / __fB);
-		}
-		srcP += (__w*3);
-		dstP += __w;
-		leftToRight = 1;
-	    }
-	}
+        failed = false;
+
+        srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+        dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
+        idP = __ByteArrayInstPtr(fixIds)->ba_element;
+        usedIdP = __ByteArrayInstPtr(idsUsed)->ba_element;
+        __fR = __intVal(fixR)-1;
+        __fG = __intVal(fixG)-1;
+        __fB = __intVal(fixB)-1;
+
+        __eR = __eG = __eB = 0;
+
+        leftToRight = 1;
+        for (__y=__intVal(h); __y>0; __y--) {
+            if (leftToRight) {
+                for (__x=__w; __x>0; __x--) {
+                    int __want;
+
+                    /*
+                     * wR, wG and wB is the wanted r/g/b value;
+                     * compute the index into the dId table ..
+                     * values: 0..255; scale to 0..fR-1, 0..fG-1, 0..fB-1
+                     *
+                     * bad kludge: knows how to index into FixColor table
+                     */
+                    __wantR = __want = srcP[0] + __eR;
+
+                    if (__want > 255) __want = 255;
+                    else if (__want < 0) __want = 0;
+
+                    iR = __want * __fR / 128;
+                    iR = (iR / 2) + (iR & 1);
+
+                    __wantG = __want = srcP[1] + __eG;
+                    if (__want > 255) __want = 255;
+                    else if (__want < 0) __want = 0;
+
+                    iG = __want * __fG / 128;
+                    iG = (iG / 2) + (iG & 1);
+
+                    __wantB = __want = srcP[2] + __eB;
+                    if (__want > 255) __want = 255;
+                    else if (__want < 0) __want = 0;
+
+                    iB = __want * __fB / 128;
+                    iB = (iB / 2) + (iB & 1);
+
+                    idx = iR * (__fG+1);
+                    idx = (idx + iG) * (__fB+1);
+                    idx = idx + iB;
+
+                    /*
+                     * store the corresponding dither colorId
+                     */
+                    *dstP++ = idP[idx];
+                    usedIdP[idx] = 1;
+
+                    srcP += 3;
+
+                    /*
+                     * the new error:
+                     */
+                    __eR = __wantR - (iR * 256 / __fR);
+                    __eG = __wantG - (iG * 256 / __fG);
+                    __eB = __wantB - (iB * 256 / __fB);
+                }
+                leftToRight = 0;
+            } else {
+                srcP += (__w*3);
+                dstP += __w;
+                for (__x=__w; __x>0; __x--) {
+                    int __want;
+
+                    /*
+                     * wR, wG and wB is the wanted r/g/b value;
+                     * compute the index into the dId table ..
+                     * values: 0..255; scale to 0..fR-1, 0..fG-1, 0..fB-1
+                     *
+                     * bad kludge: knows how to index into FixColor table
+                     */
+                    srcP -= 3;
+                    __wantR = __want = srcP[0] + __eR;
+
+                    if (__want > 255) __want = 255;
+                    else if (__want < 0) __want = 0;
+
+                    iR = __want * __fR / 128;
+                    iR = (iR / 2) + (iR & 1);
+
+                    __wantG = __want = srcP[1] + __eG;
+                    if (__want > 255) __want = 255;
+                    else if (__want < 0) __want = 0;
+
+                    iG = __want * __fG / 128;
+                    iG = (iG / 2) + (iG & 1);
+
+                    __wantB = __want = srcP[2] + __eB;
+                    if (__want > 255) __want = 255;
+                    else if (__want < 0) __want = 0;
+
+                    iB = __want * __fB / 128;
+                    iB = (iB / 2) + (iB & 1);
+
+                    idx = iR * (__fG+1);
+                    idx = (idx + iG) * (__fB+1);
+                    idx = idx + iB;
+
+                    /*
+                     * store the corresponding dither colorId
+                     */
+                    *--dstP = idP[idx];
+                    usedIdP[idx] = 1;
+
+                    /*
+                     * the new error:
+                     */
+                    __eR = __wantR - (iR * 256 / __fR);
+                    __eG = __wantG - (iG * 256 / __fG);
+                    __eB = __wantB - (iB * 256 / __fB);
+                }
+                srcP += (__w*3);
+                dstP += __w;
+                leftToRight = 1;
+            }
+        }
     }
 %}.
     failed ifTrue:[
-	self primitiveFailed.
-	^ nil
+        self primitiveFailed.
+        ^ nil
 
 "/ for non-C programmers:
 "/     the above code is (roughly) equivalent to:
@@ -731,26 +752,26 @@
     "/ not all colors may be really in use ...
     usedColors := fixColors copy.
     idsUsed keysAndValuesDo:[:idx :flag |
-	flag == 0 ifTrue:[
-	    usedColors at:idx put:nil
-	]
+        flag == 0 ifTrue:[
+            usedColors at:idx put:nil
+        ]
     ].
 
-    f := Form width:width height:height depth:aDevice depth onDevice:aDevice.
+    f := Form imageForm width:width height:height depth:aDevice depth onDevice:aDevice.
     f isNil ifTrue:[^ nil].
     f colorMap:usedColors.
     f initGC.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:8
-	depth:aDevice depth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id)
-	x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:8
+        depth:aDevice depth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id)
+        x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 !
 
@@ -779,10 +800,10 @@
      depth nColorCells deep nColorsNeeded bytes|
 
     aDevice fixColors notNil ifTrue:[
-	"/ no need to look for used colors - dithering anyway ...
-
-	f := self rgbImageAsDitheredPseudoFormOn:aDevice.
-	f notNil ifTrue:[^ f].
+        "/ no need to look for used colors - dithering anyway ...
+
+        f := self rgbImageAsDitheredPseudoFormOn:aDevice.
+        f notNil ifTrue:[^ f].
     ].
 
     bytes := self bits.
@@ -803,210 +824,210 @@
     'Depth24Image [info]: allocating colors ...' infoPrintCR.
 
     [fit] whileFalse:[
-	[fitMap] whileFalse:[
-	    srcIndex := 1.
-	    redArray := Array new:256.
-
-	    "
-	     find used colors, build [r][g][b] 3-dimensional array
-	     containing true for used colors
-	    "
-	    nColors := 0.
-	    srcIndex := 1.
-	    dataSize := bytes size.
-	    [(srcIndex < dataSize)
-	     and:[nColors <= nColorCells]] whileTrue:[
+        [fitMap] whileFalse:[
+            srcIndex := 1.
+            redArray := Array new:256.
+
+            "
+             find used colors, build [r][g][b] 3-dimensional array
+             containing true for used colors
+            "
+            nColors := 0.
+            srcIndex := 1.
+            dataSize := bytes size.
+            [(srcIndex < dataSize)
+             and:[nColors <= nColorCells]] whileTrue:[
 %{
-		if (__isByteArrayLike(bytes)) {
-		    int sI = __intVal(srcIndex);
-		    unsigned char *cp = __ByteArrayInstPtr(bytes)->ba_element;
-
-		    r = __MKSMALLINT((cp[sI - 1] & __intVal(rMask)) + 1);
-		    g = __MKSMALLINT((cp[sI]     & __intVal(gMask)) + 1);
-		    b = __MKSMALLINT((cp[sI + 1] & __intVal(bMask)) + 1);
-		    srcIndex = __MKSMALLINT(sI + 3);
-		    fast = true;
-		} else {
-		    fast = false;
-		}
+                if (__isByteArrayLike(bytes)) {
+                    int sI = __intVal(srcIndex);
+                    unsigned char *cp = __ByteArrayInstPtr(bytes)->ba_element;
+
+                    r = __MKSMALLINT((cp[sI - 1] & __intVal(rMask)) + 1);
+                    g = __MKSMALLINT((cp[sI]     & __intVal(gMask)) + 1);
+                    b = __MKSMALLINT((cp[sI + 1] & __intVal(bMask)) + 1);
+                    srcIndex = __MKSMALLINT(sI + 3);
+                    fast = true;
+                } else {
+                    fast = false;
+                }
 %}
 .
-		fast ifFalse:[
-		    r := bytes at:srcIndex.
-		    r := (r bitAnd:rMask) + 1.
-		    srcIndex := srcIndex + 1.
-		    g := bytes at:srcIndex.
-		    g := (g bitAnd:gMask) + 1.
-		    srcIndex := srcIndex + 1.
-		    b := bytes at:srcIndex.
-		    b := (b bitAnd:bMask) + 1.
-		    srcIndex := srcIndex + 1
-		].
-
-		greenArray := redArray at:r.
-		greenArray isNil ifTrue:[
-		    greenArray := Array new:256.
-		    redArray at:r put:greenArray
-		].
-		blueArray := greenArray at:g.
-		blueArray isNil ifTrue:[
-		    deep ifTrue:[blueArray := Array new:256]
-		    ifFalse:[blueArray := ByteArray new:256].
-		    greenArray at:g put:blueArray
-		].
-		(blueArray at:b) == 0 ifTrue:[
-		    blueArray at:b put:1.
-		    nColors := nColors + 1.
-		    (nColors > nColorCells) ifTrue:[
+                fast ifFalse:[
+                    r := bytes at:srcIndex.
+                    r := (r bitAnd:rMask) + 1.
+                    srcIndex := srcIndex + 1.
+                    g := bytes at:srcIndex.
+                    g := (g bitAnd:gMask) + 1.
+                    srcIndex := srcIndex + 1.
+                    b := bytes at:srcIndex.
+                    b := (b bitAnd:bMask) + 1.
+                    srcIndex := srcIndex + 1
+                ].
+
+                greenArray := redArray at:r.
+                greenArray isNil ifTrue:[
+                    greenArray := Array new:256.
+                    redArray at:r put:greenArray
+                ].
+                blueArray := greenArray at:g.
+                blueArray isNil ifTrue:[
+                    deep ifTrue:[blueArray := Array new:256]
+                    ifFalse:[blueArray := ByteArray new:256].
+                    greenArray at:g put:blueArray
+                ].
+                (blueArray at:b) == 0 ifTrue:[
+                    blueArray at:b put:1.
+                    nColors := nColors + 1.
+                    (nColors > nColorCells) ifTrue:[
 "/                        'Depth24Image [info]: more than ' infoPrint. nColorCells infoPrint. ' colors' infoPrintCR.
-			srcIndex := dataSize + 1
-		    ]
-		]
-	    ].
-	    nColorsNeeded isNil ifTrue:[
-		nColorsNeeded := nColors
-	    ].
-
-	    "again with less color bits if it does not fit colormap"
-
-	    (nColors <= nColorCells) ifTrue:[
-		fitMap := true
-	    ] ifFalse:[
-		"/ must try again - cutting off some bits
-		"/ blue bits are snipped off faster.
-		(bMask == 2r11111111) ifTrue:[
-		    bMask := 2r11111100
-		] ifFalse:[
-		    (bMask == 2r11111100) ifTrue:[
-			bMask := 2r11110000
-		    ] ifFalse:[
-			(rMask == 2r11111111) ifTrue:[
-			    rMask := 2r11111100.
-			    gMask := 2r11111100.
-			] ifFalse:[
-			    rMask := (rMask bitShift:1) bitAnd:2r11111111.
-			    gMask := (gMask bitShift:1) bitAnd:2r11111111.
-			    bMask := (bMask bitShift:1) bitAnd:2r11111111
-			]
-		    ]
-		].
+                        srcIndex := dataSize + 1
+                    ]
+                ]
+            ].
+            nColorsNeeded isNil ifTrue:[
+                nColorsNeeded := nColors
+            ].
+
+            "again with less color bits if it does not fit colormap"
+
+            (nColors <= nColorCells) ifTrue:[
+                fitMap := true
+            ] ifFalse:[
+                "/ must try again - cutting off some bits
+                "/ blue bits are snipped off faster.
+                (bMask == 2r11111111) ifTrue:[
+                    bMask := 2r11111100
+                ] ifFalse:[
+                    (bMask == 2r11111100) ifTrue:[
+                        bMask := 2r11110000
+                    ] ifFalse:[
+                        (rMask == 2r11111111) ifTrue:[
+                            rMask := 2r11111100.
+                            gMask := 2r11111100.
+                        ] ifFalse:[
+                            rMask := (rMask bitShift:1) bitAnd:2r11111111.
+                            gMask := (gMask bitShift:1) bitAnd:2r11111111.
+                            bMask := (bMask bitShift:1) bitAnd:2r11111111
+                        ]
+                    ]
+                ].
 "/                'Depth24Image [info]: too many colors; retry with less color resolution' infoPrintCR.
 "
     'masks:' print. rMask print. ' ' print. gMask print. ' ' print.
     bMask printNewline
 "
-	    ]
-	].
+            ]
+        ].
 
 "/        'Depth24Image [info]: ' infoPrint. nColors infoPrint. ' colors used' infoPrintCR.
 
-	colors := Array new:nColors.
-	colorIndex := 1.
-
-	"
-	 now, we have reduced things to the number of colors
-	 which are theoretically supported by the devices colormap.
-	 allocate all used colors in walking over true entries in
-	 the [r][g][b] table - this may still fail,
-	 if we run out of device colors.
-	"
-	fit := true.
-
-	r := 0.
-	redArray do:[:greenArray |
-	    (fit and:[greenArray notNil]) ifTrue:[
-		g := 0.
-		greenArray do:[:blueArray |
-		    (fit and:[blueArray notNil]) ifTrue:[
-			b := 0.
-			blueArray do:[:present |
-			    |id|
-
-			    (fit and:[present ~~ 0]) ifTrue:[
-				color := Color redByte:r
-					     greenByte:g
-					      blueByte:b.
-				color := color onDevice:aDevice.
-				(id := color colorId) isNil ifTrue:[
-				    fit := false
-				] ifFalse:[
-				    colors at:colorIndex put:color.
-				    colorIndex := colorIndex + 1.
-				    blueArray at:(b + 1) put:id
-				]
-			    ].
-			    b := b + 1
-			]
-		    ].
-		    g := g + 1
-		]
-	    ].
-	    r := r + 1
-	].
-
-	"again with less color bits if we did not get all colors"
-
-	fit ifFalse:[
+        colors := Array new:nColors.
+        colorIndex := 1.
+
+        "
+         now, we have reduced things to the number of colors
+         which are theoretically supported by the devices colormap.
+         allocate all used colors in walking over true entries in
+         the [r][g][b] table - this may still fail,
+         if we run out of device colors.
+        "
+        fit := true.
+
+        r := 0.
+        redArray do:[:greenArray |
+            (fit and:[greenArray notNil]) ifTrue:[
+                g := 0.
+                greenArray do:[:blueArray |
+                    (fit and:[blueArray notNil]) ifTrue:[
+                        b := 0.
+                        blueArray do:[:present |
+                            |id|
+
+                            (fit and:[present ~~ 0]) ifTrue:[
+                                color := Color redByte:r
+                                             greenByte:g
+                                              blueByte:b.
+                                color := color onDevice:aDevice.
+                                (id := color colorId) isNil ifTrue:[
+                                    fit := false
+                                ] ifFalse:[
+                                    colors at:colorIndex put:color.
+                                    colorIndex := colorIndex + 1.
+                                    blueArray at:(b + 1) put:id
+                                ]
+                            ].
+                            b := b + 1
+                        ]
+                    ].
+                    g := g + 1
+                ]
+            ].
+            r := r + 1
+        ].
+
+        "again with less color bits if we did not get all colors"
+
+        fit ifFalse:[
 "/            'Depth24Image [info]: could not allocate color(s)' infoPrintCR.
 
-	    "free the allocated colors"
-	    colors atAllPut:nil.
-	    "a kludge - force immediate freeing of colors"
-	    ObjectMemory scavenge; finalize.
-
-	    "cut off one more color-bit - cut off blue first"
-	    (bMask == 2r11111111) ifTrue:[
-		bMask := 2r11111100
-	    ] ifFalse:[
-		(bMask == 2r11111100) ifTrue:[
-		    bMask := 2r11110000
-		] ifFalse:[
-		    (rMask == 2r11111111) ifTrue:[
-			rMask := 2r11111100.
-			gMask := 2r11111100.
-		    ] ifFalse:[
-			rMask := (rMask bitShift:1) bitAnd:2r11111111.
-			gMask := (gMask bitShift:1) bitAnd:2r11111111.
-			bMask := (bMask bitShift:1) bitAnd:2r11111111
-		    ]
-		]
-	    ].
-	    fitMap := false.
-	    redArray := nil
-	]
+            "free the allocated colors"
+            colors atAllPut:nil.
+            "a kludge - force immediate freeing of colors"
+            ObjectMemory scavenge; finalize.
+
+            "cut off one more color-bit - cut off blue first"
+            (bMask == 2r11111111) ifTrue:[
+                bMask := 2r11111100
+            ] ifFalse:[
+                (bMask == 2r11111100) ifTrue:[
+                    bMask := 2r11110000
+                ] ifFalse:[
+                    (rMask == 2r11111111) ifTrue:[
+                        rMask := 2r11111100.
+                        gMask := 2r11111100.
+                    ] ifFalse:[
+                        rMask := (rMask bitShift:1) bitAnd:2r11111111.
+                        gMask := (gMask bitShift:1) bitAnd:2r11111111.
+                        bMask := (bMask bitShift:1) bitAnd:2r11111111
+                    ]
+                ]
+            ].
+            fitMap := false.
+            redArray := nil
+        ]
     ].
 
     (nColors ~~ nColorsNeeded) ifTrue:[
-	"/ mhmh - did not get all colors ...
-	"/ add existing colors and dither.
-
-	'Depth24Image [info]: only got ' infoPrint. nColors infoPrint. ' out of ' infoPrint.
-	nColorsNeeded infoPrint. ' image colors.' infoPrintCR.
-
-	"/
-	"/ dither using those we got ...
-	"/
-	DitherAlgorithm == #floydSteinberg ifTrue:[
-	    colors := colors asNewSet.
+        "/ mhmh - did not get all colors ...
+        "/ add existing colors and dither.
+
+        'Depth24Image [info]: only got ' infoPrint. nColors infoPrint. ' out of ' infoPrint.
+        nColorsNeeded infoPrint. ' image colors.' infoPrintCR.
+
+        "/
+        "/ dither using those we got ...
+        "/
+        DitherAlgorithm == #floydSteinberg ifTrue:[
+            colors := colors asNewSet.
 "/            ditherColors := aDevice availableDitherColors.
 "/            ditherColors notNil ifTrue:[
 "/                colors addAll:ditherColors.
 "/            ].
 "/            colors addAll:aDevice deviceColors.
-	    colors addAll:(aDevice colorMap collect:[:c|c onDevice:aDevice]).
-	    colors := (colors select:[:c | c colorId notNil]) asOrderedCollection.
-	    colors size > 256 ifTrue:[
-		colors := colors copyTo:256
-	    ].
-	    f := self rgbImageAsDitheredPseudoFormOn:aDevice colors:colors.
-	    f notNil ifTrue:[^ f].
-	].
+            colors addAll:(aDevice colorMap collect:[:c|c onDevice:aDevice]).
+            colors := (colors select:[:c | c colorId notNil]) asOrderedCollection.
+            colors size > 256 ifTrue:[
+                colors := colors copyTo:256
+            ].
+            f := self rgbImageAsDitheredPseudoFormOn:aDevice colors:colors.
+            f notNil ifTrue:[^ f].
+        ].
     ].
 
     "/ the device ought to support 8-bit images ...
     (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
-	"/ cannot draw directly
-	^ nil
+        "/ cannot draw directly
+        ^ nil
     ].
 
     "create pseudocolor bits and translate"
@@ -1019,51 +1040,51 @@
     (rMask == 2r11111111
      and:[gMask == 2r11111111
      and:[bMask == 2r11111111]]) ifTrue:[
-	[srcIndex < dataSize] whileTrue:[
-	    r := bytes at:srcIndex.
-	    srcIndex := srcIndex + 1.
-	    g := bytes at:srcIndex.
-	    srcIndex := srcIndex + 1.
-	    b := bytes at:srcIndex.
-	    srcIndex := srcIndex + 1.
-	    greenArray := redArray at:(r + 1).
-	    blueArray := greenArray at:(g + 1).
-	    pseudoBits at:dstIndex put:(blueArray at:(b + 1)).
-	    dstIndex := dstIndex + 1
-	]
+        [srcIndex < dataSize] whileTrue:[
+            r := bytes at:srcIndex.
+            srcIndex := srcIndex + 1.
+            g := bytes at:srcIndex.
+            srcIndex := srcIndex + 1.
+            b := bytes at:srcIndex.
+            srcIndex := srcIndex + 1.
+            greenArray := redArray at:(r + 1).
+            blueArray := greenArray at:(g + 1).
+            pseudoBits at:dstIndex put:(blueArray at:(b + 1)).
+            dstIndex := dstIndex + 1
+        ]
     ] ifFalse:[
-	[srcIndex < dataSize] whileTrue:[
-	    r := bytes at:srcIndex.
-	    r := r bitAnd:rMask.
-	    srcIndex := srcIndex + 1.
-	    g := bytes at:srcIndex.
-	    g := g bitAnd:gMask.
-	    srcIndex := srcIndex + 1.
-	    b := bytes at:srcIndex.
-	    b := b bitAnd:bMask.
-	    srcIndex := srcIndex + 1.
-	    greenArray := redArray at:(r + 1).
-	    blueArray := greenArray at:(g + 1).
-	    pseudoBits at:dstIndex put:(blueArray at:(b + 1)).
-	    dstIndex := dstIndex + 1
-	]
+        [srcIndex < dataSize] whileTrue:[
+            r := bytes at:srcIndex.
+            r := r bitAnd:rMask.
+            srcIndex := srcIndex + 1.
+            g := bytes at:srcIndex.
+            g := g bitAnd:gMask.
+            srcIndex := srcIndex + 1.
+            b := bytes at:srcIndex.
+            b := b bitAnd:bMask.
+            srcIndex := srcIndex + 1.
+            greenArray := redArray at:(r + 1).
+            blueArray := greenArray at:(g + 1).
+            pseudoBits at:dstIndex put:(blueArray at:(b + 1)).
+            dstIndex := dstIndex + 1
+        ]
     ].
 
-    f := Form width:width height:height depth:depth onDevice:aDevice.
+    f := Form imageForm width:width height:height depth:depth onDevice:aDevice.
     f isNil ifTrue:[^ nil].
     f colorMap:colors.
     f initGC.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:8
-	depth:depth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id)
-	x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:8
+        depth:depth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id)
+        x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 !
 
@@ -1078,34 +1099,34 @@
     usedDevicePadding := bestFormat at:#padding.
 
     imageBits := self
-		    rgbImageBitsOn:aDevice
-		    bestFormat: bestFormat
-		    returnUsedDevicePattingIn:[:arg | usedDevicePadding := arg].
+                    rgbImageBitsOn:aDevice
+                    bestFormat: bestFormat
+                    returnUsedDevicePattingIn:[:arg | usedDevicePadding := arg].
 
     imageBits isNil ifTrue:[
-	^ self asMonochromeFormOn:aDevice
+        ^ self asMonochromeFormOn:aDevice
     ].
 
-    form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
+    form := Form imageForm width:width height:height depth:usedDeviceDepth onDevice:aDevice.
     form isNil ifTrue:[
-	'Depth24Image [warning]: display bitmap creation failed' errorPrintCR.
-	^ nil
+        'Depth24Image [warning]: display bitmap creation failed' errorPrintCR.
+        ^ nil
     ].
     form id isNil ifTrue:[
-	"/ usually happens if the image is too big (out of memory)
-	'Depth24Image [warning]: display bitmap creation failed' errorPrintCR.
-	^ nil
+        "/ usually happens if the image is too big (out of memory)
+        'Depth24Image [warning]: display bitmap creation failed' errorPrintCR.
+        ^ nil
     ].
 
     form initGC.
 
     form
-	copyBitsFrom:imageBits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:usedDevicePadding
-	width:width height:height
-	x:0 y:0 toX:0 y:0.
+        copyBitsFrom:imageBits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:usedDevicePadding
+        width:width height:height
+        x:0 y:0 toX:0 y:0.
 
     ^ form
 
@@ -2659,10 +2680,261 @@
     ]
 
     "Created: 7.6.1996 / 19:09:40 / cg"
+!
+
+valuesFromX:xStart y:yStart toX:xEnd y:yEnd do:aBlock
+    "perform aBlock for each pixel in the rectangle
+     yStart..yEnd / xStart..xEnd.
+     The block is passed the pixelValue at each pixel.
+     This method allows slighly faster processing of an
+     image than using individual valueAtX:y: accesses,
+     since some processing can be avoided when going from pixel to pixel..
+     However, for real high performance image  processing, specialized methods
+     should be written which know how to deal with specific photometric interpretations."
+
+    |srcIndex    "{ Class: SmallInteger }"
+     srcNext     "{ Class: SmallInteger }"
+     bytesPerRow "{ Class: SmallInteger }"
+     value    "{ Class: SmallInteger }"
+     x1       "{ Class: SmallInteger }"
+     x2       "{ Class: SmallInteger }"
+     y1       "{ Class: SmallInteger }"
+     y2       "{ Class: SmallInteger }"
+     bytes|
+
+    x1 := xStart.
+    x2 := xEnd.
+    y1 := yStart.
+    y2 := yEnd.
+
+    srcIndex := (width * 3 * y1) + (x1 * 3) + 1 .
+    bytesPerRow := self bytesPerRow.
+    bytes := self bits.
+%{
+    OBJFUNC codeVal;
+
+    if (__bothSmallInteger(x1, x2)
+     && __bothSmallInteger(y1, y2)
+     && __bothSmallInteger(srcIndex, bytesPerRow)
+     && __isByteArrayLike(bytes)
+     && __isBlockLike(aBlock)
+     && (__BlockInstPtr(aBlock)->b_nargs == __mkSmallInteger(3))
+     && ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+    ) {
+        int c_x1 = __intVal(x1);
+        int c_x2 = __intVal(x2);
+        int c_y1 = __intVal(y1);
+        int c_y2 = __intVal(y2);
+        int c_w = __intVal(__INST(width));
+        int c_h = __intVal(__INST(height));
+        int c_srcIndex = __intVal(srcIndex);
+        int c_bytesPerRow = __intVal(bytesPerRow);
+        int c_y, c_x;
+        OBJ c_rHome;
+
+        c_rHome = __BlockInstPtr(aBlock)->b_home;
+        if ((c_rHome == nil) || (__qSpace(c_rHome) >= STACKSPACE)) {
+            if ((((unsigned)c_y1) < c_h)
+             && (((unsigned)c_y2) < c_h)
+             && (((unsigned)c_x1) < c_w)
+             && (((unsigned)c_x2) < c_w)) {
+                unsigned char *c_bytes = (unsigned char*)__ByteArrayInstPtr(bytes)->ba_element;
+
+                if ((c_srcIndex + (c_bytesPerRow * (c_y2-c_y1))) < __byteArraySize(bytes)) {
+                    c_bytes += c_srcIndex;
+                    for (c_y=c_y1; c_y<=c_y2; c_y++) {
+                        unsigned char *c_next = c_bytes + c_bytesPerRow;
+
+                        for (c_x=c_x1; c_x<=c_x2; c_x++) {
+                            int c_value;
+
+                            c_value = c_bytes[0];
+                            c_value = (c_value<<8) | c_bytes[1];    
+                            c_value = (c_value<<8) | c_bytes[2];
+                            (*(__BlockInstPtr(aBlock)->b_code))(c_rHome, __mkSmallInteger(c_x), __mkSmallInteger(c_y), __mkSmallInteger(c_value));
+                            c_bytes += 3;
+                        }
+                        c_bytes = c_next;
+                    }
+                    RETURN(self);
+                }
+            }
+        }
+    }
+%}.
+
+    y1 to:y2 do:[:y |
+        srcNext := srcIndex + bytesPerRow.
+        x1 to:x2 do:[:x |
+            value := bytes at:srcIndex.
+            value := (value bitShift:8) + (bytes at:srcIndex+1).
+            value := (value bitShift:8) + (bytes at:srcIndex+2).
+            srcIndex := srcIndex + 3.
+
+            aBlock value:x value:y value:value
+        ].
+        srcIndex := srcNext.
+    ].
+
+    "Modified: 11.7.1996 / 20:06:47 / cg"
+    "Created: 11.7.1996 / 20:08:11 / cg"
 ! !
 
 !Depth24Image methodsFor:'image manipulations'!
 
+easyRotateBitsInto:destinationImage angle:degrees
+    "tuned helper for rotation - does the actual pixel shuffling, by degrees clockwise. 
+     Here, only 90, 180 and 270 degrees are implemented. 
+     Hard angles are done in #hardRotate:.
+     The code here a tuned version of the inherited for more performance"
+
+    |srcBytesPerRow dstBytesPerRow
+     srcWidth srcHeight
+     dstWidth dstHeight
+     srcBytes dstBytes|
+
+    srcBytesPerRow := self bytesPerRow.
+    srcBytes := self bits.
+    srcWidth := width.
+    srcHeight := height.
+
+    dstBytesPerRow := destinationImage bytesPerRow.
+    dstBytes := destinationImage bits.
+    dstWidth := destinationImage width.
+    dstHeight := destinationImage height.
+%{
+    if (__bothSmallInteger(srcWidth, srcHeight)
+     && __bothSmallInteger(dstWidth, dstHeight)
+     && __bothSmallInteger(dstBytesPerRow, srcBytesPerRow)
+     && __isByteArrayLike(srcBytes)
+     && __isByteArrayLike(dstBytes)
+    ) {
+        int c_srcW = __intVal(srcWidth);
+        int c_srcH = __intVal(srcHeight);
+        int c_dstW = __intVal(dstWidth);
+        int c_dstH = __intVal(dstHeight);
+        int c_srcBytesPerRow = __intVal(srcBytesPerRow);
+        int c_dstBytesPerRow = __intVal(dstBytesPerRow);
+        int c_srcW4 = c_srcW-4;
+
+        // I tried three versions here;
+        //   a) compute dstX/y inside the loop,
+        //   b) precompute a transformation matrix and compute inside the loop w.o conditional branches
+        //      (i.e. x*Mx + y*My...)
+        //   c) precompute ptr-delta and use those to step to next destination pixel.
+
+        // the funny result:
+        //   all show roughly the same speed on a modern CPU.
+        // So the whole thing is mostly limited by memory-bandwidth,
+        // and there is not much to do, unless we move to a better memory fetch/store
+        // (eg. mmx or similar vector stuff)
+        // However, on slower cpus, algo c shpuld perform better, as it does not need multiplications in the loop.
+        // The version below orecomputes the delta, so it should run fast on older CPUs as well.
+
+        {
+            unsigned char *c_srcBytes = (unsigned char*)__ByteArrayInstPtr(srcBytes)->ba_element;
+            unsigned char *c_dstBytes = (unsigned char*)__ByteArrayInstPtr(dstBytes)->ba_element;
+
+            int c_dstNextRowOffset;
+            int c_dstNextColOffset;
+
+            if (degrees == __mkSmallInteger(90)) {
+                // destinationImage pixelAtX:(h-row) y:col put:pixel
+                c_dstNextRowOffset = -3;                                // going to previous column
+                c_dstNextColOffset = c_dstBytesPerRow;                  // going to next row
+                c_dstBytes += (c_dstW-1)*3;                             // start in the upper-right of dest
+            } else if (degrees == __mkSmallInteger(180)) {
+                // destinationImage pixelAtX:(w-col) y:(h-row) put:pixel
+                c_dstNextRowOffset = -c_dstBytesPerRow;                 // going to previous row
+                c_dstNextColOffset = -3;                                // going to prev col
+                c_dstBytes += (c_dstH-1)*c_dstBytesPerRow+(c_dstW-1)*3; // start in the lower-right of dest
+            } else {
+                // destinationImage pixelAtX:row y:(w-col) put:pixel
+                c_dstNextRowOffset = 3;                                 // going to next col
+                c_dstNextColOffset = -c_dstBytesPerRow;                 // going to prev row
+                c_dstBytes += (c_dstH-1)*c_dstBytesPerRow;              // start in the lower-left of dest
+            }
+
+            if ((c_srcBytesPerRow * c_srcH) <= __byteArraySize(srcBytes)) {
+                int c_y;
+
+                for (c_y=0; c_y<c_srcH; c_y++) {
+                    unsigned char *c_srcNext = c_srcBytes + c_srcBytesPerRow;
+                    unsigned char *c_dstNext = c_dstBytes + c_dstNextRowOffset;
+                    int c_x;
+
+                    c_x = 0;    
+#if 1
+                    if (sizeof(int) == 4) {
+                        for (c_x = 0; c_x < c_srcW4; c_x += 4) {
+                            int c_value1, c_value2, c_value3;
+
+                            c_value1 = ((int *)c_srcBytes)[0];
+                            c_value2 = ((int *)c_srcBytes)[1];
+                            c_value3 = ((int *)c_srcBytes)[2];
+
+                            c_dstBytes[0] = (c_value1) & 0xFF;
+                            c_dstBytes[1] = (c_value1>>8) & 0xFF;
+                            c_dstBytes[2] = (c_value1>>16) &0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_dstBytes[0] = (c_value1>>24) & 0xFF;
+                            c_dstBytes[1] = (c_value2) & 0xFF;
+                            c_dstBytes[2] = (c_value2>>8) &0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_dstBytes[0] = (c_value2>>16) & 0xFF;
+                            c_dstBytes[1] = (c_value2>>24) & 0xFF;
+                            c_dstBytes[2] = (c_value3) &0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_dstBytes[0] = (c_value3>>8) & 0xFF;
+                            c_dstBytes[1] = (c_value3>>16) & 0xFF;
+                            c_dstBytes[2] = (c_value3>>24) &0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_srcBytes += (3*4);
+                        }
+                    }
+#endif
+                    for (; c_x < c_srcW; c_x++) {
+                        int c_rValue, c_gValue, c_bValue;
+
+                        c_rValue = c_srcBytes[0];
+                        c_gValue = c_srcBytes[1];    
+                        c_bValue = c_srcBytes[2];
+
+                        c_dstBytes[0] = c_rValue;
+                        c_dstBytes[1] = c_gValue;
+                        c_dstBytes[2] = c_bValue;
+
+                        c_srcBytes += 3;
+                        c_dstBytes += c_dstNextColOffset;
+                    }
+                    c_srcBytes = c_srcNext;
+                    c_dstBytes = c_dstNext;
+                }
+                RETURN(self);
+            }
+        }
+    }
+%}.
+    self breakPoint:#cg.
+    super easyRotateBitsInto:destinationImage angle:degrees
+
+    "
+     |i|
+
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     i := Depth24Image fromImage:i.
+     i inspect.
+     (i rotated:45) inspect.
+     (i rotated:90) inspect.
+     (i rotated:180) inspect.
+     (i rotated:270) inspect.
+    "
+!
+
 negative
     |bytes index newImage newBytes nBytes r g b|
 
--- a/Depth2Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth2Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 Image subclass:#Depth2Image
 	instanceVariableNames:''
 	classVariableNames:''
@@ -67,6 +69,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixel value.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -88,6 +92,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -128,7 +134,7 @@
     bestFormat := self bestSupportedImageFormatFor:aDevice.
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceDepth == 1 ifTrue:[
-	^ self asMonochromeFormOn:aDevice
+        ^ self asMonochromeFormOn:aDevice
     ].
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
     usedDevicePadding := bestFormat at:#padding.
@@ -140,324 +146,324 @@
     "/ for now, only support some depths
 
     usedDeviceBitsPerPixel == 16 ifTrue:[
-	"/ 16 bits/pixel
+        "/ 16 bits/pixel
 
-	"/ now, walk over the image and replace
-	"/ colorMap indices by color values in the bits array
+        "/ now, walk over the image and replace
+        "/ colorMap indices by color values in the bits array
 
 %{
-	unsigned char *srcPtr = 0;
-	unsigned char *dstPtr = 0;
-	OBJ _bytes = __INST(bytes);
+        unsigned char *srcPtr = 0;
+        unsigned char *dstPtr = 0;
+        OBJ _bytes = __INST(bytes);
 
-	if (__isByteArrayLike(_bytes)) {
-	    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-	} else {
-	    if (__isExternalBytesLike(_bytes)) {
-		srcPtr = __externalBytesAddress(_bytes);
-	    }
-	}
-	if (__isByteArray(imageBits)) {
-	    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	} else {
-	    if (__isExternalBytesLike(imageBits)) {
-		dstPtr = __externalBytesAddress(imageBits);
-	    }
-	}
+        if (__isByteArrayLike(_bytes)) {
+            srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+        } else {
+            if (__isExternalBytesLike(_bytes)) {
+                srcPtr = __externalBytesAddress(_bytes);
+            }
+        }
+        if (__isByteArray(imageBits)) {
+            dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+        } else {
+            if (__isExternalBytesLike(imageBits)) {
+                dstPtr = __externalBytesAddress(imageBits);
+            }
+        }
 
-	if (__bothSmallInteger(__INST(height), __INST(width))
-	 && __isArrayLike(colorValues)
-	 && srcPtr
-	 && dstPtr) {
-	    int r,p;
-	    int x, y, w, h, nPix;
-	    int byte, shift;
+        if (__bothSmallInteger(__INST(height), __INST(width))
+         && __isArrayLike(colorValues)
+         && srcPtr
+         && dstPtr) {
+            int r,p;
+            int x, y, w, h, nPix;
+            int byte, shift;
 
-	    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+            OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-	    w = __intVal(__INST(width));
-	    h = __intVal(__INST(height));
-	    r = 0;
-	    p = __intVal(padd);
+            w = __intVal(__INST(width));
+            h = __intVal(__INST(height));
+            r = 0;
+            p = __intVal(padd);
 
-	    nPix = w * h;
-	    shift = -2;
-	    while (nPix-- > 0) {
-		unsigned idx, v;
-		OBJ clr;
+            nPix = w * h;
+            shift = -2;
+            while (nPix-- > 0) {
+                unsigned idx, v;
+                OBJ clr;
 
-		if (shift < 0) {
-		    byte = *srcPtr++;
-		    shift = 6;
-		}
-		idx = (byte >> shift) & 3;
-		shift -= 2;
+                if (shift < 0) {
+                    byte = *srcPtr++;
+                    shift = 6;
+                }
+                idx = (byte >> shift) & 3;
+                shift -= 2;
 
-		clr = ap[idx];
-		v = __intVal(clr);
+                clr = ap[idx];
+                v = __intVal(clr);
 #ifdef __MSBFIRST
-		((short *)dstPtr)[0] = v;
+                ((short *)dstPtr)[0] = v;
 #else
 # ifdef xxSWAP_BYTES
-		SWAP_BYTES(v);
-		((short *)dstPtr)[0] = v;
+                SWAP_BYTES(v);
+                ((short *)dstPtr)[0] = v;
 # else
-		dstPtr[0] = (v>>8) & 0xFF;
-		dstPtr[1] = (v) & 0xFF;
+                dstPtr[0] = (v>>8) & 0xFF;
+                dstPtr[1] = (v) & 0xFF;
 # endif
 #endif
-		dstPtr += 2;
+                dstPtr += 2;
 
-		if (++r == w) {
-		    dstPtr += p;
-		    r = 0;
-		    shift = -2;
-		}
-	    }
-	}
+                if (++r == w) {
+                    dstPtr += p;
+                    r = 0;
+                    shift = -2;
+                }
+            }
+        }
 %}.
     ] ifFalse:[
-	usedDeviceBitsPerPixel == 32 ifTrue:[
-	    "/ 32 bits/pixel
+        usedDeviceBitsPerPixel == 32 ifTrue:[
+            "/ 32 bits/pixel
 
-	    "/ now, walk over the image and replace
-	    "/ colorMap indices by color values in the bits array
+            "/ now, walk over the image and replace
+            "/ colorMap indices by color values in the bits array
 
 %{
-	    unsigned char *srcPtr = 0;
-	    unsigned char *dstPtr = 0;
-	    OBJ _bytes = __INST(bytes);
+            unsigned char *srcPtr = 0;
+            unsigned char *dstPtr = 0;
+            OBJ _bytes = __INST(bytes);
 
-	    if (__isByteArrayLike(_bytes)) {
-		srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-	    } else {
-		if (__isExternalBytesLike(_bytes)) {
-		    srcPtr = __externalBytesAddress(_bytes);
-		}
-	    }
-	    if (__isByteArray(imageBits)) {
-		dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	    } else {
-		if (__isExternalBytesLike(imageBits)) {
-		    dstPtr = __externalBytesAddress(imageBits);
-		}
-	    }
+            if (__isByteArrayLike(_bytes)) {
+                srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+            } else {
+                if (__isExternalBytesLike(_bytes)) {
+                    srcPtr = __externalBytesAddress(_bytes);
+                }
+            }
+            if (__isByteArray(imageBits)) {
+                dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+            } else {
+                if (__isExternalBytesLike(imageBits)) {
+                    dstPtr = __externalBytesAddress(imageBits);
+                }
+            }
 
-	    if (__bothSmallInteger(__INST(height), __INST(width))
-	     && __isArrayLike(colorValues)
-	     && srcPtr
-	     && dstPtr) {
-		int x, y, w, h, nPix;
-		int r,p;
-		int byte, shift;
+            if (__bothSmallInteger(__INST(height), __INST(width))
+             && __isArrayLike(colorValues)
+             && srcPtr
+             && dstPtr) {
+                int x, y, w, h, nPix;
+                int r,p;
+                int byte, shift;
 
-		OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+                OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-		w = __intVal(__INST(width));
-		h = __intVal(__INST(height));
-		r = 0;
-		p = __intVal(padd);
+                w = __intVal(__INST(width));
+                h = __intVal(__INST(height));
+                r = 0;
+                p = __intVal(padd);
 
-		nPix = w * h;
-		shift = -2;
-		while (nPix > 0) {
-		    unsigned idx, v;
-		    OBJ clr;
+                nPix = w * h;
+                shift = -2;
+                while (nPix > 0) {
+                    unsigned idx, v;
+                    OBJ clr;
 
-		    if (shift < 0) {
-			byte = *srcPtr++;
-			shift = 6;
-		    }
-		    idx = (byte >> shift) & 3;
-		    shift -= 2;
+                    if (shift < 0) {
+                        byte = *srcPtr++;
+                        shift = 6;
+                    }
+                    idx = (byte >> shift) & 3;
+                    shift -= 2;
 
-		    clr = ap[idx];
-		    v = __intVal(clr);
+                    clr = ap[idx];
+                    v = __intVal(clr);
 #ifdef __MSBFIRST
-		    ((long *)dstPtr)[0] = v;
+                    ((long *)dstPtr)[0] = v;
 #else
-		    dstPtr[0] = (v>>24) & 0xFF;
-		    dstPtr[1] = (v>>16) & 0xFF;
-		    dstPtr[2] = (v>>8) & 0xFF;
-		    dstPtr[3] = (v) & 0xFF;
+                    dstPtr[0] = (v>>24) & 0xFF;
+                    dstPtr[1] = (v>>16) & 0xFF;
+                    dstPtr[2] = (v>>8) & 0xFF;
+                    dstPtr[3] = (v) & 0xFF;
 #endif
-		    dstPtr += 4;
-		    nPix--;
+                    dstPtr += 4;
+                    nPix--;
 
-		    if (++r == w) {
-			dstPtr += p;
-			r = 0;
-			shift = -2;
-		    }
-		}
-	    }
+                    if (++r == w) {
+                        dstPtr += p;
+                        r = 0;
+                        shift = -2;
+                    }
+                }
+            }
 %}.
-	] ifFalse:[
-	    usedDeviceBitsPerPixel == 8 ifTrue:[
-		"/ 8 bits/pixel
+        ] ifFalse:[
+            usedDeviceBitsPerPixel == 8 ifTrue:[
+                "/ 8 bits/pixel
 
-		"/ now, walk over the image and replace
-		"/ colorMap indices by color values in the bits array
+                "/ now, walk over the image and replace
+                "/ colorMap indices by color values in the bits array
 
 %{
-		unsigned char *srcPtr = 0;
-		unsigned char *dstPtr = 0;
-		OBJ _bytes = __INST(bytes);
+                unsigned char *srcPtr = 0;
+                unsigned char *dstPtr = 0;
+                OBJ _bytes = __INST(bytes);
 
-		if (__isByteArrayLike(_bytes)) {
-		    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-		} else {
-		    if (__isExternalBytesLike(_bytes)) {
-			srcPtr = __externalBytesAddress(_bytes);
-		    }
-		}
-		if (__isByteArray(imageBits)) {
-		    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-		} else {
-		    if (__isExternalBytesLike(imageBits)) {
-			dstPtr = __externalBytesAddress(imageBits);
-		    }
-		}
+                if (__isByteArrayLike(_bytes)) {
+                    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+                } else {
+                    if (__isExternalBytesLike(_bytes)) {
+                        srcPtr = __externalBytesAddress(_bytes);
+                    }
+                }
+                if (__isByteArray(imageBits)) {
+                    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+                } else {
+                    if (__isExternalBytesLike(imageBits)) {
+                        dstPtr = __externalBytesAddress(imageBits);
+                    }
+                }
 
-		if (__bothSmallInteger(__INST(height), __INST(width))
-		 && __isArrayLike(colorValues)
-		 && srcPtr
-		 && dstPtr) {
-		    int x, y, w, h, nPix;
-		    int r,p, byte, shift;
+                if (__bothSmallInteger(__INST(height), __INST(width))
+                 && __isArrayLike(colorValues)
+                 && srcPtr
+                 && dstPtr) {
+                    int x, y, w, h, nPix;
+                    int r,p, byte, shift;
 
-		    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+                    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-		    w = __intVal(__INST(width));
-		    h = __intVal(__INST(height));
-		    r = 0;
-		    p = __intVal(padd);
+                    w = __intVal(__INST(width));
+                    h = __intVal(__INST(height));
+                    r = 0;
+                    p = __intVal(padd);
 
-		    nPix = w * h;
-		    shift = -2;
-		    while (nPix > 0) {
-			unsigned idx, v;
-			OBJ clr;
+                    nPix = w * h;
+                    shift = -2;
+                    while (nPix > 0) {
+                        unsigned idx, v;
+                        OBJ clr;
 
-			if (shift < 0) {
-			    byte = *srcPtr++;
-			    shift = 6;
-			}
-			idx = (byte >> shift) & 3;
-			shift -= 2;
+                        if (shift < 0) {
+                            byte = *srcPtr++;
+                            shift = 6;
+                        }
+                        idx = (byte >> shift) & 3;
+                        shift -= 2;
 
-			clr = ap[idx];
-			v = __intVal(clr);
+                        clr = ap[idx];
+                        v = __intVal(clr);
 
-			dstPtr[0] = v;
+                        dstPtr[0] = v;
 
-			dstPtr += 1;
-			nPix--;
+                        dstPtr += 1;
+                        nPix--;
 
-			if (++r == w) {
-			    dstPtr += p;
-			    r = 0;
-			    shift = -2;
-			}
-		    }
-		}
+                        if (++r == w) {
+                            dstPtr += p;
+                            r = 0;
+                            shift = -2;
+                        }
+                    }
+                }
 %}.
-	    ] ifFalse:[
-		usedDeviceBitsPerPixel == 24 ifTrue:[
-		    "/ 24 bits/pixel
+            ] ifFalse:[
+                usedDeviceBitsPerPixel == 24 ifTrue:[
+                    "/ 24 bits/pixel
 
-		    "/ now, walk over the image and replace
-		    "/ colorMap indices by color values in the bits array
+                    "/ now, walk over the image and replace
+                    "/ colorMap indices by color values in the bits array
 
 %{
-		    unsigned char *srcPtr = 0;
-		    unsigned char *dstPtr = 0;
-		    OBJ _bytes = __INST(bytes);
+                    unsigned char *srcPtr = 0;
+                    unsigned char *dstPtr = 0;
+                    OBJ _bytes = __INST(bytes);
 
-		    if (__isByteArrayLike(_bytes)) {
-			srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-		    } else {
-			if (__isExternalBytesLike(_bytes)) {
-			    srcPtr = __externalBytesAddress(_bytes);
-			}
-		    }
-		    if (__isByteArray(imageBits)) {
-			dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-		    } else {
-			if (__isExternalBytesLike(imageBits)) {
-			    dstPtr = __externalBytesAddress(imageBits);
-			}
-		    }
+                    if (__isByteArrayLike(_bytes)) {
+                        srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+                    } else {
+                        if (__isExternalBytesLike(_bytes)) {
+                            srcPtr = __externalBytesAddress(_bytes);
+                        }
+                    }
+                    if (__isByteArray(imageBits)) {
+                        dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+                    } else {
+                        if (__isExternalBytesLike(imageBits)) {
+                            dstPtr = __externalBytesAddress(imageBits);
+                        }
+                    }
 
-		    if (__bothSmallInteger(__INST(height), __INST(width))
-		     && __isArrayLike(colorValues)
-		     && srcPtr
-		     && dstPtr) {
-			int x, y, w, h, nPix;
-			int r, p, byte, shift;
+                    if (__bothSmallInteger(__INST(height), __INST(width))
+                     && __isArrayLike(colorValues)
+                     && srcPtr
+                     && dstPtr) {
+                        int x, y, w, h, nPix;
+                        int r, p, byte, shift;
 
-			OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+                        OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-			w = __intVal(__INST(width));
-			h = __intVal(__INST(height));
-			r = 0;
-			p = __intVal(padd);
+                        w = __intVal(__INST(width));
+                        h = __intVal(__INST(height));
+                        r = 0;
+                        p = __intVal(padd);
 
-			nPix = w * h;
-			shift = -2;
-			while (nPix > 0) {
-			    unsigned idx, v;
-			    OBJ clr;
+                        nPix = w * h;
+                        shift = -2;
+                        while (nPix > 0) {
+                            unsigned idx, v;
+                            OBJ clr;
 
-			    if (shift < 0) {
-				byte = *srcPtr++;
-				shift = 6;
-			    }
-			    idx = (byte >> shift) & 3;
-			    shift -= 2;
+                            if (shift < 0) {
+                                byte = *srcPtr++;
+                                shift = 6;
+                            }
+                            idx = (byte >> shift) & 3;
+                            shift -= 2;
 
-			    clr = ap[idx];
-			    v = __intVal(clr);
+                            clr = ap[idx];
+                            v = __intVal(clr);
 
-			    dstPtr[0] = (v>>16) & 0xFF;
-			    dstPtr[1] = (v>>8) & 0xFF;
-			    dstPtr[2] = (v) & 0xFF;
+                            dstPtr[0] = (v>>16) & 0xFF;
+                            dstPtr[1] = (v>>8) & 0xFF;
+                            dstPtr[2] = (v) & 0xFF;
 
-			    dstPtr += 3;
-			    nPix--;
+                            dstPtr += 3;
+                            nPix--;
 
-			    if (++r == w) {
-				dstPtr += p;
-				r = 0;
-				shift = -2;
-			    }
-			}
-		    }
+                            if (++r == w) {
+                                dstPtr += p;
+                                r = 0;
+                                shift = -2;
+                            }
+                        }
+                    }
 %}.
-		] ifFalse:[
-		    'Image [warning]: unimplemented trueColor depth in anyImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
-		    ^ nil
-		]
-	    ]
-	]
+                ] ifFalse:[
+                    'Image [warning]: unimplemented trueColor depth in anyImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
+                    ^ nil
+                ]
+            ]
+        ]
     ].
 
     imageBits isNil ifTrue:[
-	^ nil
+        ^ nil
     ].
 
-    form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
+    form := Form imageForm width:width height:height depth:usedDeviceDepth onDevice:aDevice.
     form isNil ifTrue:[^ nil].
     form initGC.
 
     form
-	copyBitsFrom:imageBits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:usedDevicePadding
-	width:width height:height
-	x:0 y:0
-	toX:0 y:0.
+        copyBitsFrom:imageBits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:usedDevicePadding
+        width:width height:height
+        x:0 y:0
+        toX:0 y:0.
 
     ^ form
 
@@ -998,10 +1004,10 @@
 !Depth2Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth2Image.st,v 1.52 2014-03-02 13:59:40 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Depth2Image.st,v 1.52 2014-03-02 13:59:40 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- a/Depth32Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth32Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -207,6 +207,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixelValue.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel.
      The pixel value contains r/g/b/a in msb order (i.e. r at high, a at low bits)"
@@ -249,6 +251,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -286,6 +290,26 @@
 
 !Depth32Image methodsFor:'converting rgb images'!
 
+computeAlphaValuesFromMask:aMaskImage
+    "convert a mask into alpha values;
+     masked pixels get an alpha value of 0,
+     unmasked of 255"
+
+    |alphaMask|
+
+    alphaMask := self alphaMaskForPixelValue.
+    self valuesFromX:0 y:0
+                 toX:width-1 y:height-1
+                  do:[:x :y :pixelValue |
+        (aMaskImage pixelAtX:x y:y) ~~ 0 ifTrue:[
+            self pixelAtX:x y:y put:(pixelValue bitOr:alphaMask).
+        ] ifFalse:[
+            self pixelAtX:x y:y put:(pixelValue bitClear:alphaMask).
+        ].
+    ].
+    photometric := #rgba
+!
+
 rgbImageAsTrueColorFormOn:aDevice
     "return a truecolor form from the rgba or argb-picture."
 
@@ -781,7 +805,7 @@
         ^ self asMonochromeFormOn:aDevice
     ].
 
-    form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
+    form := Form imageForm width:width height:height depth:usedDeviceDepth onDevice:aDevice.
     form isNil ifTrue:[
         'Depth32Image [warning]: display bitmap creation failed' errorPrintCR.
         ^ nil
--- a/Depth48Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth48Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -71,6 +71,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixelValue.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel.
      The pixel value contains r/g/b in msb order (i.e. r at high, a at low bits)"
@@ -88,6 +90,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
--- a/Depth4Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth4Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -77,6 +77,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixelValue.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -104,6 +106,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -117,9 +121,9 @@
     index := lineIndex + (x // 2).
     byte := bytes at:index.
     x even ifTrue:[
-	byte := (byte bitAnd:16rF) bitOr:(aPixelValue bitShift:4)
+        byte := (byte bitAnd:16rF) bitOr:(aPixelValue bitShift:4)
     ] ifFalse:[
-	byte := (byte bitAnd:16rF0) bitOr:aPixelValue
+        byte := (byte bitAnd:16rF0) bitOr:aPixelValue
     ].
     bytes at:index put:byte
 
@@ -175,7 +179,7 @@
     bestFormat := self bestSupportedImageFormatFor:aDevice.
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceDepth == 1 ifTrue:[
-	^ self asMonochromeFormOn:aDevice
+        ^ self asMonochromeFormOn:aDevice
     ].
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
     usedDevicePadding := bestFormat at:#padding.
@@ -187,310 +191,310 @@
     "/ for now, only support some depths
 
     usedDeviceBitsPerPixel == 16 ifTrue:[
-	"/ 16 bits/pixel
+        "/ 16 bits/pixel
 
-	"/ now, walk over the image and replace
-	"/ colorMap indices by color values in the bits array
+        "/ now, walk over the image and replace
+        "/ colorMap indices by color values in the bits array
 
 %{
-	unsigned char *srcPtr = 0;
-	unsigned char *dstPtr = 0;
-	OBJ _bytes = __INST(bytes);
+        unsigned char *srcPtr = 0;
+        unsigned char *dstPtr = 0;
+        OBJ _bytes = __INST(bytes);
 
-	if (__isByteArrayLike(_bytes)) {
-	    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-	} else {
-	    if (__isExternalBytesLike(_bytes)) {
-		srcPtr = __externalBytesAddress(_bytes);
-	    }
-	}
-	if (__isByteArray(imageBits)) {
-	    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	} else {
-	    if (__isExternalBytesLike(imageBits)) {
-		dstPtr = __externalBytesAddress(imageBits);
-	    }
-	}
+        if (__isByteArrayLike(_bytes)) {
+            srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+        } else {
+            if (__isExternalBytesLike(_bytes)) {
+                srcPtr = __externalBytesAddress(_bytes);
+            }
+        }
+        if (__isByteArray(imageBits)) {
+            dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+        } else {
+            if (__isExternalBytesLike(imageBits)) {
+                dstPtr = __externalBytesAddress(imageBits);
+            }
+        }
 
-	if (__bothSmallInteger(__INST(height), __INST(width))
-	 && __isArrayLike(colorValues)
-	 && srcPtr
-	 && dstPtr) {
-	    int r,p;
-	    int x, y, w, h, nPix;
-	    int byte;
+        if (__bothSmallInteger(__INST(height), __INST(width))
+         && __isArrayLike(colorValues)
+         && srcPtr
+         && dstPtr) {
+            int r,p;
+            int x, y, w, h, nPix;
+            int byte;
 
-	    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+            OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-	    w = __intVal(__INST(width));
-	    h = __intVal(__INST(height));
-	    r = 0;
-	    p = __intVal(padd);
-	    nPix = w * h;
-	    while (nPix-- > 0) {
-		unsigned idx, v;
-		OBJ clr;
+            w = __intVal(__INST(width));
+            h = __intVal(__INST(height));
+            r = 0;
+            p = __intVal(padd);
+            nPix = w * h;
+            while (nPix-- > 0) {
+                unsigned idx, v;
+                OBJ clr;
 
-		if (r & 1) {
-		    idx = byte & 0xF;
-		} else {
-		    byte = *srcPtr++;
-		    idx = (byte>>4) & 0xF;
-		}
-		clr = ap[idx];
-		v = __intVal(clr);
+                if (r & 1) {
+                    idx = byte & 0xF;
+                } else {
+                    byte = *srcPtr++;
+                    idx = (byte>>4) & 0xF;
+                }
+                clr = ap[idx];
+                v = __intVal(clr);
 #ifdef __MSBFIRST
-		((short *)dstPtr)[0] = v;
+                ((short *)dstPtr)[0] = v;
 #else
 # ifdef xxSWAP_BYTES
-		SWAP_BYTES(v);
-		((short *)dstPtr)[0] = v;
+                SWAP_BYTES(v);
+                ((short *)dstPtr)[0] = v;
 # else
-		dstPtr[0] = (v>>8) & 0xFF;
-		dstPtr[1] = (v) & 0xFF;
+                dstPtr[0] = (v>>8) & 0xFF;
+                dstPtr[1] = (v) & 0xFF;
 # endif
 #endif
-		dstPtr += 2;
+                dstPtr += 2;
 
-		if (++r == w) {
-		    dstPtr += p;
-		    r = 0;
-		}
-	    }
-	}
+                if (++r == w) {
+                    dstPtr += p;
+                    r = 0;
+                }
+            }
+        }
 %}.
     ] ifFalse:[
-	usedDeviceBitsPerPixel == 32 ifTrue:[
-	    "/ 32 bits/pixel
+        usedDeviceBitsPerPixel == 32 ifTrue:[
+            "/ 32 bits/pixel
 
-	    "/ now, walk over the image and replace
-	    "/ colorMap indices by color values in the bits array
+            "/ now, walk over the image and replace
+            "/ colorMap indices by color values in the bits array
 
 %{
-	    unsigned char *srcPtr = 0;
-	    unsigned char *dstPtr = 0;
-	    OBJ _bytes = __INST(bytes);
+            unsigned char *srcPtr = 0;
+            unsigned char *dstPtr = 0;
+            OBJ _bytes = __INST(bytes);
 
-	    if (__isByteArrayLike(_bytes)) {
-		srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-	    } else {
-		if (__isExternalBytesLike(_bytes)) {
-		    srcPtr = __externalBytesAddress(_bytes);
-		}
-	    }
-	    if (__isByteArray(imageBits)) {
-		dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	    } else {
-		if (__isExternalBytesLike(imageBits)) {
-		    dstPtr = __externalBytesAddress(imageBits);
-		}
-	    }
+            if (__isByteArrayLike(_bytes)) {
+                srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+            } else {
+                if (__isExternalBytesLike(_bytes)) {
+                    srcPtr = __externalBytesAddress(_bytes);
+                }
+            }
+            if (__isByteArray(imageBits)) {
+                dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+            } else {
+                if (__isExternalBytesLike(imageBits)) {
+                    dstPtr = __externalBytesAddress(imageBits);
+                }
+            }
 
-	    if (__bothSmallInteger(__INST(height), __INST(width))
-	     && __isArrayLike(colorValues)
-	     && srcPtr
-	     && dstPtr) {
-		int x, y, w, h, nPix;
-		int r,p;
-		int byte;
+            if (__bothSmallInteger(__INST(height), __INST(width))
+             && __isArrayLike(colorValues)
+             && srcPtr
+             && dstPtr) {
+                int x, y, w, h, nPix;
+                int r,p;
+                int byte;
 
-		OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+                OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-		w = __intVal(__INST(width));
-		h = __intVal(__INST(height));
-		r = 0;
-		p = __intVal(padd);
-		nPix = w * h;
-		while (nPix > 0) {
-		    unsigned idx, v;
-		    OBJ clr;
+                w = __intVal(__INST(width));
+                h = __intVal(__INST(height));
+                r = 0;
+                p = __intVal(padd);
+                nPix = w * h;
+                while (nPix > 0) {
+                    unsigned idx, v;
+                    OBJ clr;
 
-		    if (r & 1) {
-			idx = byte & 0xF;
-		    } else {
-			byte = *srcPtr++;
-			idx = (byte>>4) & 0xF;
-		    }
-		    clr = ap[idx];
-		    v = __intVal(clr);
+                    if (r & 1) {
+                        idx = byte & 0xF;
+                    } else {
+                        byte = *srcPtr++;
+                        idx = (byte>>4) & 0xF;
+                    }
+                    clr = ap[idx];
+                    v = __intVal(clr);
 #ifdef __MSBFIRST
-		    ((long *)dstPtr)[0] = v;
+                    ((long *)dstPtr)[0] = v;
 #else
-		    dstPtr[0] = (v>>24) & 0xFF;
-		    dstPtr[1] = (v>>16) & 0xFF;
-		    dstPtr[2] = (v>>8) & 0xFF;
-		    dstPtr[3] = (v) & 0xFF;
+                    dstPtr[0] = (v>>24) & 0xFF;
+                    dstPtr[1] = (v>>16) & 0xFF;
+                    dstPtr[2] = (v>>8) & 0xFF;
+                    dstPtr[3] = (v) & 0xFF;
 #endif
-		    dstPtr += 4;
-		    nPix--;
+                    dstPtr += 4;
+                    nPix--;
 
-		    if (++r == w) {
-			dstPtr += p;
-			r = 0;
-		    }
-		}
-	    }
+                    if (++r == w) {
+                        dstPtr += p;
+                        r = 0;
+                    }
+                }
+            }
 %}.
-	] ifFalse:[
-	    usedDeviceBitsPerPixel == 8 ifTrue:[
-		"/ 8 bits/pixel
+        ] ifFalse:[
+            usedDeviceBitsPerPixel == 8 ifTrue:[
+                "/ 8 bits/pixel
 
-		"/ now, walk over the image and replace
-		"/ colorMap indices by color values in the bits array
+                "/ now, walk over the image and replace
+                "/ colorMap indices by color values in the bits array
 
 %{
-		unsigned char *srcPtr = 0;
-		unsigned char *dstPtr = 0;
-		OBJ _bytes = __INST(bytes);
+                unsigned char *srcPtr = 0;
+                unsigned char *dstPtr = 0;
+                OBJ _bytes = __INST(bytes);
 
-		if (__isByteArrayLike(_bytes)) {
-		    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-		} else {
-		    if (__isExternalBytesLike(_bytes)) {
-			srcPtr = __externalBytesAddress(_bytes);
-		    }
-		}
-		if (__isByteArray(imageBits)) {
-		    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-		} else {
-		    if (__isExternalBytesLike(imageBits)) {
-			dstPtr = __externalBytesAddress(imageBits);
-		    }
-		}
+                if (__isByteArrayLike(_bytes)) {
+                    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+                } else {
+                    if (__isExternalBytesLike(_bytes)) {
+                        srcPtr = __externalBytesAddress(_bytes);
+                    }
+                }
+                if (__isByteArray(imageBits)) {
+                    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+                } else {
+                    if (__isExternalBytesLike(imageBits)) {
+                        dstPtr = __externalBytesAddress(imageBits);
+                    }
+                }
 
-		if (__bothSmallInteger(__INST(height), __INST(width))
-		 && __isArrayLike(colorValues)
-		 && srcPtr
-		 && dstPtr) {
-		    int x, y, w, h, nPix;
-		    int r,p, byte;
+                if (__bothSmallInteger(__INST(height), __INST(width))
+                 && __isArrayLike(colorValues)
+                 && srcPtr
+                 && dstPtr) {
+                    int x, y, w, h, nPix;
+                    int r,p, byte;
 
-		    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+                    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-		    w = __intVal(__INST(width));
-		    h = __intVal(__INST(height));
-		    r = 0;
-		    p = __intVal(padd);
+                    w = __intVal(__INST(width));
+                    h = __intVal(__INST(height));
+                    r = 0;
+                    p = __intVal(padd);
 
-		    nPix = w * h;
-		    while (nPix > 0) {
-			unsigned idx, v;
-			OBJ clr;
+                    nPix = w * h;
+                    while (nPix > 0) {
+                        unsigned idx, v;
+                        OBJ clr;
 
-			if (r & 1) {
-			    idx = byte & 0xF;
-			} else {
-			    byte = *srcPtr++;
-			    idx = (byte>>4) & 0xF;
-			}
-			clr = ap[idx];
-			v = __intVal(clr);
+                        if (r & 1) {
+                            idx = byte & 0xF;
+                        } else {
+                            byte = *srcPtr++;
+                            idx = (byte>>4) & 0xF;
+                        }
+                        clr = ap[idx];
+                        v = __intVal(clr);
 
-			dstPtr[0] = v;
+                        dstPtr[0] = v;
 
-			dstPtr += 1;
-			nPix--;
+                        dstPtr += 1;
+                        nPix--;
 
-			if (++r == w) {
-			    dstPtr += p;
-			    r = 0;
-			}
-		    }
-		}
+                        if (++r == w) {
+                            dstPtr += p;
+                            r = 0;
+                        }
+                    }
+                }
 %}.
-	    ] ifFalse:[
-		usedDeviceBitsPerPixel == 24 ifTrue:[
-		    "/ 24 bits/pixel
+            ] ifFalse:[
+                usedDeviceBitsPerPixel == 24 ifTrue:[
+                    "/ 24 bits/pixel
 
-		    "/ now, walk over the image and replace
-		    "/ colorMap indices by color values in the bits array
+                    "/ now, walk over the image and replace
+                    "/ colorMap indices by color values in the bits array
 
 %{
-		    unsigned char *srcPtr = 0;
-		    unsigned char *dstPtr = 0;
-		    OBJ _bytes = __INST(bytes);
+                    unsigned char *srcPtr = 0;
+                    unsigned char *dstPtr = 0;
+                    OBJ _bytes = __INST(bytes);
 
-		    if (__isByteArrayLike(_bytes)) {
-			srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-		    } else {
-			if (__isExternalBytesLike(_bytes)) {
-			    srcPtr = __externalBytesAddress(_bytes);
-			}
-		    }
-		    if (__isByteArray(imageBits)) {
-			dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-		    } else {
-			if (__isExternalBytesLike(imageBits)) {
-			    dstPtr = __externalBytesAddress(imageBits);
-			}
-		    }
+                    if (__isByteArrayLike(_bytes)) {
+                        srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+                    } else {
+                        if (__isExternalBytesLike(_bytes)) {
+                            srcPtr = __externalBytesAddress(_bytes);
+                        }
+                    }
+                    if (__isByteArray(imageBits)) {
+                        dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+                    } else {
+                        if (__isExternalBytesLike(imageBits)) {
+                            dstPtr = __externalBytesAddress(imageBits);
+                        }
+                    }
 
-		    if (__bothSmallInteger(__INST(height), __INST(width))
-		     && __isArrayLike(colorValues)
-		     && srcPtr
-		     && dstPtr) {
-			int x, y, w, h, nPix;
-			int r, p, byte;
+                    if (__bothSmallInteger(__INST(height), __INST(width))
+                     && __isArrayLike(colorValues)
+                     && srcPtr
+                     && dstPtr) {
+                        int x, y, w, h, nPix;
+                        int r, p, byte;
 
-			OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+                        OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
 
-			w = __intVal(__INST(width));
-			h = __intVal(__INST(height));
-			r = 0;
-			p = __intVal(padd);
+                        w = __intVal(__INST(width));
+                        h = __intVal(__INST(height));
+                        r = 0;
+                        p = __intVal(padd);
 
-			nPix = w * h;
-			while (nPix > 0) {
-			    unsigned idx, v;
-			    OBJ clr;
+                        nPix = w * h;
+                        while (nPix > 0) {
+                            unsigned idx, v;
+                            OBJ clr;
 
-			    if (r & 1) {
-				idx = byte & 0xF;
-			    } else {
-				byte = *srcPtr++;
-				idx = (byte>>4) & 0xF;
-			    }
-			    clr = ap[idx];
-			    v = __intVal(clr);
+                            if (r & 1) {
+                                idx = byte & 0xF;
+                            } else {
+                                byte = *srcPtr++;
+                                idx = (byte>>4) & 0xF;
+                            }
+                            clr = ap[idx];
+                            v = __intVal(clr);
 
-			    dstPtr[0] = (v>>16) & 0xFF;
-			    dstPtr[1] = (v>>8) & 0xFF;
-			    dstPtr[2] = (v) & 0xFF;
+                            dstPtr[0] = (v>>16) & 0xFF;
+                            dstPtr[1] = (v>>8) & 0xFF;
+                            dstPtr[2] = (v) & 0xFF;
 
-			    dstPtr += 3;
-			    nPix--;
+                            dstPtr += 3;
+                            nPix--;
 
-			    if (++r == w) {
-				dstPtr += p;
-				r = 0;
-			    }
-			}
-		    }
+                            if (++r == w) {
+                                dstPtr += p;
+                                r = 0;
+                            }
+                        }
+                    }
 %}.
-		] ifFalse:[
-		    'Image [warning]: unimplemented trueColor depth in anyImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
-		    ^ nil
-		]
-	    ]
-	]
+                ] ifFalse:[
+                    'Image [warning]: unimplemented trueColor depth in anyImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
+                    ^ nil
+                ]
+            ]
+        ]
     ].
 
     imageBits isNil ifTrue:[
-	^ nil
+        ^ nil
     ].
 
-    form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
+    form := Form imageForm width:width height:height depth:usedDeviceDepth onDevice:aDevice.
     form isNil ifTrue:[^ nil].
     form initGC.
 
     form
-	copyBitsFrom:imageBits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:usedDevicePadding
-	width:width height:height
-	x:0 y:0
-	toX:0 y:0.
+        copyBitsFrom:imageBits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:usedDevicePadding
+        width:width height:height
+        x:0 y:0
+        toX:0 y:0.
 
     ^ form
 
--- a/Depth64Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth64Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -71,6 +71,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixelValue.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel.
      The pixel value contains r/g/b/a in msb order (i.e. r at high, a at low bits)"
@@ -89,6 +91,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
--- a/Depth8Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Depth8Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -78,6 +76,8 @@
 
 pixelAtX:x y:y
     "retrieve a pixel at x/y; return a pixelValue.
+     The interpretation of the returned value depends on the photometric
+     and the colormap. See also Image>>atX:y:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -112,6 +112,8 @@
 
 pixelAtX:x y:y put:aPixelValue
     "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel"
 
@@ -125,13 +127,13 @@
     if (__isByteArrayLike(b)
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(w, aPixelValue) ) {
-	int _idx;
-
-	_idx = (__intVal(w) * __intVal(y)) + __intVal(x);
-	if ((unsigned)_idx < __byteArraySize(b)) {
-	    __ByteArrayInstPtr(b)->ba_element[_idx] = __intVal(aPixelValue);
-	    RETURN( self );
-	}
+        int _idx;
+
+        _idx = (__intVal(w) * __intVal(y)) + __intVal(x);
+        if ((unsigned)_idx < __byteArraySize(b)) {
+            __ByteArrayInstPtr(b)->ba_element[_idx] = __intVal(aPixelValue);
+            RETURN( self );
+        }
     }
 %}.
     "fall back code for nonByteArray or nonInteger arguments"
@@ -142,23 +144,23 @@
 
 rowAt:y into:aPixelBuffer startingAt:startIndex
     "fill aPixelBuffer with pixel values from a single row.
-     Notice: row coordinate starts at 0."
+     Notice: row/column coordinates start at 0."
 
     |srcIdx endIndex n|
 
     bytes notNil ifTrue:[
-	srcIdx := (y * width) + 1.
-	n := width.
-
-	endIndex := srcIdx+width-1.
-	endIndex > bytes size ifTrue:[
-	    self assert:(bytes size >= endIndex).
-	    endIndex := bytes size.
-	    n := endIndex - srcIdx + 1.
-	].
-
-	aPixelBuffer replaceFrom:startIndex to:startIndex+n-1 with:bytes startingAt:srcIdx.
-	^ self.
+        srcIdx := (y * width) + 1.
+        n := width.
+
+        endIndex := srcIdx+width-1.
+        endIndex > bytes size ifTrue:[
+            self assert:(bytes size >= endIndex).
+            endIndex := bytes size.
+            n := endIndex - srcIdx + 1.
+        ].
+
+        aPixelBuffer replaceFrom:startIndex to:startIndex+n-1 with:bytes startingAt:srcIdx.
+        ^ self.
     ].
     ^ super rowAt:y into:aPixelBuffer startingAt:startIndex
 
@@ -166,9 +168,8 @@
 !
 
 rowAt:y putAll:pixelArray startingAt:startIndex
-    "store a single rows bits from bits in the pixelArray argument;
-     Return the pixelArray.
-     Notice: row coordinate starts at 0."
+    "store a single row's bits from bits in the pixelArray argument;
+     Notice: row/column coordinates start at 0."
 
     |dstIdx|
 
@@ -548,7 +549,7 @@
 
         map := nil.
 
-        f := Form width:width height:height depth:deviceDepth onDevice:aDevice.
+        f := Form imageForm width:width height:height depth:deviceDepth onDevice:aDevice.
         f isNil ifTrue:[^ nil].
         f colorMap:imgMap.
         f initGC.
@@ -624,7 +625,7 @@
     bestFormat := self bestSupportedImageFormatFor:aDevice.
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceDepth == 1 ifTrue:[
-	^ self asMonochromeFormOn:aDevice
+        ^ self asMonochromeFormOn:aDevice
     ].
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
     usedDevicePadding := bestFormat at:#padding.
@@ -636,344 +637,344 @@
     "/ for now, only support some depths
 
     usedDeviceBitsPerPixel == 16 ifTrue:[
-	"/ 16 bits/pixel
-
-	"/ now, walk over the image and replace
-	"/ colorMap indices by color values in the bits array
+        "/ 16 bits/pixel
+
+        "/ now, walk over the image and replace
+        "/ colorMap indices by color values in the bits array
 
 %{
-	unsigned char *srcPtr = 0;
-	unsigned char *dstPtr = 0;
-	OBJ _bytes = __INST(bytes);
-
-	if (__isByteArrayLike(_bytes)) {
-	    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-	} else {
-	    if (__isExternalBytesLike(_bytes)) {
-		srcPtr = __externalBytesAddress(_bytes);
-	    }
-	}
-	if (__isByteArray(imageBits)) {
-	    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	} else {
-	    if (__isExternalBytesLike(imageBits)) {
-		dstPtr = __externalBytesAddress(imageBits);
-	    }
-	}
-
-	if (__bothSmallInteger(__INST(height), __INST(width))
-	 && __isArrayLike(colorValues)
-	 && srcPtr
-	 && dstPtr) {
-	    int r,p;
-	    int x, y, w, h, nPix;
-	    unsigned short pixels[256];
-
-	    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
-
-	    nPix = __arraySize(colorValues);
-	    for (p=0; p<nPix; p++) {
-		pixels[p] = __intVal(ap[p]);
-	    }
-
-	    w = __intVal(__INST(width));
-	    h = __intVal(__INST(height));
-	    r = w;
-	    p = __intVal(padd);
-	    nPix = w * h;
-
-	    while (nPix > 0) {
-		unsigned idx, v;
-
-		if (((unsigned INT)srcPtr & 3) == 0) {
-		    unsigned INT idx4;
-
-		    while (r > 4) {
+        unsigned char *srcPtr = 0;
+        unsigned char *dstPtr = 0;
+        OBJ _bytes = __INST(bytes);
+
+        if (__isByteArrayLike(_bytes)) {
+            srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+        } else {
+            if (__isExternalBytesLike(_bytes)) {
+                srcPtr = __externalBytesAddress(_bytes);
+            }
+        }
+        if (__isByteArray(imageBits)) {
+            dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+        } else {
+            if (__isExternalBytesLike(imageBits)) {
+                dstPtr = __externalBytesAddress(imageBits);
+            }
+        }
+
+        if (__bothSmallInteger(__INST(height), __INST(width))
+         && __isArrayLike(colorValues)
+         && srcPtr
+         && dstPtr) {
+            int r,p;
+            int x, y, w, h, nPix;
+            unsigned short pixels[256];
+
+            OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+
+            nPix = __arraySize(colorValues);
+            for (p=0; p<nPix; p++) {
+                pixels[p] = __intVal(ap[p]);
+            }
+
+            w = __intVal(__INST(width));
+            h = __intVal(__INST(height));
+            r = w;
+            p = __intVal(padd);
+            nPix = w * h;
+
+            while (nPix > 0) {
+                unsigned idx, v;
+
+                if (((unsigned INT)srcPtr & 3) == 0) {
+                    unsigned INT idx4;
+
+                    while (r > 4) {
 #ifdef __MSBFIRST
-			idx4 = ((unsigned int *)srcPtr)[0];
-			v = pixels[(idx4 >> 24) & 0xFF];
-			((short *)dstPtr)[0] = v;
-			v = pixels[(idx4 >> 16) & 0xFF];
-			((short *)dstPtr)[1] = v;
-			v = pixels[(idx4 >> 8) & 0xFF];
-			((short *)dstPtr)[2] = v;
-			v = pixels[idx4 & 0xFF];
-			((short *)dstPtr)[3] = v;
+                        idx4 = ((unsigned int *)srcPtr)[0];
+                        v = pixels[(idx4 >> 24) & 0xFF];
+                        ((short *)dstPtr)[0] = v;
+                        v = pixels[(idx4 >> 16) & 0xFF];
+                        ((short *)dstPtr)[1] = v;
+                        v = pixels[(idx4 >> 8) & 0xFF];
+                        ((short *)dstPtr)[2] = v;
+                        v = pixels[idx4 & 0xFF];
+                        ((short *)dstPtr)[3] = v;
 #else
 # ifdef __LSBFIRST
-			idx4 = ((unsigned int *)srcPtr)[0];
-			v = pixels[idx4 & 0xFF];
-			dstPtr[0] = (v>>8) & 0xFF;
-			dstPtr[1] = (v) & 0xFF;
-
-			v = pixels[(idx4 >> 8) & 0xFF];
-			dstPtr[2] = (v>>8) & 0xFF;
-			dstPtr[3] = (v) & 0xFF;
-
-			v = pixels[(idx4 >> 16) & 0xFF];
-			dstPtr[4] = (v>>8) & 0xFF;
-			dstPtr[5] = (v) & 0xFF;
-
-			v = pixels[(idx4 >> 24) & 0xFF];
-			dstPtr[6] = (v>>8) & 0xFF;
-			dstPtr[7] = (v) & 0xFF;
+                        idx4 = ((unsigned int *)srcPtr)[0];
+                        v = pixels[idx4 & 0xFF];
+                        dstPtr[0] = (v>>8) & 0xFF;
+                        dstPtr[1] = (v) & 0xFF;
+
+                        v = pixels[(idx4 >> 8) & 0xFF];
+                        dstPtr[2] = (v>>8) & 0xFF;
+                        dstPtr[3] = (v) & 0xFF;
+
+                        v = pixels[(idx4 >> 16) & 0xFF];
+                        dstPtr[4] = (v>>8) & 0xFF;
+                        dstPtr[5] = (v) & 0xFF;
+
+                        v = pixels[(idx4 >> 24) & 0xFF];
+                        dstPtr[6] = (v>>8) & 0xFF;
+                        dstPtr[7] = (v) & 0xFF;
 # else /* unknown/unspecified - code below works on any machine */
-			idx = srcPtr[0];
-			v = pixels[idx];
-			dstPtr[0] = (v>>8) & 0xFF;
-			dstPtr[1] = (v) & 0xFF;
-
-			idx = srcPtr[1];
-			v = pixels[idx];
-			dstPtr[2] = (v>>8) & 0xFF;
-			dstPtr[3] = (v) & 0xFF;
-
-			idx = srcPtr[2];
-			v = pixels[idx];
-			dstPtr[4] = (v>>8) & 0xFF;
-			dstPtr[5] = (v) & 0xFF;
-
-			idx = srcPtr[3];
-			v = pixels[idx];
-			dstPtr[6] = (v>>8) & 0xFF;
-			dstPtr[7] = (v) & 0xFF;
+                        idx = srcPtr[0];
+                        v = pixels[idx];
+                        dstPtr[0] = (v>>8) & 0xFF;
+                        dstPtr[1] = (v) & 0xFF;
+
+                        idx = srcPtr[1];
+                        v = pixels[idx];
+                        dstPtr[2] = (v>>8) & 0xFF;
+                        dstPtr[3] = (v) & 0xFF;
+
+                        idx = srcPtr[2];
+                        v = pixels[idx];
+                        dstPtr[4] = (v>>8) & 0xFF;
+                        dstPtr[5] = (v) & 0xFF;
+
+                        idx = srcPtr[3];
+                        v = pixels[idx];
+                        dstPtr[6] = (v>>8) & 0xFF;
+                        dstPtr[7] = (v) & 0xFF;
 # endif
 #endif
-			r -= 4;
-			dstPtr += 8;
-			nPix -= 4;
-			srcPtr +=4;
-		    }
-		}
-
-		nPix--;
-
-		idx = *srcPtr++;
-		v = pixels[idx];
+                        r -= 4;
+                        dstPtr += 8;
+                        nPix -= 4;
+                        srcPtr +=4;
+                    }
+                }
+
+                nPix--;
+
+                idx = *srcPtr++;
+                v = pixels[idx];
 #ifdef __MSBFIRST
-		((short *)dstPtr)[0] = v;
+                ((short *)dstPtr)[0] = v;
 #else
-		dstPtr[0] = (v>>8) & 0xFF;
-		dstPtr[1] = (v) & 0xFF;
+                dstPtr[0] = (v>>8) & 0xFF;
+                dstPtr[1] = (v) & 0xFF;
 #endif
-		dstPtr += 2;
-
-		if (--r == 0) {
-		    dstPtr += p;
-		    r = w;
-		}
-	    }
-	}
+                dstPtr += 2;
+
+                if (--r == 0) {
+                    dstPtr += p;
+                    r = w;
+                }
+            }
+        }
 %}.
     ] ifFalse:[
-	usedDeviceBitsPerPixel == 32 ifTrue:[
-	    "/ 32 bits/pixel
-
-	    "/ now, walk over the image and replace
-	    "/ colorMap indices by color values in the bits array
+        usedDeviceBitsPerPixel == 32 ifTrue:[
+            "/ 32 bits/pixel
+
+            "/ now, walk over the image and replace
+            "/ colorMap indices by color values in the bits array
 
 %{
-	    unsigned char *srcPtr = 0;
-	    unsigned char *dstPtr = 0;
-	    OBJ _bytes = __INST(bytes);
-
-	    if (__isByteArrayLike(_bytes)) {
-		srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-	    } else {
-		if (__isExternalBytesLike(_bytes)) {
-		    srcPtr = __externalBytesAddress(_bytes);
-		}
-	    }
-	    if (__isByteArray(imageBits)) {
-		dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	    } else {
-		if (__isExternalBytesLike(imageBits)) {
-		    dstPtr = __externalBytesAddress(imageBits);
-		}
-	    }
-
-	    if (__bothSmallInteger(__INST(height), __INST(width))
-	     && __isArrayLike(colorValues)
-	     && srcPtr
-	     && dstPtr) {
-		int x, y, w, h, nPix;
-
-		OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
-
-		w = __intVal(__INST(width));
-		h = __intVal(__INST(height));
-		nPix = w * h;
-		while (nPix > 0) {
-		    unsigned idx, v;
-		    OBJ clr;
-
-		    idx = *srcPtr;
-		    clr = ap[idx];
-		    v = __intVal(clr);
+            unsigned char *srcPtr = 0;
+            unsigned char *dstPtr = 0;
+            OBJ _bytes = __INST(bytes);
+
+            if (__isByteArrayLike(_bytes)) {
+                srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+            } else {
+                if (__isExternalBytesLike(_bytes)) {
+                    srcPtr = __externalBytesAddress(_bytes);
+                }
+            }
+            if (__isByteArray(imageBits)) {
+                dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+            } else {
+                if (__isExternalBytesLike(imageBits)) {
+                    dstPtr = __externalBytesAddress(imageBits);
+                }
+            }
+
+            if (__bothSmallInteger(__INST(height), __INST(width))
+             && __isArrayLike(colorValues)
+             && srcPtr
+             && dstPtr) {
+                int x, y, w, h, nPix;
+
+                OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+
+                w = __intVal(__INST(width));
+                h = __intVal(__INST(height));
+                nPix = w * h;
+                while (nPix > 0) {
+                    unsigned idx, v;
+                    OBJ clr;
+
+                    idx = *srcPtr;
+                    clr = ap[idx];
+                    v = __intVal(clr);
 #ifdef __MSBFIRST
-		    ((long *)dstPtr)[0] = v;
+                    ((long *)dstPtr)[0] = v;
 #else
-		    dstPtr[0] = (v>>24) & 0xFF;
-		    dstPtr[1] = (v>>16) & 0xFF;
-		    dstPtr[2] = (v>>8) & 0xFF;
-		    dstPtr[3] = (v) & 0xFF;
+                    dstPtr[0] = (v>>24) & 0xFF;
+                    dstPtr[1] = (v>>16) & 0xFF;
+                    dstPtr[2] = (v>>8) & 0xFF;
+                    dstPtr[3] = (v) & 0xFF;
 #endif
-		    dstPtr += 4;
-		    srcPtr += 1;
-		    nPix--;
-		}
-	    }
+                    dstPtr += 4;
+                    srcPtr += 1;
+                    nPix--;
+                }
+            }
 %}.
-	] ifFalse:[
-	    usedDeviceBitsPerPixel == 8 ifTrue:[
-		"/ 8 bits/pixel
-
-		"/ now, walk over the image and replace
-		"/ colorMap indices by color values in the bits array
+        ] ifFalse:[
+            usedDeviceBitsPerPixel == 8 ifTrue:[
+                "/ 8 bits/pixel
+
+                "/ now, walk over the image and replace
+                "/ colorMap indices by color values in the bits array
 
 %{
-		unsigned char *srcPtr = 0;
-		unsigned char *dstPtr = 0;
-		OBJ _bytes = __INST(bytes);
-
-		if (__isByteArrayLike(_bytes)) {
-		    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-		} else {
-		    if (__isExternalBytesLike(_bytes)) {
-			srcPtr = __externalBytesAddress(_bytes);
-		    }
-		}
-		if (__isByteArray(imageBits)) {
-		    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-		} else {
-		    if (__isExternalBytesLike(imageBits)) {
-			dstPtr = __externalBytesAddress(imageBits);
-		    }
-		}
-
-		if (__bothSmallInteger(__INST(height), __INST(width))
-		 && __isArrayLike(colorValues)
-		 && srcPtr
-		 && dstPtr) {
-		    int x, y, w, h, nPix;
-		    int r,p;
-
-		    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
-
-		    w = __intVal(__INST(width));
-		    h = __intVal(__INST(height));
-		    r = w;
-		    p = __intVal(padd);
-
-		    nPix = w * h;
-		    while (nPix > 0) {
-			unsigned idx, v;
-			OBJ clr;
-
-			idx = *srcPtr;
-			clr = ap[idx];
-			v = __intVal(clr);
-
-			dstPtr[0] = v;
-
-			dstPtr += 1;
-			srcPtr += 1;
-			nPix--;
-
-			if (--r == 0) {
-			  dstPtr += p;
-			  r = w;
-			}
-
-		    }
-		}
+                unsigned char *srcPtr = 0;
+                unsigned char *dstPtr = 0;
+                OBJ _bytes = __INST(bytes);
+
+                if (__isByteArrayLike(_bytes)) {
+                    srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+                } else {
+                    if (__isExternalBytesLike(_bytes)) {
+                        srcPtr = __externalBytesAddress(_bytes);
+                    }
+                }
+                if (__isByteArray(imageBits)) {
+                    dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+                } else {
+                    if (__isExternalBytesLike(imageBits)) {
+                        dstPtr = __externalBytesAddress(imageBits);
+                    }
+                }
+
+                if (__bothSmallInteger(__INST(height), __INST(width))
+                 && __isArrayLike(colorValues)
+                 && srcPtr
+                 && dstPtr) {
+                    int x, y, w, h, nPix;
+                    int r,p;
+
+                    OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+
+                    w = __intVal(__INST(width));
+                    h = __intVal(__INST(height));
+                    r = w;
+                    p = __intVal(padd);
+
+                    nPix = w * h;
+                    while (nPix > 0) {
+                        unsigned idx, v;
+                        OBJ clr;
+
+                        idx = *srcPtr;
+                        clr = ap[idx];
+                        v = __intVal(clr);
+
+                        dstPtr[0] = v;
+
+                        dstPtr += 1;
+                        srcPtr += 1;
+                        nPix--;
+
+                        if (--r == 0) {
+                          dstPtr += p;
+                          r = w;
+                        }
+
+                    }
+                }
 %}.
-	    ] ifFalse:[
-		usedDeviceBitsPerPixel == 24 ifTrue:[
-		    "/ 24 bits/pixel
-
-		    "/ now, walk over the image and replace
-		    "/ colorMap indices by color values in the bits array
+            ] ifFalse:[
+                usedDeviceBitsPerPixel == 24 ifTrue:[
+                    "/ 24 bits/pixel
+
+                    "/ now, walk over the image and replace
+                    "/ colorMap indices by color values in the bits array
 
 %{
-		    unsigned char *srcPtr = 0;
-		    unsigned char *dstPtr = 0;
-		    OBJ _bytes = __INST(bytes);
-
-		    if (__isByteArrayLike(_bytes)) {
-			srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
-		    } else {
-			if (__isExternalBytesLike(_bytes)) {
-			    srcPtr = __externalBytesAddress(_bytes);
-			}
-		    }
-		    if (__isByteArray(imageBits)) {
-			dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-		    } else {
-			if (__isExternalBytesLike(imageBits)) {
-			    dstPtr = __externalBytesAddress(imageBits);
-			}
-		    }
-
-		    if (__bothSmallInteger(__INST(height), __INST(width))
-		     && __isArrayLike(colorValues)
-		     && srcPtr
-		     && dstPtr) {
-			int x, y, w, h, nPix;
-			int r,p;
-
-			OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
-
-			w = __intVal(__INST(width));
-			h = __intVal(__INST(height));
-			r = w;
-			p = __intVal(padd);
-
-			nPix = w * h;
-			while (nPix > 0) {
-			    unsigned idx, v;
-			    OBJ clr;
-
-			    idx = *srcPtr;
-			    clr = ap[idx];
-			    v = __intVal(clr);
-
-			    dstPtr[0] = (v>>16) & 0xFF;
-			    dstPtr[1] = (v>>8) & 0xFF;
-			    dstPtr[2] = (v) & 0xFF;
-
-			    dstPtr += 3;
-			    srcPtr += 1;
-			    nPix--;
-			    if (--r == 0) {
-			      dstPtr += p;
-			      r = w;
-			    }
-			}
-		    }
+                    unsigned char *srcPtr = 0;
+                    unsigned char *dstPtr = 0;
+                    OBJ _bytes = __INST(bytes);
+
+                    if (__isByteArrayLike(_bytes)) {
+                        srcPtr = __ByteArrayInstPtr(_bytes)->ba_element;
+                    } else {
+                        if (__isExternalBytesLike(_bytes)) {
+                            srcPtr = __externalBytesAddress(_bytes);
+                        }
+                    }
+                    if (__isByteArray(imageBits)) {
+                        dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+                    } else {
+                        if (__isExternalBytesLike(imageBits)) {
+                            dstPtr = __externalBytesAddress(imageBits);
+                        }
+                    }
+
+                    if (__bothSmallInteger(__INST(height), __INST(width))
+                     && __isArrayLike(colorValues)
+                     && srcPtr
+                     && dstPtr) {
+                        int x, y, w, h, nPix;
+                        int r,p;
+
+                        OBJ *ap = __ArrayInstPtr(colorValues)->a_element;
+
+                        w = __intVal(__INST(width));
+                        h = __intVal(__INST(height));
+                        r = w;
+                        p = __intVal(padd);
+
+                        nPix = w * h;
+                        while (nPix > 0) {
+                            unsigned idx, v;
+                            OBJ clr;
+
+                            idx = *srcPtr;
+                            clr = ap[idx];
+                            v = __intVal(clr);
+
+                            dstPtr[0] = (v>>16) & 0xFF;
+                            dstPtr[1] = (v>>8) & 0xFF;
+                            dstPtr[2] = (v) & 0xFF;
+
+                            dstPtr += 3;
+                            srcPtr += 1;
+                            nPix--;
+                            if (--r == 0) {
+                              dstPtr += p;
+                              r = w;
+                            }
+                        }
+                    }
 %}.
-		]
-	    ]
-	]
+                ]
+            ]
+        ]
     ].
 
     imageBits isNil ifTrue:[
-	'Image [warning]: unimplemented trueColor depth in paletteImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
-	^ self asMonochromeFormOn:aDevice
+        'Image [warning]: unimplemented trueColor depth in paletteImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
+        ^ self asMonochromeFormOn:aDevice
     ].
 
-    form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
+    form := Form imageForm width:width height:height depth:usedDeviceDepth onDevice:aDevice.
     form isNil ifTrue:[^ nil].
     form initGC.
 
     form
-	copyBitsFrom:imageBits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:usedDevicePadding
-	width:width height:height
-	x:0 y:0
-	toX:0 y:0.
+        copyBitsFrom:imageBits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:usedDevicePadding
+        width:width height:height
+        x:0 y:0
+        toX:0 y:0.
 
     ^ form
 
@@ -2012,6 +2013,137 @@
 
 !Depth8Image methodsFor:'image manipulations'!
 
+easyRotateBitsInto:destinationImage angle:degrees
+    "tuned helper for rotation - does the actual pixel shuffling, by degrees clockwise. 
+     Here, only 90, 180 and 270 degrees are implemented. 
+     Hard angles are done in #hardRotate:.
+     The code here a tuned version of the inherited for more performance"
+
+    |srcBytesPerRow dstBytesPerRow
+     srcWidth srcHeight
+     dstWidth dstHeight
+     srcBytes dstBytes|
+
+    srcBytesPerRow := self bytesPerRow.
+    srcBytes := self bits.
+    srcWidth := width.
+    srcHeight := height.
+
+    dstBytesPerRow := destinationImage bytesPerRow.
+    dstBytes := destinationImage bits.
+    dstWidth := destinationImage width.
+    dstHeight := destinationImage height.
+%{
+    if (__bothSmallInteger(srcWidth, srcHeight)
+     && __bothSmallInteger(dstWidth, dstHeight)
+     && __bothSmallInteger(dstBytesPerRow, srcBytesPerRow)
+     && __isByteArrayLike(srcBytes)
+     && __isByteArrayLike(dstBytes)
+    ) {
+        int c_srcW = __intVal(srcWidth);
+        int c_srcH = __intVal(srcHeight);
+        int c_dstW = __intVal(dstWidth);
+        int c_dstH = __intVal(dstHeight);
+        int c_srcBytesPerRow = __intVal(srcBytesPerRow);
+        int c_dstBytesPerRow = __intVal(dstBytesPerRow);
+        int c_srcW4 = c_srcW-4;
+        
+        {
+            unsigned char *c_srcBytes = (unsigned char*)__ByteArrayInstPtr(srcBytes)->ba_element;
+            unsigned char *c_dstBytes = (unsigned char*)__ByteArrayInstPtr(dstBytes)->ba_element;
+
+            int c_dstNextRowOffset;
+            int c_dstNextColOffset;
+
+            if (degrees == __mkSmallInteger(90)) {
+                // destinationImage pixelAtX:(h-row) y:col put:pixel
+                c_dstNextRowOffset = -1;                                // going to previous column
+                c_dstNextColOffset = c_dstBytesPerRow;                  // going to next row
+                c_dstBytes += (c_dstW-1);                               // start in the upper-right of dest
+            } else if (degrees == __mkSmallInteger(180)) {
+                // destinationImage pixelAtX:(w-col) y:(h-row) put:pixel
+                c_dstNextRowOffset = -c_dstBytesPerRow;                 // going to previous row
+                c_dstNextColOffset = -1;                                // going to prev col
+                c_dstBytes += (c_dstH-1)*c_dstBytesPerRow+(c_dstW-1);   // start in the lower-right of dest
+            } else {
+                // destinationImage pixelAtX:row y:(w-col) put:pixel
+                c_dstNextRowOffset = 1;                                 // going to next col
+                c_dstNextColOffset = -c_dstBytesPerRow;                 // going to prev row
+                c_dstBytes += (c_dstH-1)*c_dstBytesPerRow;              // start in the lower-left of dest
+            }
+
+            if ((c_srcBytesPerRow * c_srcH) <= __byteArraySize(srcBytes)) {
+                int c_y;
+
+                for (c_y=0; c_y<c_srcH; c_y++) {
+                    unsigned char *c_srcNext = c_srcBytes + c_srcBytesPerRow;
+                    unsigned char *c_dstNext = c_dstBytes + c_dstNextRowOffset;
+                    int c_x;
+
+                    c_x = 0;    
+#if 1
+                    if (sizeof(int) == 4) {
+                        for (c_x = 0; c_x < c_srcW4; c_x += 4) {
+                            int c_value;
+
+                            c_value = ((int *)c_srcBytes)[0];
+
+                            c_dstBytes[0] = (c_value) & 0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_dstBytes[0] = (c_value>>8) & 0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_dstBytes[0] = (c_value>>16) & 0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_dstBytes[0] = (c_value>>24) & 0xFF;
+                            c_dstBytes += c_dstNextColOffset;
+
+                            c_srcBytes += 4;
+                        }
+                    }
+#endif
+                    for (; c_x < c_srcW; c_x++) {
+                        int c_value;
+
+                        c_value = c_srcBytes[0];
+                        c_dstBytes[0] = c_value;
+
+                        c_srcBytes++;
+                        c_dstBytes += c_dstNextColOffset;
+                    }
+                    c_srcBytes = c_srcNext;
+                    c_dstBytes = c_dstNext;
+                }
+                RETURN(self);
+            }
+        }
+    }
+%}.
+    self breakPoint:#cg.
+    super easyRotateBitsInto:destinationImage angle:degrees
+
+    "
+     |i|
+
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     i inspect.
+     (i rotated:45) inspect.
+     (i rotated:90) inspect.
+     (i rotated:180) inspect.
+     (i rotated:270) inspect.
+    "
+    "
+     |i|
+
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     Time millisecondsToRun:[
+        1000 timesRepeat:[ (i rotated:90) ].
+     ]
+    "
+!
+
 hardMagnifiedBy:scalePoint
     "return a new image magnified by scalePoint, aPoint.
      This is the general magnification method, handling non-integral values"
--- a/DeviceGraphicsContext.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/DeviceGraphicsContext.st	Fri Sep 02 17:42:18 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -226,14 +228,6 @@
     ].
 !
 
-basicFont
-    "return the font for drawing"
-
-    ^ font
-
-    "Created: 12.5.1996 / 11:17:59 / cg"
-!
-
 basicFont:aFont
     "set the font for drawing if it has changed.
      This is a low level entry, which is not to be redefined
@@ -460,6 +454,16 @@
     ^ clipRect
 !
 
+deviceFont
+    "return the font for drawing - here, a device font is returned if
+     the GC is realized."
+
+    (device notNil and:[font notNil]) ifTrue:[
+        font := font onDevice:device
+    ].
+    ^ font
+!
+
 drawableId
     ^drawableId
 
@@ -478,9 +482,7 @@
 !
 
 font:aFont
-    "set the font for drawing if it has changed.
-     This should be redefined in some widget to perform an automatic
-     redraw. See also: #basicFont:"
+    "set the font for drawing if it has changed."
 
     (aFont ~~ font) ifTrue:[
         self basicFont:aFont.
@@ -2748,7 +2750,8 @@
         deviceFont := fontUsed.
     ].
 
-    aString isPlainString ifFalse:[
+    (aString notNil 
+    and:[aString isPlainString not]) ifTrue:[
         "
          hook for non-strings (i.e. attributed text)
          that 'thing' should know how to display itself ...
--- a/Form.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Form.st	Fri Sep 02 17:42:18 2016 +0100
@@ -470,6 +470,12 @@
     "Created: / 07-06-2016 / 12:01:53 / cg"
 ! !
 
+!Form class methodsFor:'accessing private classes'!
+
+imageForm
+    ^ ImageForm
+! !
+
 !Form class methodsFor:'cleanup'!
 
 lowSpaceCleanup
@@ -1326,9 +1332,9 @@
 
     "black is 0 in mask - masked bits are 0"
     gc
-	foreground:Color allColor background:Color noColor;
-	function:#and;
-	copyPlaneFrom:maskForm x:0 y:0 toX:0 y:0 width:width height:height.
+        foreground:Color allColor background:Color noColor;
+        function:#and;
+        copyPlaneFrom:maskForm graphicsContext x:0 y:0 toX:0 y:0 width:width height:height.
 
     maskedPixelsAre0 := true.
 !
@@ -1638,6 +1644,15 @@
 
 !Form methodsFor:'printing & storing'!
 
+displayOn:aStreamOrGC
+    super displayOn:aStreamOrGC.
+    aStreamOrGC isStream ifTrue:[
+        aStreamOrGC nextPutAll:' (depth='.
+        depth printOn:aStreamOrGC.
+        aStreamOrGC nextPut:$).
+    ].
+!
+
 storeOn:aStream
     "append an ascii representation of the receiver to aStream,
      from which a copy of the receiver can be reconstructed"
@@ -1948,6 +1963,12 @@
 "
 ! !
 
+!Form::ImageForm methodsFor:'converting'!
+
+asImageForm
+    ^ self
+! !
+
 !Form::ImageForm methodsFor:'private'!
 
 getBits
--- a/GraphicsContext.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/GraphicsContext.st	Fri Sep 02 17:42:18 2016 +0100
@@ -691,6 +691,14 @@
     "Modified: 12.5.1996 / 22:25:17 / cg"
 !
 
+basicFont
+    "return the font for drawing"
+
+    ^ font
+
+    "Created: 12.5.1996 / 11:17:59 / cg"
+!
+
 blackColor
     "return the black color on this device.
      This is the same as 'Color black onDevice:self device', but much faster."
@@ -799,13 +807,6 @@
     "Modified: 28.5.1996 / 14:08:19 / cg"
 !
 
-createFontOnDevice
-    "make sure, that the font is a device font"
-
-    font := font onDevice:device.
-    ^ font.
-!
-
 dashStyle:aDashList offset:dashOffset
     "define dashes. Each element of the dashList specifies the length
      of a corresponding dash. For example, setting it to [4 4]
--- a/GraphicsMedium.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/GraphicsMedium.st	Fri Sep 02 17:42:18 2016 +0100
@@ -782,6 +782,12 @@
     gc deviceClippingBounds:aRectangleOrNil
 !
 
+deviceFont
+    "return the current drawing font as a device font"
+
+    ^ self font onDevice:device.
+!
+
 drawableId
     "return the id of the drawable on the device"
 
@@ -816,7 +822,7 @@
      This should be redefined in some widget to perform an automatic
      redraw. See also: #basicFont:"
 
-    gc font:aFont.
+    gc basicFont:aFont.
     self changed:#font.
 !
 
--- a/Image.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/Image.st	Fri Sep 02 17:42:18 2016 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -34,7 +34,7 @@
 copyright
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -268,432 +268,440 @@
 examples
 "
     reading from a file (many formats are supported):
-    (notice, that the bitmaps directory is searched for along
+    (notice that the bitmaps directory is searched for along
      the system path - therefore, you may add your own bitmap
      directory to the beginning of the path and thus override
      any default bitmaps, or make certain that your application
      finds its bitmaps - even if they are in a separate directory)
 
-											[exBegin]
-	(Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') inspect
-											[exEnd]
-
+                                                                                        [exBegin]
+        (Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') inspect
+                                                                                        [exEnd]
+    Boy, was I young, when writing ST/X... ;-)                                                                                                 
+                                                                                        [exBegin]
+        (Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif') inspect
+        ((Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif') rotated:90) inspect
+        ((Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif') rotated:45) inspect
+        ((Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif') rotated:25) inspect
+                                                                                        [exEnd]
+
+                                                                                        
     better use package relative file names:
-											[exBegin]
-	(Image fromFile:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies') inspect
-											[exEnd]
+                                                                                        [exBegin]
+        (Image fromFile:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies') inspect
+                                                                                        [exEnd]
     various file formats are supported:
-											[exBegin]
-	(Image fromFile:'bitmaps/xpmBitmaps/misc_icons/SmalltalkX_clr.xpm' inPackage:'stx:goodies') inspect
-											[exEnd]
-											[exBegin]
-	(Image fromFile:'bitmaps/winBitmaps/okSmily_up.bmp' inPackage:'stx:goodies') inspect
-											[exEnd]
+                                                                                        [exBegin]
+        (Image fromFile:'bitmaps/xpmBitmaps/misc_icons/SmalltalkX_clr.xpm' inPackage:'stx:goodies') inspect
+                                                                                        [exEnd]
+                                                                                        [exBegin]
+        (Image fromFile:'bitmaps/winBitmaps/okSmily_up.bmp' inPackage:'stx:goodies') inspect
+                                                                                        [exEnd]
 
     drawing
-											[exBegin]
-	|imageClass image|
-
-	imageClass := Image implementorForDepth:24.
-	image      := imageClass width: 100 height: 50.
-	image bits:(ByteArray new:(image bytesPerRow*50)).
-	image fillRectangle:(0@0 extent:100@50) withColor:Color yellow.
-	image drawRectangle:(10@10 extent:20@20) withColor:Color red.
-	image fillRectangle:(40@20 extent:20@20) withColor:Color green.
-											[exEnd]
+                                                                                        [exBegin]
+        |imageClass image|
+
+        imageClass := Image implementorForDepth:24.
+        image      := imageClass width: 100 height: 50.
+        image bits:(ByteArray new:(image bytesPerRow*50)).
+        image fillRectangle:(0@0 extent:100@50) withColor:Color yellow.
+        image drawRectangle:(10@10 extent:20@20) withColor:Color red.
+        image fillRectangle:(40@20 extent:20@20) withColor:Color green.
+                                                                                        [exEnd]
 
     The following examples demonstrate various depth and colorMap variations ...
 
     inline image:
       default: depth=1 & #blackIs0
-									[exBegin]
-	(Image
-	    width:8 height:8
-	    fromArray:#( 2r11111111
-			 2r10000001
-			 2r10000001
-			 2r10000001
-			 2r10000001
-			 2r10000001
-			 2r10000001
-			 2r11111111 )
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        (Image
+            width:8 height:8
+            fromArray:#( 2r11111111
+                         2r10000001
+                         2r10000001
+                         2r10000001
+                         2r10000001
+                         2r10000001
+                         2r10000001
+                         2r11111111 )
+        ) edit
+                                                                        [exEnd]
 
       with #whiteIs0 photometric
-									[exBegin]
-	((Image width:8 height:8
-	       fromArray:#( 2r11111111
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r11111111 ))
-	    photometric:#whiteIs0
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Image width:8 height:8
+               fromArray:#( 2r11111111
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r11111111 ))
+            photometric:#whiteIs0
+        ) edit
+                                                                        [exEnd]
 
       with a colorMap
-									[exBegin]
-	((Image width:8 height:8
-	       fromArray:#( 2r11111111
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r10000001
-			    2r11111111 ))
-	    colorMap:(Array with:(Color red)
-			    with:(Color yellow))
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Image width:8 height:8
+               fromArray:#( 2r11111111
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r10000001
+                            2r11111111 ))
+            colorMap:(Array with:(Color red)
+                            with:(Color yellow))
+        ) edit
+                                                                        [exEnd]
 
       a depth4 greyScale image:
       (default photometric is #blackIs0)
-									[exBegin]
-	(Depth4Image
-	     width:8
-	     height:4
-	     fromArray:#[
-			    16r00 16r11 16r22 16r33
-			    16r44 16r55 16r66 16r77
-			    16r88 16r99 16raa 16rbb
-			    16rcc 16rdd 16ree 16rff
-			]
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        (Depth4Image
+             width:8
+             height:4
+             fromArray:#[
+                            16r00 16r11 16r22 16r33
+                            16r44 16r55 16r66 16r77
+                            16r88 16r99 16raa 16rbb
+                            16rcc 16rdd 16ree 16rff
+                        ]
+        ) edit
+                                                                        [exEnd]
       the same, magnified:
-									[exBegin]
-	((Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			])
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth4Image
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ])
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
       the following has the same effect:
-									[exBegin]
-	((Image
-	     width:4
-	     height:4
-	     depth:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			])
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Image
+             width:4
+             height:4
+             depth:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ])
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
       with reverse grey-interpretation:
-									[exBegin]
-	((Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			])
-	    photometric:#whiteIs0;
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth4Image
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ])
+            photometric:#whiteIs0;
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       with 1-bit-per-pixel rgb interpretation:
-									[exBegin]
-	((Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			])
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(1 1 1);
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth4Image
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ])
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(1 1 1);
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       with 1/2/1 rgb interpretation:
-									[exBegin]
-	((Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			])
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(1 2 1);
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth4Image
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ])
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(1 2 1);
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       a 2/2/0 rgb image (i.e. no blue):
-									[exBegin]
-	 |i|
-
-	 i := Depth4Image
-		    width:4
-		    height:4
-		    fromArray:#[ 16r01 16r23
-				 16r45 16r67
-				 16r89 16rab
-				 16rcd 16ref ].
-	 i photometric:#rgb.
-	 i samplesPerPixel:3.
-	 i bitsPerSample:#(2 2 0).
-
-	 i := i magnifiedBy:30.
-	 i edit.
-									[exEnd]
+                                                                        [exBegin]
+         |i|
+
+         i := Depth4Image
+                    width:4
+                    height:4
+                    fromArray:#[ 16r01 16r23
+                                 16r45 16r67
+                                 16r89 16rab
+                                 16rcd 16ref ].
+         i photometric:#rgb.
+         i samplesPerPixel:3.
+         i bitsPerSample:#(2 2 0).
+
+         i := i magnifiedBy:30.
+         i edit.
+                                                                        [exEnd]
 
 
       a 0/0/4 rgb image (i.e. no red or green):
-									[exBegin]
-	 |i|
-
-	 i := Depth4Image
-		    width:4
-		    height:4
-		    fromArray:#[ 16r01 16r23
-				 16r45 16r67
-				 16r89 16rab
-				 16rcd 16ref ].
-	 i photometric:#rgb.
-	 i samplesPerPixel:3.
-	 i bitsPerSample:#(0 0 4).
-
-	 i := i magnifiedBy:30.
-	 i edit.
-									[exEnd]
+                                                                        [exBegin]
+         |i|
+
+         i := Depth4Image
+                    width:4
+                    height:4
+                    fromArray:#[ 16r01 16r23
+                                 16r45 16r67
+                                 16r89 16rab
+                                 16rcd 16ref ].
+         i photometric:#rgb.
+         i samplesPerPixel:3.
+         i bitsPerSample:#(0 0 4).
+
+         i := i magnifiedBy:30.
+         i edit.
+                                                                        [exEnd]
 
 
       a 2plane greyscale image:
-									[exBegin]
-	((Depth2Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    4r0123
-			    4r1230
-			    4r2301
-			    4r3012
-			])
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth2Image
+             width:4
+             height:4
+             fromArray:#[
+                            4r0123
+                            4r1230
+                            4r2301
+                            4r3012
+                        ])
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       with colors:
-									[exBegin]
-	((Depth2Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    4r0123
-			    4r1230
-			    4r2301
-			    4r3012
-			])
-	    colorMap:(Array with:(Color black)
-			    with:(Color red)
-			    with:(Color green)
-			    with:(Color blue));
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth2Image
+             width:4
+             height:4
+             fromArray:#[
+                            4r0123
+                            4r1230
+                            4r2301
+                            4r3012
+                        ])
+            colorMap:(Array with:(Color black)
+                            with:(Color red)
+                            with:(Color green)
+                            with:(Color blue));
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       depth8 image with 3/3/2 rgb interpretation:
-									[exBegin]
-	((Depth8Image
-	     width:16
-	     height:16
-	     fromArray:(ByteArray withAll:(0 to:16rFF)))
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(3 3 2);
-	    magnifiedBy:10
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth8Image
+             width:16
+             height:16
+             fromArray:(ByteArray withAll:(0 to:16rFF)))
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(3 3 2);
+            magnifiedBy:10
+        ) edit
+                                                                        [exEnd]
 
       depth8 image with 2/2/2 rgb interpretation:
-									[exBegin]
-	((Depth8Image
-	     width:8
-	     height:8
-	     fromArray:(ByteArray withAll:(0 to:16r3F)))
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(2 2 2);
-	    magnifiedBy:10
-	) edit
-									[exEnd]
-
-									[exBegin]
-	((Depth8Image
-	     width:4
-	     height:4
-	     fromArray:#[
-		    16r30 16r0C  16r03 16r3F
-		    16r20 16r08  16r02 16r2A
-		    16r10 16r04  16r01 16r15
-		    16r00 16r00  16r00 16r00
-			])
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(2 2 2);
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth8Image
+             width:8
+             height:8
+             fromArray:(ByteArray withAll:(0 to:16r3F)))
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(2 2 2);
+            magnifiedBy:10
+        ) edit
+                                                                        [exEnd]
+
+                                                                        [exBegin]
+        ((Depth8Image
+             width:4
+             height:4
+             fromArray:#[
+                    16r30 16r0C  16r03 16r3F
+                    16r20 16r08  16r02 16r2A
+                    16r10 16r04  16r01 16r15
+                    16r00 16r00  16r00 16r00
+                        ])
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(2 2 2);
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       trueColor image: remember: bytes are MSB
-									[exBegin]
-	((Depth16Image
-	     width:4
-	     height:5
-	     fromArray:#[
-		    2r01111100 2r00000000  2r00000011 2r11100000  2r00000000 2r00011111  2r01111111 2r11111111
-		    2r00111100 2r00000000  2r00000001 2r11100000  2r00000000 2r00001111  2r00111101 2r11101111
-		    2r00011100 2r00000000  2r00000000 2r11100000  2r00000000 2r00000111  2r00011100 2r11100111
-		    2r00001100 2r00000000  2r00000000 2r01100000  2r00000000 2r00000001  2r00001100 2r01100011
-		    2r00000100 2r00000000  2r00000000 2r00100000  2r00000000 2r00000001  2r00000100 2r00100001
-			])
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(5 5 5);
-	    magnifiedBy:30
-	) edit
-									[exEnd]
-
-									[exBegin]
-	((Depth24Image
-	     width:4
-	     height:4
-	     fromArray:#[
-		    16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
-		    16r00 16rFF 16r00  16r00 16rFF 16r00  16r00 16rFF 16r00  16r00 16rFF 16r00
-		    16r00 16r00 16rFF  16r00 16r00 16rFF  16r00 16r00 16rFF  16r00 16r00 16rFF
-		    16rFF 16rFF 16rFF  16rFF 16rFF 16rFF  16rFF 16rFF 16rFF  16rFF 16rFF 16rFF
-			])
-	    photometric:#rgb;
-	    samplesPerPixel:3;
-	    bitsPerSample:#(8 8 8);
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth16Image
+             width:4
+             height:5
+             fromArray:#[
+                    2r01111100 2r00000000  2r00000011 2r11100000  2r00000000 2r00011111  2r01111111 2r11111111
+                    2r00111100 2r00000000  2r00000001 2r11100000  2r00000000 2r00001111  2r00111101 2r11101111
+                    2r00011100 2r00000000  2r00000000 2r11100000  2r00000000 2r00000111  2r00011100 2r11100111
+                    2r00001100 2r00000000  2r00000000 2r01100000  2r00000000 2r00000001  2r00001100 2r01100011
+                    2r00000100 2r00000000  2r00000000 2r00100000  2r00000000 2r00000001  2r00000100 2r00100001
+                        ])
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(5 5 5);
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
+
+                                                                        [exBegin]
+        ((Depth24Image
+             width:4
+             height:4
+             fromArray:#[
+                    16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
+                    16r00 16rFF 16r00  16r00 16rFF 16r00  16r00 16rFF 16r00  16r00 16rFF 16r00
+                    16r00 16r00 16rFF  16r00 16r00 16rFF  16r00 16r00 16rFF  16r00 16r00 16rFF
+                    16rFF 16rFF 16rFF  16rFF 16rFF 16rFF  16rFF 16rFF 16rFF  16rFF 16rFF 16rFF
+                        ])
+            photometric:#rgb;
+            samplesPerPixel:3;
+            bitsPerSample:#(8 8 8);
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
       32bit trueColor image:
-									[exBegin]
-	((Depth32Image
-	     width:4
-	     height:4
-	     fromArray:#[
-		    16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00
-		    16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00
-		    16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00
-		    16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00
-			])
-	    photometric:#rgb;
-	    samplesPerPixel:4;
-	    bitsPerSample:#(8 8 8 8);
-	    magnifiedBy:30
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth32Image
+             width:4
+             height:4
+             fromArray:#[
+                    16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00
+                    16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00
+                    16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00
+                    16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00
+                        ])
+            photometric:#rgb;
+            samplesPerPixel:4;
+            bitsPerSample:#(8 8 8 8);
+            magnifiedBy:30
+        ) edit
+                                                                        [exEnd]
 
     storing - only a subset of formats (TIFF, XBM, XPM) currently support storing:
-									[exBegin]
-	|img|
-
-	img := Image fromFile:'bitmaps/winBitmaps/okSmily_up.bmp' inPackage:'stx:goodies'.
-	img saveOn:'myImage.tiff'.
-	(Image fromFile:'myImage.tiff') inspect.
-	img saveOn:'myImage.gif'.
-	(Image fromFile:'myImage.gif') inspect.
-									[exEnd]
+                                                                        [exBegin]
+        |img|
+
+        img := Image fromFile:'bitmaps/winBitmaps/okSmily_up.bmp' inPackage:'stx:goodies'.
+        img saveOn:'myImage.tiff'.
+        (Image fromFile:'myImage.tiff') inspect.
+        img saveOn:'myImage.gif'.
+        (Image fromFile:'myImage.gif') inspect.
+                                                                        [exEnd]
 
     magnifying (any factor):
-									[exBegin]
-	((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
-	    magnifiedTo:(48@48))
-		inspect
-									[exEnd]
-									[exBegin]
-	((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
-	    magnifiedBy:0.7)
-		inspect
-									[exEnd]
+                                                                        [exBegin]
+        ((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
+            magnifiedTo:(48@48))
+                inspect
+                                                                        [exEnd]
+                                                                        [exBegin]
+        ((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
+            magnifiedBy:0.7)
+                inspect
+                                                                        [exEnd]
 
     rotating (any angle in degrees clockwise):
-									[exBegin]
-	((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
-	    rotated:90)
-		inspect
-									[exEnd]
-									[exBegin]
-	(((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
-	    magnifiedBy:0.3@0.7) rotated:270)
-		inspect
-									[exEnd]
-									[exBegin]
-	(((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
-	    ) rotated:30)
-		inspect
-									[exEnd]
+                                                                        [exBegin]
+        ((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
+            rotated:90)
+                inspect
+                                                                        [exEnd]
+                                                                        [exBegin]
+        (((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
+            magnifiedBy:0.3@0.7) rotated:270)
+                inspect
+                                                                        [exEnd]
+                                                                        [exBegin]
+        (((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
+            ) rotated:30)
+                inspect
+                                                                        [exEnd]
     negative:
-									[exBegin]
-	((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
-	    negative)
-		inspect
-									[exEnd]
+                                                                        [exBegin]
+        ((Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies')
+            negative)
+                inspect
+                                                                        [exEnd]
 
       depth32 image with 8+8+8+8 argb interpretation:
-									[exBegin]
-	((Depth32Image
-	     width:4 height:4
-	     fromArray:#[
-		255 255 0 0       255 255 0 0       255 255 0 0       255 255 0 0
-		255 0 255 0       255 0 255 0       255 0 255 0       255 0 255 0
-		255 0 0 255       255 0 0 255       255 0 0 255       255 0 0 255
-		255 255 255 255   255 255 255 255   255 255 255 255   255 255 255 255 ])
-	    photometric:#argb;
-	    samplesPerPixel:4;
-	    bitsPerSample:#(8 8 8 8);
-	    magnifiedBy:10
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth32Image
+             width:4 height:4
+             fromArray:#[
+                255 255 0 0       255 255 0 0       255 255 0 0       255 255 0 0
+                255 0 255 0       255 0 255 0       255 0 255 0       255 0 255 0
+                255 0 0 255       255 0 0 255       255 0 0 255       255 0 0 255
+                255 255 255 255   255 255 255 255   255 255 255 255   255 255 255 255 ])
+            photometric:#argb;
+            samplesPerPixel:4;
+            bitsPerSample:#(8 8 8 8);
+            magnifiedBy:10
+        ) edit
+                                                                        [exEnd]
 
       depth32 image with 8+8+8+8 rgba interpretation:
-									[exBegin]
-	((Depth32Image
-	     width:4 height:4
-	     fromArray:#[
-		255 0 0 255       255 0 0 255       255 0 0 255       255 0 0 255
-		0 255 0 255       0 255 0 255       0 255 0 255       0 255 0 255
-		0 0 255 255       0 0 255 255       0 0 255 255       0 0 255 255
-		255 255 255 255   255 255 255 255   255 255 255 255   255 255 255 255 ])
-	    photometric:#rgba;
-	    samplesPerPixel:4;
-	    bitsPerSample:#(8 8 8 8);
-	    magnifiedBy:10
-	) edit
-									[exEnd]
+                                                                        [exBegin]
+        ((Depth32Image
+             width:4 height:4
+             fromArray:#[
+                255 0 0 255       255 0 0 255       255 0 0 255       255 0 0 255
+                0 255 0 255       0 255 0 255       0 255 0 255       0 255 0 255
+                0 0 255 255       0 0 255 255       0 0 255 255       0 0 255 255
+                255 255 255 255   255 255 255 255   255 255 255 255   255 255 255 255 ])
+            photometric:#rgba;
+            samplesPerPixel:4;
+            bitsPerSample:#(8 8 8 8);
+            magnifiedBy:10
+        ) edit
+                                                                        [exEnd]
 "
 !
 
@@ -703,56 +711,56 @@
     These have no underyling pixelstorage, but instead compute the pixel-value via a block.
 
     Plain x/y mapping:
-									[exBegin]
-	|i|
-	i := Depth1Image extent:256@256.
-	i pixelFunction:[:x :y | ((x // 16) bitXor:(y // 16)) odd ifTrue:1 ifFalse:[0]].
-	i inspect.
-									[exEnd]
+                                                                        [exBegin]
+        |i|
+        i := Depth1Image extent:256@256.
+        i pixelFunction:[:x :y | ((x // 16) bitXor:(y // 16)) odd ifTrue:1 ifFalse:[0]].
+        i inspect.
+                                                                        [exEnd]
     Transformed x/y mapping:
-									[exBegin]
-	|i f|
-	f := [:x :y | (x between:0.4 and:0.6) asInteger].
-	i := Depth1Image extent:256@256.
-	i pixelFunction:f inX:(0.0 to:1.0) y:(0.0 to:1.0).
-	i inspect.
-									[exEnd]
-									[exBegin]
-	|i f|
-	f := [:x :y | ((x between:0.4 and:0.6) or:[(y between:0.4 and:0.6)]) asInteger].
-	i := Depth1Image extent:256@256.
-	i pixelFunction:f inX:(0.0 to:1.0) y:(0.0 to:1.0).
-	i inspect.
-									[exEnd]
+                                                                        [exBegin]
+        |i f|
+        f := [:x :y | (x between:0.4 and:0.6) asInteger].
+        i := Depth1Image extent:256@256.
+        i pixelFunction:f inX:(0.0 to:1.0) y:(0.0 to:1.0).
+        i inspect.
+                                                                        [exEnd]
+                                                                        [exBegin]
+        |i f|
+        f := [:x :y | ((x between:0.4 and:0.6) or:[(y between:0.4 and:0.6)]) asInteger].
+        i := Depth1Image extent:256@256.
+        i pixelFunction:f inX:(0.0 to:1.0) y:(0.0 to:1.0).
+        i inspect.
+                                                                        [exEnd]
     Image based on polar coordinate:
-									[exBegin]
-	|i f|
-	f := [:x :y | ((x@y) r * 10) asInteger bitAnd:1].
-	i := Depth1Image extent:256@256.
-	i pixelFunction:f inX:(-1.0 to:1.0) y:(-1.0 to:1.0).
-	i inspect.
-									[exEnd]
+                                                                        [exBegin]
+        |i f|
+        f := [:x :y | ((x@y) r * 10) asInteger bitAnd:1].
+        i := Depth1Image extent:256@256.
+        i pixelFunction:f inX:(-1.0 to:1.0) y:(-1.0 to:1.0).
+        i inspect.
+                                                                        [exEnd]
     Grayscale image based on polar coordinate:
-									[exBegin]
-	|i|
-	i := Depth8Image extent:256@256.
-	i photometric:#blackIs0.
-	i pixelFunction:[:x :y | ((x@y) r * 255) truncated min:255] inX:(-1 to:1) y:(-1 to:1).
-	i inspect.
-									[exEnd]
+                                                                        [exBegin]
+        |i|
+        i := Depth8Image extent:256@256.
+        i photometric:#blackIs0.
+        i pixelFunction:[:x :y | ((x@y) r * 255) truncated min:255] inX:(-1 to:1) y:(-1 to:1).
+        i inspect.
+                                                                        [exEnd]
 
     Taking another image as ''input''
-									[exBegin]
-	|garfield f i h|
-
-	garfield := Image fromFile:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'.
-	h := garfield height.
-	f := [:x :y | (garfield colorAtX:x y:h-y) rgbValue].
-
-	i := Depth24Image extent:garfield extent.
-	i pixelFunction:f.
-	i inspect.
-									[exEnd]
+                                                                        [exBegin]
+        |garfield f i h|
+
+        garfield := Image fromFile:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'.
+        h := garfield height.
+        f := [:x :y | (garfield colorAtX:x y:h-y) rgbValue].
+
+        i := Depth24Image extent:garfield extent.
+        i pixelFunction:f.
+        i inspect.
+                                                                        [exEnd]
 "
 ! !
 
@@ -776,7 +784,7 @@
 
     self obsoleteMethodWarning.
     MIMETypes
-	defineImageType:mimeType suffix:aSuffix reader:aReaderClass
+        defineImageType:mimeType suffix:aSuffix reader:aReaderClass
 
     "
      Image addReader:GIFReader suffix:'gif'
@@ -803,7 +811,7 @@
     "simply release all deviceForms"
 
     Lobby do:[:anImage |
-	anImage release
+        anImage release
     ]
 
     "Modified: 15.6.1996 / 15:45:02 / cg"
@@ -891,9 +899,9 @@
      see the 'smalltalk.rc'/'display.rc' startup files for a real (full) map."
 
     MIMETypes notNil ifTrue:[
-	MIMETypes imageReaderForSuffix:'xbm'  put:XBMReader.
-	MIMETypes imageReaderForSuffix:'tiff' put:TIFFReader.
-	MIMETypes imageReaderForSuffix:'gif'  put:GIFReader.
+        MIMETypes imageReaderForSuffix:'xbm'  put:XBMReader.
+        MIMETypes imageReaderForSuffix:'tiff' put:TIFFReader.
+        MIMETypes imageReaderForSuffix:'gif'  put:GIFReader.
     ].
 
     "
@@ -909,11 +917,11 @@
      see the 'smalltalk.rc'/'display.rc' startup files for a real (full) map."
 
     MIMETypes notNil ifTrue:[
-	MIMETypes mimeTypeForSuffix:'gif'       put:'image/gif'.
-	MIMETypes mimeTypeForSuffix:'tiff'      put:'image/tiff'.
-	MIMETypes mimeTypeForSuffix:'tif'       put:'image/tiff'.
-	MIMETypes mimeTypeForSuffix:'xbm'       put:'image/x-xbitmap'.
-	MIMETypes mimeTypeForSuffix:'xpm'       put:'image/x-xpixmap'.
+        MIMETypes mimeTypeForSuffix:'gif'       put:'image/gif'.
+        MIMETypes mimeTypeForSuffix:'tiff'      put:'image/tiff'.
+        MIMETypes mimeTypeForSuffix:'tif'       put:'image/tiff'.
+        MIMETypes mimeTypeForSuffix:'xbm'       put:'image/x-xbitmap'.
+        MIMETypes mimeTypeForSuffix:'xpm'       put:'image/x-xpixmap'.
     ].
 
     "
@@ -928,7 +936,7 @@
     "flush all device specific stuff when restarted from a snapshot"
 
     (something == #restarted) ifTrue:[
-	self flushDeviceImages
+        self flushDeviceImages
     ]
 
     "Created: 21.6.1996 / 19:47:43 / cg"
@@ -956,36 +964,36 @@
     ^ self extent:ext depth:d antiAliasedPalette:aBasicColorArray bgColor:bgColor mixedArray:#(1.0 0.8 0.6 0.4 0.2)
 
     "
-	|colorMap aaImgArray|
-
-	colorMap := Array with:Color white with:Color blue.
-
-	aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
-	aaImgArray last
-	    fillAntiAliasedArc:200@200
-	    radius:80
-	    from:0
-	    angle:360
-	    withColor:Color blue
-	    antiAliasedPalette:aaImgArray first
-	    startWith:aaImgArray second.
-
-	aaImgArray last inspect.
-
-
-	|colorMap aaImgArray|
-
-	colorMap := Array with:Color white with:Color black with:Color red with:Color blue.
-
-	aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
-	aaImgArray last fillAntiAliasedArc:205@195 radius:80 from:0 angle:90 withColor:Color red
-	    colorDictionary:aaImgArray first
-	    blendStart:aaImgArray second.
-	aaImgArray last fillAntiAliasedArc:200@200 radius:80 from:90 angle:270 withColor:Color blue
-	    colorDictionary:aaImgArray first
-	    blendStart:aaImgArray second.
-
-	aaImgArray last inspect.
+        |colorMap aaImgArray|
+
+        colorMap := Array with:Color white with:Color blue.
+
+        aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
+        aaImgArray last
+            fillAntiAliasedArc:200@200
+            radius:80
+            from:0
+            angle:360
+            withColor:Color blue
+            antiAliasedPalette:aaImgArray first
+            startWith:aaImgArray second.
+
+        aaImgArray last inspect.
+
+
+        |colorMap aaImgArray|
+
+        colorMap := Array with:Color white with:Color black with:Color red with:Color blue.
+
+        aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
+        aaImgArray last fillAntiAliasedArc:205@195 radius:80 from:0 angle:90 withColor:Color red
+            colorDictionary:aaImgArray first
+            blendStart:aaImgArray second.
+        aaImgArray last fillAntiAliasedArc:200@200 radius:80 from:90 angle:270 withColor:Color blue
+            colorDictionary:aaImgArray first
+            blendStart:aaImgArray second.
+
+        aaImgArray last inspect.
 
     "
 !
@@ -999,18 +1007,18 @@
     colorDictionary := Dictionary new.
 
     aBasicColorArray do:[:aColor |
-	colorMap add:aColor.
-	colorIndex := colorIndex + 1.
-
-	tmpDic := Dictionary new.
-
-	mixedArray do:[:aFloat |
-	    tmpDic at:aFloat put:colorIndex.
-	    colorMap add:(aColor mixed:aFloat with:bgColor).
-	    colorIndex := colorIndex + 1.
-	].
-
-	colorDictionary at:aColor put:tmpDic.
+        colorMap add:aColor.
+        colorIndex := colorIndex + 1.
+
+        tmpDic := Dictionary new.
+
+        mixedArray do:[:aFloat |
+            tmpDic at:aFloat put:colorIndex.
+            colorMap add:(aColor mixed:aFloat with:bgColor).
+            colorIndex := colorIndex + 1.
+        ].
+
+        colorDictionary at:aColor put:tmpDic.
     ].
 
     newImage := (self implementorForDepth:d) new.
@@ -1022,37 +1030,37 @@
     ^ Array with:colorDictionary with:mixedArray first with:newImage
 
     "
-	|colorMap aaImgArray|
-
-	colorMap := Array with:Color white with:Color black with:Color red with:Color blue.
-
-	aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
-	aaImgArray last fillAntiAliasedArc:205@195 radius:80 from:0 angle:90 withColor:Color red
-	    colorDictionary:aaImgArray first
-	    blendStart:aaImgArray second.
-	aaImgArray last fillAntiAliasedArc:200@200 radius:80 from:90 angle:270 withColor:Color blue
-	    colorDictionary:aaImgArray first
-	    blendStart:aaImgArray second.
-
-	aaImgArray last inspect.
+        |colorMap aaImgArray|
+
+        colorMap := Array with:Color white with:Color black with:Color red with:Color blue.
+
+        aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
+        aaImgArray last fillAntiAliasedArc:205@195 radius:80 from:0 angle:90 withColor:Color red
+            colorDictionary:aaImgArray first
+            blendStart:aaImgArray second.
+        aaImgArray last fillAntiAliasedArc:200@200 radius:80 from:90 angle:270 withColor:Color blue
+            colorDictionary:aaImgArray first
+            blendStart:aaImgArray second.
+
+        aaImgArray last inspect.
 
  ###################
 
-	|colorMap aaImgArray|
-
-	colorMap := Array with:Color white with:Color blue.
-
-	aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
-	aaImgArray last
-	    fillAntiAliasedArc:200@200
-	    radius:80
-	    from:0
-	    angle:360
-	    withColor:Color blue
-	    antiAliasedPalette:aaImgArray first
-	    startWith:aaImgArray second.
-
-	aaImgArray last inspect.
+        |colorMap aaImgArray|
+
+        colorMap := Array with:Color white with:Color blue.
+
+        aaImgArray := Depth8Image extent:300@400 depth:8 antiAliasedPalette:colorMap bgColor:Color white.
+        aaImgArray last
+            fillAntiAliasedArc:200@200
+            radius:80
+            from:0
+            angle:360
+            withColor:Color blue
+            antiAliasedPalette:aaImgArray first
+            startWith:aaImgArray second.
+
+        aaImgArray last inspect.
     "
 
     "Modified: / 02-11-2010 / 20:57:41 / cg"
@@ -1188,7 +1196,7 @@
 
     (self == Image
     or:[anImage class == self
-	and:[photometricOrNil isNil or:[photometricOrNil == anImage photometric]]]) ifTrue:[^ anImage].
+        and:[photometricOrNil isNil or:[photometricOrNil == anImage photometric]]]) ifTrue:[^ anImage].
     ^ self new fromImage:anImage photometric:photometricOrNil.
 
     "
@@ -1211,23 +1219,23 @@
     photometric := (depth > 8) ifTrue:#rgb ifFalse:#palette.
 
     (formsDevice notNil and:[depth == formsDevice depth]) ifTrue:[
-	"/
-	"/ for truecolor displays, return a Depth24Image
-	"/ (must do this for depth15 & depth16 displays, since
-	"/  Depth16Image has no way to specify r/g/b masks ...)
-	"/
-	vis := formsDevice visualType.
-	(vis == #TrueColor or:[vis == #DirectColor]) ifTrue:[
-	    depth > 8 ifTrue:[
-		depth := 24.
-	    ]
-	].
+        "/
+        "/ for truecolor displays, return a Depth24Image
+        "/ (must do this for depth15 & depth16 displays, since
+        "/  Depth16Image has no way to specify r/g/b masks ...)
+        "/
+        vis := formsDevice visualType.
+        (vis == #TrueColor or:[vis == #DirectColor]) ifTrue:[
+            depth > 8 ifTrue:[
+                depth := 24.
+            ]
+        ].
     ].
     img := self newForDepth:depth.
     img photometric:photometric.
 
     formsDevice isNil ifTrue:[
-	^ img from:aForm in:aRectangle.
+        ^ img from:aForm in:aRectangle.
     ].
     ^ img from:aForm in:aRectangle
 
@@ -1267,9 +1275,9 @@
     |cls|
 
     self == Image ifTrue:[
-	cls := (self implementorForDepth:anImage depth).
+        cls := (self implementorForDepth:anImage depth).
     ] ifFalse:[
-	cls := self.
+        cls := self.
     ].
     ^ cls new fromSubImage:anImage in:aRectangle.
 
@@ -1340,7 +1348,7 @@
 
     cls := self.
     cls == Image ifTrue:[
-	cls := self implementorForDepth:1
+        cls := self implementorForDepth:1
     ].
     ^ cls new width:w height:h
 
@@ -1351,7 +1359,7 @@
     "create a new image, given width, height and depth"
 
     ^ (self newForDepth:d)
-	width:w height:h depth:d
+        width:w height:h depth:d
 !
 
 width:w height:h depth:d fromArray:pixelData
@@ -1360,63 +1368,63 @@
      depth (8-bit padded)."
 
     ^ (self newForDepth:d)
-	width:w height:h depth:d fromArray:pixelData
+        width:w height:h depth:d fromArray:pixelData
 
     "
      Image width:8
-	   height:8
-	   depth:1
-	   fromArray:#[2r11001100
-		       2r00110011
-		       2r11001100
-		       2r00110011
-		       2r11001100
-		       2r00110011
-		       2r11001100
-		       2r00110011].
+           height:8
+           depth:1
+           fromArray:#[2r11001100
+                       2r00110011
+                       2r11001100
+                       2r00110011
+                       2r11001100
+                       2r00110011
+                       2r11001100
+                       2r00110011].
     "
 
     "
      Image width:8
-	   height:8
-	   depth:2
-	   fromArray:#[4r1100 4r1100
-		       4r0011 4r0011
-		       4r1100 4r1100
-		       4r0011 4r0011
-		       4r1100 4r1100
-		       4r0011 4r0011
-		       4r1100 4r1100
-		       4r0011 4r0011].
+           height:8
+           depth:2
+           fromArray:#[4r1100 4r1100
+                       4r0011 4r0011
+                       4r1100 4r1100
+                       4r0011 4r0011
+                       4r1100 4r1100
+                       4r0011 4r0011
+                       4r1100 4r1100
+                       4r0011 4r0011].
     "
 
     "
      Image width:8
-	   height:8
-	   depth:4
-	   fromArray:#[16r00 16r01 16rf0 16rf1
-		       16r02 16r03 16rf2 16rf3
-		       16r04 16r05 16rf4 16rf5
-		       16r06 16r07 16rf6 16rf7
-		       16r08 16r09 16rf8 16rf9
-		       16r0a 16r0b 16rfa 16rfb
-		       16r0c 16r0d 16rfc 16rfd
-		       16r0e 16r0f 16rfe 16rff].
+           height:8
+           depth:4
+           fromArray:#[16r00 16r01 16rf0 16rf1
+                       16r02 16r03 16rf2 16rf3
+                       16r04 16r05 16rf4 16rf5
+                       16r06 16r07 16rf6 16rf7
+                       16r08 16r09 16rf8 16rf9
+                       16r0a 16r0b 16rfa 16rfb
+                       16r0c 16r0d 16rfc 16rfd
+                       16r0e 16r0f 16rfe 16rff].
     "
 
     "
      Image width:8
-	   height:8
-	   depth:16
-	   fromArray:#(1 1 1 1 1 1 1 1
-		       2 2 2 2 2 2 2 2
-		       3 3 3 3 3 3 3 3
-		       4 4 4 4 4 4 4 4
-		       5 5 5 5 5 5 5 5
-		       6 6 6 6 6 6 6 6
-		       7 7 7 7 7 7 7 7
-		       8 8 8 8 8 8 8 8
-		      ) asWordArray.
+           height:8
+           depth:16
+           fromArray:#(1 1 1 1 1 1 1 1
+                       2 2 2 2 2 2 2 2
+                       3 3 3 3 3 3 3 3
+                       4 4 4 4 4 4 4 4
+                       5 5 5 5 5 5 5 5
+                       6 6 6 6 6 6 6 6
+                       7 7 7 7 7 7 7 7
+                       8 8 8 8 8 8 8 8
+                      ) asWordArray.
     "
 
     "Modified: 10.6.1996 / 18:18:10 / cg"
@@ -1440,30 +1448,30 @@
     dstRowBytes := img bytesPerRow.
 
     (padding ~~ 8 and:[(srcRowBytes \\ 4 ~~ 0) or:[srcRowBytes ~= dstRowBytes]]) ifTrue:[
-	"must repad; ST/X uses byte padding, while ST-80 uses longword
-	 padding. This is stupid, and may be changed in ST/X with future versions.
-	"
-	dstRowBytes := img bytesPerRow.
-
-	newBits := ByteArray uninitializedNew:(dstRowBytes * h).
-	srcIndex := 1.
-	dstIndex := 1.
-
-	1 to:h do:[:row |
-	    nextDstIndex := dstIndex + dstRowBytes.
-	    newBits replaceFrom:dstIndex
-			     to:(nextDstIndex - 1)
-			   with:pixelData
-		     startingAt:srcIndex.
-	    srcIndex := srcIndex + srcRowBytes.
-	    dstIndex := nextDstIndex.
-	].
+        "must repad; ST/X uses byte padding, while ST-80 uses longword
+         padding. This is stupid, and may be changed in ST/X with future versions.
+        "
+        dstRowBytes := img bytesPerRow.
+
+        newBits := ByteArray uninitializedNew:(dstRowBytes * h).
+        srcIndex := 1.
+        dstIndex := 1.
+
+        1 to:h do:[:row |
+            nextDstIndex := dstIndex + dstRowBytes.
+            newBits replaceFrom:dstIndex
+                             to:(nextDstIndex - 1)
+                           with:pixelData
+                     startingAt:srcIndex.
+            srcIndex := srcIndex + srcRowBytes.
+            dstIndex := nextDstIndex.
+        ].
     ] ifFalse:[
-	pixelData class isBytes ifFalse:[
-	    newBits := ByteArray withAll:pixelData
-	] ifTrue:[
-	    newBits := pixelData
-	]
+        pixelData class isBytes ifFalse:[
+            newBits := ByteArray withAll:pixelData
+        ] ifTrue:[
+            newBits := pixelData
+        ]
     ].
     img bits:newBits.
     ^ img
@@ -1481,29 +1489,29 @@
 
     cls := self.
     cls == Image ifTrue:[
-	cls := self implementorForDepth:1.
-	d := 1.
+        cls := self implementorForDepth:1.
+        d := 1.
     ] ifFalse:[
-	d := cls imageDepth
+        d := cls imageDepth
     ].
     anArray class isBytes ifFalse:[
-	pixels := ByteArray withAll:anArray
+        pixels := ByteArray withAll:anArray
     ] ifTrue:[
-	pixels := anArray
+        pixels := anArray
     ].
     ^ cls new width:w height:h depth:d fromArray:pixels
 
     "
      Image width:8
-	   height:8
-	   fromArray:#[2r11001100
-		       2r00110011
-		       2r11001100
-		       2r00110011
-		       2r11001100
-		       2r00110011
-		       2r11001100
-		       2r00110011].
+           height:8
+           fromArray:#[2r11001100
+                       2r00110011
+                       2r11001100
+                       2r00110011
+                       2r11001100
+                       2r00110011
+                       2r11001100
+                       2r00110011].
     "
 
     "Modified: 8.6.1996 / 10:07:26 / cg"
@@ -1517,7 +1525,7 @@
 
     cls := self.
     cls == Image ifTrue:[
-	cls := self implementorForDepth:1
+        cls := self implementorForDepth:1
     ].
     ^ cls new width:w height:h; photometric:photometric; yourself
 
@@ -1532,7 +1540,7 @@
 
     cls := self.
     cls == Image ifTrue:[
-	cls := self implementorForDepth:1
+        cls := self implementorForDepth:1
     ].
     ^ cls new width:w height:h; photometric:photometric; bitsPerSample:bitsPerSample; yourself
 
@@ -1642,15 +1650,15 @@
      to release all cached Images from that device"
 
     Lobby
-	unregisterAllForWhich:[:eachImage |
-	    |ok|
-
-	    ok := eachImage graphicsDevice == aDevice.
-	    ok ifTrue:[
-		eachImage releaseFromDevice
-	    ].
-	    ok
-	].
+        unregisterAllForWhich:[:eachImage |
+            |ok|
+
+            ok := eachImage graphicsDevice == aDevice.
+            ok ifTrue:[
+                eachImage releaseFromDevice
+            ].
+            ok
+        ].
 
     "
       self releaseResourcesOnDevice:Screen current
@@ -1681,19 +1689,19 @@
 
     fn := aFileName asFilename.
     fn isAbsolute ifFalse:[
-	inStream := Smalltalk systemFileStreamFor:fn.
-	inStream isNil ifTrue:[
-	    inStream := Smalltalk bitmapFileStreamFor:fn.
-	    inStream isNil ifTrue:[
-		"this signal is a query - if noone seems to care, return nil.
-		 However, a handler may provide a replacement image."
-		^ ImageNotFoundQuerySignal
-			    raiseRequestWith:fn
-			    errorString:('Image: ''' , fn pathName, ''' does not exist or is not readable').
-	    ].
-	].
-	fn := inStream pathName asFilename.
-	inStream close.
+        inStream := Smalltalk systemFileStreamFor:fn.
+        inStream isNil ifTrue:[
+            inStream := Smalltalk bitmapFileStreamFor:fn.
+            inStream isNil ifTrue:[
+                "this signal is a query - if noone seems to care, return nil.
+                 However, a handler may provide a replacement image."
+                ^ ImageNotFoundQuerySignal
+                            raiseRequestWith:fn
+                            errorString:('Image: ''' , fn pathName, ''' does not exist or is not readable').
+            ].
+        ].
+        fn := inStream pathName asFilename.
+        inStream close.
     ].
 
     nm := fn name.
@@ -1701,68 +1709,68 @@
 
     "handle compressed-suffix"
     (#('gz') includes:suffix) ifTrue:[
-	|baseFn|
-
-	baseFn := fn withoutSuffix.
-	nm := baseFn name.
-	suffix := baseFn suffix.
-	mustDecompress := true.
+        |baseFn|
+
+        baseFn := fn withoutSuffix.
+        nm := baseFn name.
+        suffix := baseFn suffix.
+        mustDecompress := true.
     ].
     suffix isEmpty ifTrue:[
-	suffix := nm.
+        suffix := nm.
     ].
 
     "get the imageReader class from the file's extension and ask it first"
     readerClass := MIMETypes imageReaderForSuffix:suffix.
     readerClass notNil ifTrue:[
-	mustDecompress == true ifTrue:[
-	    |zipStream|
-	    inStream := fn readStream.
-	    zipStream := ZipStream readOpenOn:inStream suppressHeaderAndChecksum:true.
-	    zipStream notNil ifTrue:[
-		[
-		    image := readerClass fromStream:zipStream.
-		] ensure:[
-		    zipStream close.
-		    inStream close.
-		].
-	    ]
-	] ifFalse:[
-	    BadImageFormatQuerySignal handle:[:ex |
-		BadImageFormatQuerySignal isHandled ifTrue:[ ex reject ].
-		Transcript showCR:(readersErrorMsg := ex description).
-		image := nil.
-		ex return.
-	    ] do:[
-		image := readerClass fromFile:fn.
-	    ].
-	].
-	image notNil ifTrue:[^ image].
+        mustDecompress == true ifTrue:[
+            |zipStream|
+            inStream := fn readStream.
+            zipStream := ZipStream readOpenOn:inStream suppressHeaderAndChecksum:true.
+            zipStream notNil ifTrue:[
+                [
+                    image := readerClass fromStream:zipStream.
+                ] ensure:[
+                    zipStream close.
+                    inStream close.
+                ].
+            ]
+        ] ifFalse:[
+            BadImageFormatQuerySignal handle:[:ex |
+                BadImageFormatQuerySignal isHandled ifTrue:[ ex reject ].
+                Transcript showCR:(readersErrorMsg := ex description).
+                image := nil.
+                ex return.
+            ] do:[
+                image := readerClass fromFile:fn.
+            ].
+        ].
+        image notNil ifTrue:[^ image].
     ].
 
     (readerClass isNil or:[readersErrorMsg notNil]) ifTrue:[
-	"no known extension (or wrong extension)
-	 - ask all readers if they know this format ...
-	 ... these look into the file, and investigate the header.
-	 therefore, it takes a bit longer."
-
-	MIMETypes imageReaderClasses do:[:mimeReaderClass |
-	    (mimeReaderClass notNil
-	    and:[mimeReaderClass ~~ readerClass]) ifTrue:[
-	       (mimeReaderClass isValidImageFile:fn) ifTrue:[
-		    image := mimeReaderClass fromFile:fn.
-		    image notNil ifTrue:[
-			^ image
-		    ]
-		]
-	    ]
-	].
+        "no known extension (or wrong extension)
+         - ask all readers if they know this format ...
+         ... these look into the file, and investigate the header.
+         therefore, it takes a bit longer."
+
+        MIMETypes imageReaderClasses do:[:mimeReaderClass |
+            (mimeReaderClass notNil
+            and:[mimeReaderClass ~~ readerClass]) ifTrue:[
+               (mimeReaderClass isValidImageFile:fn) ifTrue:[
+                    image := mimeReaderClass fromFile:fn.
+                    image notNil ifTrue:[
+                        ^ image
+                    ]
+                ]
+            ]
+        ].
     ].
 
     (fn exists and:[fn isReadable]) ifFalse:[
-	^ ImageNotFoundQuerySignal
-		    raiseRequestWith:fn
-		    errorString:('Image: ''' , fn pathName, ''' does not exist or is not readable').
+        ^ ImageNotFoundQuerySignal
+                    raiseRequestWith:fn
+                    errorString:('Image: ''' , fn pathName, ''' does not exist or is not readable').
     ].
 
     "nope - unknown format
@@ -1770,8 +1778,8 @@
      However, a handler may provide a replacement image."
 
     ^ BadImageFormatQuerySignal
-	raiseRequestWith:fn
-	errorString:(readersErrorMsg ? ('Image: unknown image file format: ''' , fn pathName , '''')).
+        raiseRequestWith:fn
+        errorString:(readersErrorMsg ? ('Image: unknown image file format: ''' , fn pathName , '''')).
 
     "
      Image fromFile:'bitmaps/gifImages/claus.gif' inPackage:'stx:goodies'
@@ -1791,10 +1799,10 @@
 
      Image imageNotFoundQuerySignal
      handle:[:ex |
-	Transcript showCR:ex description.
-	ex proceedWith:nil
+        Transcript showCR:ex description.
+        ex proceedWith:nil
      ] do:[
-	 Image fromFile:'fooBar'
+         Image fromFile:'fooBar'
      ]
     "
 
@@ -1803,7 +1811,7 @@
      Image imageNotFoundQuerySignal
      answer:(Image fromFile:'libtool/bitmaps/SmalltalkX.xbm')
      do:[
-	 Image fromFile:'fooBar'
+         Image fromFile:'fooBar'
      ]
     "
 
@@ -1840,7 +1848,7 @@
 
     img := self fromFile:aFileName.
     img notNil ifTrue:[
-	^ img onDevice:aDevice
+        ^ img onDevice:aDevice
     ].
     ^ nil
 
@@ -1874,14 +1882,14 @@
     "if the devices resolution is within +- 50% of dpi, no magnify is needed"
     dev := aDevice.
     dev isNil ifTrue:[
-	"should not happen ..."
-	dev := Screen current
+        "should not happen ..."
+        dev := Screen current
     ].
 
     dev notNil ifTrue:[
-	dpiH := dev horizontalPixelPerInch.
+        dpiH := dev horizontalPixelPerInch.
     ] ifFalse:[
-	dpiH := 90
+        dpiH := 90
     ].
     ((dpi >= (dpiH * 0.75)) and:[dpi <= (dpiH * 1.5)]) ifTrue:[^ img].
     mag := (dpiH / dpi) rounded.
@@ -1890,7 +1898,7 @@
 
     img := img magnifiedBy:(mag @ mag).
     aDevice notNil ifTrue:[
-	^ img onDevice:aDevice
+        ^ img onDevice:aDevice
     ].
     ^ img
 
@@ -1912,10 +1920,10 @@
      this format ...
     "
     MIMETypes imageReaderClasses do:[:readerClass |
-	readerClass notNil ifTrue:[
-	    image := readerClass fromStream:aStream.
-	    image notNil ifTrue:[^ image].
-	]
+        readerClass notNil ifTrue:[
+            image := readerClass fromStream:aStream.
+            image notNil ifTrue:[^ image].
+        ]
     ].
 
     "
@@ -1924,8 +1932,8 @@
 "/    'Image [info]: unknown image file format in stream: ' infoPrintCR.
 
     ^ ImageNotFoundQuerySignal
-		raiseRequestWith:aStream
-		errorString:('Image [warning]: unknown image file format in stream').
+                raiseRequestWith:aStream
+                errorString:('Image [warning]: unknown image file format in stream').
 
     "
      Image fromFile:'goodies/bitmaps/gifImages/claus.gif'
@@ -1966,8 +1974,8 @@
 "/    'Image [info]: unknown image file format in stream: ' infoPrintCR.
 
     ^ ImageNotFoundQuerySignal
-		raiseRequestWith:aStream
-		errorString:('Image: unknown image file format in stream').
+                raiseRequestWith:aStream
+                errorString:('Image: unknown image file format in stream').
 
     "Created: 1.2.1997 / 14:46:20 / cg"
     "Modified: 1.2.1997 / 14:48:53 / cg"
@@ -1977,10 +1985,10 @@
 
 ditherAlgorithm
     "return the way we dither -
-	#threshold, or nil        -> no dither
-	#pattern, or #ordered     -> orderedDither (ugly, but fast)
-	#error or #floydSteinberg -> errorDiffusion; much better
-	#burkes                   -> errorDiffusion; even better."
+        #threshold, or nil        -> no dither
+        #pattern, or #ordered     -> orderedDither (ugly, but fast)
+        #error or #floydSteinberg -> errorDiffusion; much better
+        #burkes                   -> errorDiffusion; even better."
 
     ^ DitherAlgorithm
 
@@ -1989,10 +1997,10 @@
 
 ditherAlgorithm:aSymbol
     "define how to dither -
-	#threshold, or nil        -> no dither
-	#pattern, or #ordered     -> orderedDither (ugly, but fast)
-	#error or #floydSteinberg -> errorDiffusion; much better
-	#burkes                   -> errorDiffusion; even better."
+        #threshold, or nil        -> no dither
+        #pattern, or #ordered     -> orderedDither (ugly, but fast)
+        #error or #floydSteinberg -> errorDiffusion; much better
+        #burkes                   -> errorDiffusion; even better."
 
     DitherAlgorithm := aSymbol
 
@@ -2016,33 +2024,33 @@
 
 orderedDitherMatrixOfSize:sz
     sz == 2 ifTrue:[
-	^ #[
-		0 2
-		3 1
-	   ].
+        ^ #[
+                0 2
+                3 1
+           ].
     ].
 
     sz == 4 ifTrue:[
-	^ #[
-		 0  8  2 10
-		12  4 14  6
-		 3 11  1  9
-		15  7 13  5
-	   ].
+        ^ #[
+                 0  8  2 10
+                12  4 14  6
+                 3 11  1  9
+                15  7 13  5
+           ].
     ].
 
     sz == 8 ifTrue:[
-	^  #[
-		0 32  8 40    2 34 10 42
-	       48 16 56 24   50 18 58 26
-	       12 44  4 36   14 46  6 38
-	       60 28 52 20   62 30 54 22
-
-		3 35 11 43    1 33  9 41
-	       51 19 59 27   49 17 57 25
-	       15 47  7 39   13 45  5 37
-	       63 31 55 23   61 29 53 21
-	    ].
+        ^  #[
+                0 32  8 40    2 34 10 42
+               48 16 56 24   50 18 58 26
+               12 44  4 36   14 46  6 38
+               60 28 52 20   62 30 54 22
+
+                3 35 11 43    1 33  9 41
+               51 19 59 27   49 17 57 25
+               15 47  7 39   13 45  5 37
+               63 31 55 23   61 29 53 21
+            ].
     ].
 
     ^ nil
@@ -2061,7 +2069,7 @@
     bitsPerRow := width * bitsPerPixel.
     paddedUnitsPerRow := bitsPerRow // padding.
     ((bitsPerRow \\ padding) ~~ 0) ifTrue:[
-	paddedUnitsPerRow := paddedUnitsPerRow + 1
+        paddedUnitsPerRow := paddedUnitsPerRow + 1
     ].
     ^ paddedUnitsPerRow * (padding // 8)
 
@@ -2200,16 +2208,16 @@
 fromScreen
     "return an image of the full screen.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     |display|
 
     display := Screen current.
     ^ self
-	fromScreen:(0@0 corner:(display width @ display height))
-	on:display
-	grab:true
+        fromScreen:(0@0 corner:(display width @ display height))
+        on:display
+        grab:true
 
     "
      Image fromScreen
@@ -2222,13 +2230,13 @@
 fromScreen:aRectangle
     "return an image of a part of the screen.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     ^ self
-	fromScreen:aRectangle
-	on:Screen current
-	grab:true
+        fromScreen:aRectangle
+        on:Screen current
+        grab:true
 
     "
      Image fromScreen:(0@0 corner:100@100)
@@ -2242,13 +2250,13 @@
     "return an image of a part of a screen, which may be on
      another display device.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     ^ self
-	fromScreen:aRectangle
-	on:aDevice
-	grab:true
+        fromScreen:aRectangle
+        on:aDevice
+        grab:true
 
     "
      Image fromScreen:(0@0 corner:100@100)
@@ -2271,31 +2279,31 @@
      is grabbed (i.e. blocked for others) and a camera cursor is
      shown while the readout is done.
      WARNING: with doGrab true, this temporarily grabs the display
-	      and it may not work from within a buttonMotion
-	      (use with a false grabArg then)."
+              and it may not work from within a buttonMotion
+              (use with a false grabArg then)."
 
     |depth vis img tmpFile util|
 
     aDisplay supportsScreenReading ifFalse:[
-	"/ workaround: look for a helper utility in support/<os>/screenshot
-	"/ currently there is one for osx.
-	tmpFile := Filename newTemporary withSuffix:'png'.
-	util := Smalltalk packageDirectory asFilename / ('../support/',OperatingSystem getSystemType,'/screenshot').
-	util exists ifTrue:[
-	    OperatingSystem executeCommand:('%1 %2 png %3 %4 %5 %6'
-						bindWith:util pathName
-						with:tmpFile pathName
-						with:aRectangle left
-						with:aRectangle top
-						with:aRectangle width
-						with:aRectangle height).
-	    [
-		img := Image fromFile:tmpFile.
-	    ] ensure:[
-		tmpFile remove.
-	    ].
-	    ^ img.
-	].
+        "/ workaround: look for a helper utility in support/<os>/screenshot
+        "/ currently there is one for osx.
+        tmpFile := Filename newTemporary withSuffix:'png'.
+        util := Smalltalk packageDirectory asFilename / ('../support/',OperatingSystem getSystemType,'/screenshot').
+        util exists ifTrue:[
+            OperatingSystem executeCommand:('%1 %2 png %3 %4 %5 %6'
+                                                bindWith:util pathName
+                                                with:tmpFile pathName
+                                                with:aRectangle left
+                                                with:aRectangle top
+                                                with:aRectangle width
+                                                with:aRectangle height).
+            [
+                img := Image fromFile:tmpFile.
+            ] ensure:[
+                tmpFile remove.
+            ].
+            ^ img.
+        ].
     ].
 
     depth := aDisplay depth.
@@ -2307,9 +2315,9 @@
     "/
     vis := aDisplay visualType.
     (vis == #TrueColor or:[vis == #DirectColor]) ifTrue:[
-	depth > 8 ifTrue:[
-	    depth := 24.
-	]
+        depth > 8 ifTrue:[
+            depth := 24.
+        ]
     ].
 
     img := self newForDepth:depth.
@@ -2324,8 +2332,8 @@
      This is the same as #fromUser - kept for backward compatibility.
      Use #fromUser for ST-80 compatibility.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     |r|
 
@@ -2347,8 +2355,8 @@
     "return an image of a part of the screen; let user specify screen area.
      Same as fromScreenArea, for ST-80 compatibility.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     ^ self fromScreenArea
 
@@ -2364,16 +2372,16 @@
     "return an image taken from a views contents as currently
      on the screen. The returned image has the same depth and photometric
      as the Display.
-     Notice, that for invisible or partial covered views,
+     Notice that for invisible or partial covered views,
      the returned Image is NOT correct.
      You may want to raise the view before using this method.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromView:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromView:grab: with a false grabArg then)."
 
     ^ self
-	fromView:aView
-	grab:true
+        fromView:aView
+        grab:true
 
     "
      Image fromView:(Launcher allInstances first window topView)
@@ -2399,12 +2407,12 @@
      shown while the readout is done.
      The returned image has the same depth and photometric
      as the Display.
-     Notice, that for invisible or partial covered views,
+     Notice that for invisible or partial covered views,
      the returned Image is NOT correct.
      You may want to raise the view before using this method.
      WARNING: with doGrab true, this temporarily grabs the display
-	      and it may not work from within a buttonMotion
-	      (use with a false grabArg then)."
+              and it may not work from within a buttonMotion
+              (use with a false grabArg then)."
 
     ^ self fromView:aView grab:doGrab withDecoration:false
 
@@ -2420,12 +2428,12 @@
      shown while the readout is done.
      The returned image has the same depth and photometric
      as the Display.
-     Notice, that for invisible or partial covered views,
+     Notice that for invisible or partial covered views,
      the returned Image is NOT correct.
      You may want to raise the view before using this method.
      WARNING: with doGrab true, this temporarily grabs the display
-	      and it may not work from within a buttonMotion
-	      (use with a false grabArg then)."
+              and it may not work from within a buttonMotion
+              (use with a false grabArg then)."
 
     |org ext viewsDevice cH bW bH|
 
@@ -2433,15 +2441,15 @@
     org := viewsDevice translatePoint:(0@0) fromView:aView toView:nil.
     ext := aView extent.
     withDecoration ifTrue:[
-	viewsDevice isWindowsPlatform ifTrue:[
-	    cH := viewsDevice captionHeight.
-	    bW := (viewsDevice getSystemMetrics: #SM_CXFRAME )
-		  "+ ( device getSystemMetrics: #borderFrameWidth )".
-	    bH := (viewsDevice getSystemMetrics: #SM_CYFRAME )
-		  " + ( device getSystemMetrics: #borderFrameHeight )".
-	    org := org - (bW @ (bH + cH)).
-	    ext := ext + ((bW + bW) @ (bH+bH+cH)).
-	].
+        viewsDevice isWindowsPlatform ifTrue:[
+            cH := viewsDevice captionHeight.
+            bW := (viewsDevice getSystemMetrics: #SM_CXFRAME )
+                  "+ ( device getSystemMetrics: #borderFrameWidth )".
+            bH := (viewsDevice getSystemMetrics: #SM_CYFRAME )
+                  " + ( device getSystemMetrics: #borderFrameHeight )".
+            org := org - (bW @ (bH + cH)).
+            ext := ext + ((bW + bW) @ (bH+bH+cH)).
+        ].
     ].
     ^ self fromScreen:(org extent:ext) on:viewsDevice grab:doGrab
 
@@ -2475,13 +2483,13 @@
 
     newMap := Colormap new:anArrayOfRGBTriples size.
     anArrayOfRGBTriples doWithIndex:[:rgb :i |
-	newMap at:i putRGBTriple:rgb
+        newMap at:i putRGBTriple:rgb
     ].
     self colorMap:newMap.
 
     "
      Depth8Image new
-	colorsFromArray:#( (0.5 0.5 0.5) (0.25 0.0 0.0) (0.0 0.25 0.5))
+        colorsFromArray:#( (0.5 0.5 0.5) (0.25 0.0 0.0) (0.0 0.25 0.5))
     "
 !
 
@@ -2561,23 +2569,23 @@
     |monoBits convertedImage|
 
     aColormap size == 2 ifTrue:[
-	anImageRenderer class == OrderedDither ifTrue:[
-	    monoBits := self orderedDitheredMonochromeBits.
-	] ifFalse:[
-	    monoBits := self floydSteinbergDitheredMonochromeBits.
-	].
-	(((aColormap at:1) = Color black)
-	and:[(aColormap at:2) = Color white]) ifTrue:[
-	    "/ ok
-	] ifFalse:[
-	    (((aColormap at:1) = Color white)
-	    and:[(aColormap at:2) = Color black]) ifTrue:[
-		monoBits invert
-	    ]
-	].
-	convertedImage := Depth1Image width:width height:height fromArray:monoBits.
-	convertedImage palette:aColormap.
-	^ convertedImage
+        anImageRenderer class == OrderedDither ifTrue:[
+            monoBits := self orderedDitheredMonochromeBits.
+        ] ifFalse:[
+            monoBits := self floydSteinbergDitheredMonochromeBits.
+        ].
+        (((aColormap at:1) = Color black)
+        and:[(aColormap at:2) = Color white]) ifTrue:[
+            "/ ok
+        ] ifFalse:[
+            (((aColormap at:1) = Color white)
+            and:[(aColormap at:2) = Color black]) ifTrue:[
+                monoBits invert
+            ]
+        ].
+        convertedImage := Depth1Image width:width height:height fromArray:monoBits.
+        convertedImage palette:aColormap.
+        ^ convertedImage
     ].
 
     self error:'unimplemented operation'.
@@ -2606,13 +2614,13 @@
     |orgX orgY tW tH|
 
     origin ~= (0@0) ifTrue:[
-	self shouldImplement.
+        self shouldImplement.
     ].
     bounds ~= self bounds ifTrue:[
-	self shouldImplement.
+        self shouldImplement.
     ].
     rule ~= #over ifTrue:[
-	self shouldImplement.
+        self shouldImplement.
     ].
 
     orgX := origin x.
@@ -2620,21 +2628,21 @@
     tW := tile width.
     tH := tile height.
     (bounds top) to:(bounds bottom) by:tH do:[:dstY |
-	(bounds left) to:(bounds right) by:(tile width) do:[:dstX |
-	    self
-		copyFrom:tile
-		x:orgX y:orgY
-		toX:dstX y:dstY
-		width:tW height:tH.
-	].
+        (bounds left) to:(bounds right) by:(tile width) do:[:dstX |
+            self
+                copyFrom:tile
+                x:orgX y:orgY
+                toX:dstX y:dstY
+                width:tW height:tH.
+        ].
     ].
 !
 
 valueAtPoint:aPoint put:aColorValue
     aColorValue isInteger ifFalse:[
-	self colorAtX:aPoint x y:aPoint y put:aColorValue
+        self colorAtX:aPoint x y:aPoint y put:aColorValue
     ] ifTrue:[
-	self pixelAtX:aPoint x y:aPoint y put:aColorValue
+        self pixelAtX:aPoint x y:aPoint y put:aColorValue
     ]
 ! !
 
@@ -2762,32 +2770,32 @@
     sameColors := false.
 
     photometric == #palette ifTrue:[
-	"/ any change at all ?
-	(newSize := aColorMap size) >= (oldSize := colorMap size) ifTrue:[
-	    sameColors := true.
-
-	    1 to:oldSize do:[:idx |
-		(aColorMap at:idx) = (colorMap at:idx) ifFalse:[
-		    sameColors := false.
-		]
-	    ].
-	].
+        "/ any change at all ?
+        (newSize := aColorMap size) >= (oldSize := colorMap size) ifTrue:[
+            sameColors := true.
+
+            1 to:oldSize do:[:idx |
+                (aColorMap at:idx) = (colorMap at:idx) ifFalse:[
+                    sameColors := false.
+                ]
+            ].
+        ].
     ].
 
     self setColorMap:aColorMap.
     sameColors ifTrue:[
-	^ self
+        ^ self
     ].
 
     colorMap notNil ifTrue:[
-	photometric := #palette.
+        photometric := #palette.
     ] ifFalse:[
-	(photometric == #palette) ifTrue:[
-	    photometric := #blackIs0
-	]
+        (photometric == #palette) ifTrue:[
+            photometric := #blackIs0
+        ]
     ].
     deviceForm notNil ifTrue:[
-	self release
+        self release
     ]
 
     "Modified: / 31.8.1995 / 03:05:59 / claus"
@@ -2797,7 +2805,7 @@
 colorMapFromArray: anArray
     "set the colorMap by reading colors from an array with rgb-byte values.
      The (byte-)Array argument should be of the form:
-	#( red0 green0 blue0  red1 green1 blue1 ... redN greenN blueN)
+        #( red0 green0 blue0  red1 green1 blue1 ... redN greenN blueN)
      where each component must be a byteValue in 0..255."
 
     self colorMap:(MappedPalette rgbBytesVector:anArray)
@@ -2806,7 +2814,7 @@
 colorMapFromRGBValueArray:anArray
     "set the colorMap by reading colors from an array with rgb-integer values.
      The (integer-)Array argument should be of the form:
-	#( rgb0 rgb1  ... rgbN)
+        #( rgb0 rgb1  ... rgbN)
      where each element must be an rgbValue in 0..FFFFFF."
 
     self colorMap:(MappedPalette rgbValueVector:anArray)
@@ -2912,16 +2920,16 @@
      (it is planned to support alpha information in a Depth8 maskImage in
       the near future).
      For depth1 masks: each pixel of the image where a corresponding
-		       1-bit is present in the mask will be drawn;
-		       0-bit mask pixels lead to transparent pixels.
+                       1-bit is present in the mask will be drawn;
+                       0-bit mask pixels lead to transparent pixels.
 
      For depth8 masks: (future):
-		       each pixel specifies the alpha value (0..255),
-		       which specifies the transparency of that pixel.
-		       0 means completely transparent, 255 means completely
-		       opaque. The 1-plane mask is a special case of this,
-		       interpreting a 0 as a 0 alpha value and 1's as an
-		       alpha value of 255."
+                       each pixel specifies the alpha value (0..255),
+                       which specifies the transparency of that pixel.
+                       0 means completely transparent, 255 means completely
+                       opaque. The 1-plane mask is a special case of this,
+                       interpreting a 0 as a 0 alpha value and 1's as an
+                       alpha value of 255."
 
     mask := anotherImage.
     maskedPixelsAre0 := false.
@@ -3003,9 +3011,9 @@
 
 setColorMap:aColorMap
     (aColorMap isNil or:[aColorMap isKindOf:Colormap]) ifFalse:[
-	colorMap := MappedPalette withColors:aColorMap
+        colorMap := MappedPalette withColors:aColorMap
     ] ifTrue:[
-	colorMap := aColorMap
+        colorMap := aColorMap
     ]
 !
 
@@ -3071,18 +3079,18 @@
     |maskVal|
 
     (aColorOrPixelOrNil notNil and:[aColorOrPixelOrNil ~= Color noColor]) ifTrue:[
-	maskVal := 1.
-	aColorOrPixelOrNil isInteger ifTrue:[
-	    self pixelAt:aPoint put:aColorOrPixelOrNil.
-	] ifFalse:[
-	    self colorAt:aPoint put:aColorOrPixelOrNil
-	]
+        maskVal := 1.
+        aColorOrPixelOrNil isInteger ifTrue:[
+            self pixelAt:aPoint put:aColorOrPixelOrNil.
+        ] ifFalse:[
+            self colorAt:aPoint put:aColorOrPixelOrNil
+        ]
     ] ifFalse:[
-	maskVal := 0.
-	self pixelAt:aPoint put:0.
+        maskVal := 0.
+        self pixelAt:aPoint put:0.
     ].
     mask notNil ifTrue:[
-	mask pixelAt:aPoint put:maskVal
+        mask pixelAt:aPoint put:maskVal
     ].
 
     "Modified: / 30.9.1998 / 22:42:44 / cg"
@@ -3096,14 +3104,14 @@
     |pixVal maskVal|
 
     aPixelValueOrNil notNil ifTrue:[
-	pixVal := aPixelValueOrNil.
-	maskVal := 1.
+        pixVal := aPixelValueOrNil.
+        maskVal := 1.
     ] ifFalse:[
-	pixVal := 0.
-	maskVal := 0.
+        pixVal := 0.
+        maskVal := 0.
     ].
     mask notNil ifTrue:[
-	mask pixelAt:aPoint put:maskVal
+        mask pixelAt:aPoint put:maskVal
     ].
     self pixelAt:aPoint put:pixVal
 
@@ -3196,18 +3204,67 @@
      4 pixels per byte."
 
     bytes isNil ifTrue:[
-	pixelFunction notNil ifTrue:[
-	    self createPixelStore.
-	    0 to:height-1 do:[:y |
-		0 to:width-1 do:[:x |
-		    self pixelAtX:x y:y put:(pixelFunction value:x value:y)
-		].
-	    ].
-	].
+        pixelFunction notNil ifTrue:[
+            self createPixelStore.
+            0 to:height-1 do:[:y |
+                0 to:width-1 do:[:x |
+                    self pixelAtX:x y:y put:(pixelFunction value:x value:y)
+                ].
+            ].
+        ].
     ].
     ^ bytes
 !
 
+colAt:x into:aPixelBuffer
+    "fill aBuffer with pixel values retrieved from a single column.
+     (eg. a vertical span)    
+     Notice: row/column coordinates start at 0."
+
+    ^ self colAt:x into:aPixelBuffer startingAt:1
+!
+
+colAt:x into:aPixelBuffer startingAt:startIndex
+    "fill aBuffer with pixel values retrieved from a single column.
+     (eg. a vertical span)    
+     Notice: row/column coordinates start at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    |h "{ Class: SmallInteger }"|
+
+    h := height-1.    
+    0 to:h do:[:row |
+        aPixelBuffer at:(row + startIndex) put:(self pixelAtX:x y:row)
+    ].
+!
+
+colAt:x putAll:pixelArray
+    "store a single column's pixels from bits in the argument;
+     (eg. a vertical span)    
+     Notice: row/column coordinates start at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    ^ self colAt:x putAll:pixelArray startingAt:1
+!
+
+colAt:x putAll:pixelArray startingAt:startIndex
+    "store a single row's pixels from bits in the pixelArray argument.
+     (eg. a vertical span)    
+     Notice: row/column coordinates start at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    |h "{ Class: SmallInteger }"|
+
+    h := height-1.
+    0 to:h do:[:row |
+        self pixelAtX:x y:row put:(pixelArray at:(row + startIndex))
+    ].
+    ^ pixelArray
+!
+
 colorAt:aPoint
     "retrieve a pixel at x/y; return a color.
      Pixels start at 0@0 for upper left pixel, end at
@@ -3256,7 +3313,7 @@
 
     pixel := self valueFromColor:aColor.
     pixel isNil ifTrue:[
-	^ UnrepresentableColorSignal raiseErrorString:'cannot store color - not in colormap'.
+        ^ UnrepresentableColorSignal raiseErrorString:'cannot store color - not in colormap'.
     ].
     self pixelAtX:x y:y put:pixel.
 
@@ -3313,8 +3370,8 @@
      0 for masked pixels (invisible), 1 for unmasked (visible)."
 
     mask isNil ifTrue:[
-	maskValue == 1 ifTrue:[^ self].
-	self error:'image has no mask'.
+        maskValue == 1 ifTrue:[^ self].
+        self error:'image has no mask'.
     ].
 
     ^ mask pixelAtX:x y:y put:maskValue
@@ -3349,13 +3406,13 @@
 !
 
 pixelAtX:x y:y
-    "retrieve the pixelValue at aPoint; return an integer number.
+    "retrieve the pixelValue at aPoint; return a pixel (an integer number).
      Pixels start at 0/0 for upper left pixel, and end at
      width-1@height-1 for lower right pixel.
-     The returned numbers interpretation depends on the photometric
+     The returned number's interpretation depends on the photometric
      and the colormap. (see also Image>>at: and Image>>atX:y:)
      You should not use this method for image-processing of
-     big images, its very slow ...
+     big images, it's very slow ...
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
     pixelFunction notNil ifTrue:[^ pixelFunction value:x value:y].
@@ -3407,9 +3464,9 @@
 !
 
 rowAt:y
-    "retrieve an array filled with pixel values from
-     a single row.
-     Notice: row coordinate starts at 0.
+    "retrieve an array filled with pixel values from a single row.
+     (eg. a horizontal span)    
+     Notice: row/column coordinates start at 0.
      This is a slow fallBack method, which works with any depth;
      concrete image subclasses should redefine this for more performance."
 
@@ -3437,7 +3494,8 @@
 
 rowAt:y into:aPixelBuffer
     "fill aBuffer with pixel values retrieved from a single row.
-     Notice: row coordinate starts at 0."
+     (eg. a horizontal span)    
+     Notice: row/column coordinates start at 0."
 
     ^ self rowAt:y into:aPixelBuffer startingAt:1
 
@@ -3447,7 +3505,8 @@
 
 rowAt:y into:aPixelBuffer startingAt:startIndex
     "fill aBuffer with pixel values retrieved from a single row.
-     Notice: row coordinate starts at 0.
+     (eg. a horizontal span)    
+     Notice: row/column coordinates start at 0.
      This is a slow fallBack method, which works with any depth;
      concrete image subclasses should redefine this for more performance."
 
@@ -3455,7 +3514,7 @@
 
     w := width-1.
     0 to:w do:[:col |
-	aPixelBuffer at:(col + startIndex) put:(self pixelAtX:col y:y)
+        aPixelBuffer at:(col + startIndex) put:(self pixelAtX:col y:y)
     ].
 
     "Created: 24.4.1997 / 15:05:21 / cg"
@@ -3463,8 +3522,9 @@
 !
 
 rowAt:y putAll:pixelArray
-    "store a single rows pixels from bits in the argument;
-     Notice: row coordinate starts at 0.
+    "store a single row's pixels from bits in the argument;
+     (eg. a horizontal span)    
+     Notice: row/column coordinates start at 0.
      This is a slow fallBack method, which works with any depth;
      concrete image subclasses should redefine this for more performance."
 
@@ -3474,9 +3534,9 @@
 !
 
 rowAt:y putAll:pixelArray startingAt:startIndex
-    "store a single rows pixels from bits in the pixelArray argument;
-     return the pixelArray.
-     Notice: row coordinate starts at 0.
+    "store a single row's pixels from bits in the pixelArray argument;
+     (eg. a horizontal span)    
+     Notice: row/column coordinates start at 0.
      This is a slow fallBack method, which works with any depth;
      concrete image subclasses should redefine this for more performance."
 
@@ -3484,7 +3544,7 @@
 
     w := width-1.
     0 to:w do:[:col |
-	self pixelAtX:col y:y put:(pixelArray at:(col + startIndex))
+        self pixelAtX:col y:y put:(pixelArray at:(col + startIndex))
     ].
     ^ pixelArray
 
@@ -3555,15 +3615,15 @@
     "/ please edit the image in the image editor and save it back.
 
     (width notNil and:[height notNil and:[(d := self depth) notNil]]) ifTrue:[
-	(d <= 8) ifTrue:[
-	    expectedSize := (self bytesPerRow * height).
-	    bytes size < expectedSize ifTrue:[
-		Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
-		    self breakPoint:#cg info:'invalid bytearray size'.
-		].
-		bytes := (ByteArray new:expectedSize) replaceFrom:1 with:bytes; yourself.
-	    ].
-	].
+        (d <= 8) ifTrue:[
+            expectedSize := (self bytesPerRow * height).
+            bytes size < expectedSize ifTrue:[
+                Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
+                    self breakPoint:#cg info:'invalid bytearray size'.
+                ].
+                bytes := (ByteArray new:expectedSize) replaceFrom:1 with:bytes; yourself.
+            ].
+        ].
     ].
 
     "Modified: 23.4.1996 / 11:08:28 / cg"
@@ -3643,17 +3703,17 @@
     "/ Prevents writers to do what is described above.
     "/ Do not remove, as you might not understand it!!
     bitsPerSample :=
-	#(
-	    #[ 8 8 8 ]
-	    #[ 4 4 4 ]
-	    #[ 8 ]
-	    #[ 4 ]
-	    #[ 2 ]
-	    #[ 1 ]
-	) detect:[:bps | bps sameContentsAs:aCollection] ifNone:[aCollection asByteArray].
+        #(
+            #[ 8 8 8 ]
+            #[ 4 4 4 ]
+            #[ 8 ]
+            #[ 4 ]
+            #[ 2 ]
+            #[ 1 ]
+        ) detect:[:bps | bps sameContentsAs:aCollection] ifNone:[aCollection asByteArray].
 
     samplesPerPixel isNil ifTrue:[
-	samplesPerPixel := bitsPerSample size.
+        samplesPerPixel := bitsPerSample size.
     ].
 
     "Modified: 23.4.1996 / 11:08:31 / cg"
@@ -3669,22 +3729,22 @@
     depth := self depth.
     "/ bitsPerPixel := d.
     d == 24 ifTrue:[
-	samplesPerPixel := 3.
-	bitsPerSample := #(8 8 8)
+        samplesPerPixel := 3.
+        bitsPerSample := #(8 8 8)
     ] ifFalse:[
-	d == 32 ifTrue:[
-	    samplesPerPixel := 4.
-	    bitsPerSample := #(8 8 8 8)
-	] ifFalse:[
-	    d == 16 ifTrue:[
-		samplesPerPixel := 3.
-		bitsPerSample := #(5 5 5).
-		"/ bitsPerPixel := 15.
-	    ] ifFalse:[
-		samplesPerPixel := 1.
-		bitsPerSample := ByteArray with:d
-	    ]
-	]
+        d == 32 ifTrue:[
+            samplesPerPixel := 4.
+            bitsPerSample := #(8 8 8 8)
+        ] ifFalse:[
+            d == 16 ifTrue:[
+                samplesPerPixel := 3.
+                bitsPerSample := #(5 5 5).
+                "/ bitsPerPixel := 15.
+            ] ifFalse:[
+                samplesPerPixel := 1.
+                bitsPerSample := ByteArray with:d
+            ]
+        ]
     ]
 
     "Modified: / 27-05-2007 / 16:59:47 / cg"
@@ -3722,7 +3782,7 @@
 photometric:aSymbol
     "set the photometric interpretation of the pixel values.
      The argument, aSymbol is one of:
-	#blackIs0, #whiteIs0, #palette, #rgb
+        #blackIs0, #whiteIs0, #palette, #rgb
      See TIFF documentation, from which the photometric concept is borrowed.
 
      This interface is only to be used when initializing
@@ -3733,19 +3793,19 @@
 
     photometric := aSymbol.
     bitsPerSample isNil ifTrue:[
-	photometric == #rgb ifTrue:[
-	    b := self class imageDepth // 3.
-	    bitsPerSample := ByteArray with:b with:b with:b
-	] ifFalse:[
-	    bitsPerSample := ByteArray with:(self class imageDepth)
-	].
+        photometric == #rgb ifTrue:[
+            b := self class imageDepth // 3.
+            bitsPerSample := ByteArray with:b with:b with:b
+        ] ifFalse:[
+            bitsPerSample := ByteArray with:(self class imageDepth)
+        ].
     ].
     samplesPerPixel isNil ifTrue:[
-	photometric == #rgb ifTrue:[
-	    samplesPerPixel := 3
-	] ifFalse:[
-	    samplesPerPixel := 1
-	]
+        photometric == #rgb ifTrue:[
+            samplesPerPixel := 3
+        ] ifFalse:[
+            samplesPerPixel := 1
+        ]
     ].
 
     "Modified: 10.6.1996 / 18:21:29 / cg"
@@ -3829,9 +3889,9 @@
     self depth:d.
     self setColorMap:aColormap.
     aColormap notNil ifTrue:[
-	photometric := #palette
+        photometric := #palette
     ] ifFalse:[
-	photometric := #blackIs0
+        photometric := #blackIs0
     ].
 
     "Modified: 23.4.1996 / 11:08:56 / cg"
@@ -3860,14 +3920,14 @@
      existing image may confuse later pixel interpretation."
 
     ^ self
-	width:w
-	height:h
-	photometric:p
-	samplesPerPixel:spp
-	bitsPerSample:bps
-	colorMap:cm
-	bits:pixels
-	mask:nil
+        width:w
+        height:h
+        photometric:p
+        samplesPerPixel:spp
+        bitsPerSample:bps
+        colorMap:cm
+        bits:pixels
+        mask:nil
 
     "Modified: 20.6.1996 / 17:10:24 / cg"
 !
@@ -3922,19 +3982,19 @@
     colorValues := Array uninitializedNew:nColors.
 
     0 to:nColors-1 do:[:pixel |
-	|clr rv gv bv v "{ Class: SmallInteger }" |
-
-	clr := self colorFromValue:pixel.
-
-	rv := (clr red * scaleRed) rounded.
-	gv := (clr green * scaleGreen) rounded.
-	bv := (clr blue * scaleBlue) rounded.
-
-	v := rv bitShift:redShift.
-	v := v bitOr:(gv bitShift:greenShift).
-	v := v bitOr:(bv bitShift:blueShift).
-
-	colorValues at:(pixel+1) put:v.
+        |clr rv gv bv v "{ Class: SmallInteger }" |
+
+        clr := self colorFromValue:pixel.
+
+        rv := (clr red * scaleRed) rounded.
+        gv := (clr green * scaleGreen) rounded.
+        bv := (clr blue * scaleBlue) rounded.
+
+        v := rv bitShift:redShift.
+        v := v bitOr:(gv bitShift:greenShift).
+        v := v bitOr:(bv bitShift:blueShift).
+
+        colorValues at:(pixel+1) put:v.
 "/ clr print. ' ' print.
 "/ rv print. ' ' print. gv print. ' ' print. bv print. ' ' print.
 "/ ' -> ' print. v printNL.
@@ -3951,7 +4011,7 @@
     "return a burkes dithered monochrome image from the receiver image.
      Depending on the images contents, this may or may not look better than
      a floyd-steinberg dithered image.
-     Notice, that floyd-steinberg dithering is faster; both because less
+     Notice that floyd-steinberg dithering is faster; both because less
      error diffusion is done and due to being specially tuned."
 
     |monoBits|
@@ -3983,14 +4043,14 @@
      |i|
 
      i := Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			].
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ].
      i := i magnifiedBy:30.
      i inspect.
      i asFloydSteinbergDitheredMonochromeImage inspect.
@@ -4017,7 +4077,7 @@
 
     newBits := self floydSteinbergDitheredDepth8BitsColors:colors map:(0 to:colors size - 1).
     newBits isNil ifTrue:[
-	self error:'dithering failed'
+        self error:'dithering failed'
     ].
     ^ (self class newForDepth:d) extent:(self extent); depth:d; palette:colors; bits:newBits
 
@@ -4027,10 +4087,10 @@
     "return an error-diffusion dithered monochrome image from the receiver image."
 
     DitherAlgorithm == #burkes ifTrue:[
-	^ self asBurkesDitheredMonochromeImage
+        ^ self asBurkesDitheredMonochromeImage
     ].
     DitherAlgorithm == #stevensonArce ifTrue:[
-	^ self asStevensonArceDitheredMonochromeImage
+        ^ self asStevensonArceDitheredMonochromeImage
     ].
     ^ self asFloydSteinbergDitheredMonochromeImage
 
@@ -4056,14 +4116,14 @@
      |i|
 
      i := Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			].
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ].
      i := i magnifiedBy:30.
      i inspect.
      i asErrorDitheredMonochromeImage inspect.
@@ -4084,9 +4144,9 @@
 
     deviceDepth := aDevice depth.
     deviceDepth == 8 ifFalse:[
-	(aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
-	    ^ nil.
-	]
+        (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+            ^ nil.
+        ]
     ].
 
     pseudoBits := self floydSteinbergDitheredDepth8BitsColors:fixColors.
@@ -4101,51 +4161,51 @@
     "/
     map := Array new:256.
     fixColors do:[:clr |
-	map at:clr colorId + 1 put:clr
+        map at:clr colorId + 1 put:clr
     ].
     f colorMap:map.
     f initGC.
     f bits:pseudoBits.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:8
-	depth:deviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id) x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:8
+        depth:deviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id) x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "
      example:
-	color reduction from Depth8 to Depth4 (dithering) can be done by:
+        color reduction from Depth8 to Depth4 (dithering) can be done by:
 
      |img8 reducedImg8 img4 map form|
 
      map := #(
-		  (0     0   0)
-		  (0     0 100)
-		  (0    50   0)
-		  (0    50 100)
-		  (0   100   0)
-		  (0   100 100)
-		  (100   0   0)
-		  (100   0 100)
-		  (100  50   0)
-		  (100  50 100)
-		  (100 100   0)
-		  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
-						      green:(rgb at:2)
-						       blue:(rgb at:3)) onDevice:Display].
+                  (0     0   0)
+                  (0     0 100)
+                  (0    50   0)
+                  (0    50 100)
+                  (0   100   0)
+                  (0   100 100)
+                  (100   0   0)
+                  (100   0 100)
+                  (100  50   0)
+                  (100  50 100)
+                  (100 100   0)
+                  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+                                                      green:(rgb at:2)
+                                                       blue:(rgb at:3)) onDevice:Display].
 
      img8 := Image fromFile:'goodies/bitmaps/bf.im8'.
      form := img8 paletteImageAsDitheredPseudoFormOn:Display
-		      colors:map
-			nRed:2
-		      nGreen:3
-		       nBlue:2.
+                      colors:map
+                        nRed:2
+                      nGreen:3
+                       nBlue:2.
      img8 := Depth8Image fromForm:form.    'dithered version of original image'.
      img4 := Depth4Image fromImage:img8.
     "
@@ -4167,9 +4227,9 @@
 
     deviceDepth := aDevice depth.
     deviceDepth == 8 ifFalse:[
-	(aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
-	    ^ nil
-	]
+        (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+            ^ nil
+        ]
     ].
 
     pseudoBits := self floydSteinbergDitheredDepth8BitsColors:fixColors nRed:nRed nGreen:nGreen nBlue:nBlue.
@@ -4184,51 +4244,51 @@
     "/
     map := Array new:256.
     fixColors do:[:clr |
-	map at:clr colorId + 1 put:clr
+        map at:clr colorId + 1 put:clr
     ].
     f colorMap:map.
     f initGC.
     f bits:pseudoBits.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:8
-	depth:deviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id) x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:8
+        depth:deviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id) x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "
      example:
-	color reduction from Depth8 to Depth4 (dithering) can be done by:
+        color reduction from Depth8 to Depth4 (dithering) can be done by:
 
      |img8 reducedImg8 img4 map form|
 
      map := #(
-		  (0     0   0)
-		  (0     0 100)
-		  (0    50   0)
-		  (0    50 100)
-		  (0   100   0)
-		  (0   100 100)
-		  (100   0   0)
-		  (100   0 100)
-		  (100  50   0)
-		  (100  50 100)
-		  (100 100   0)
-		  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
-						      green:(rgb at:2)
-						       blue:(rgb at:3)) onDevice:Display].
+                  (0     0   0)
+                  (0     0 100)
+                  (0    50   0)
+                  (0    50 100)
+                  (0   100   0)
+                  (0   100 100)
+                  (100   0   0)
+                  (100   0 100)
+                  (100  50   0)
+                  (100  50 100)
+                  (100 100   0)
+                  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+                                                      green:(rgb at:2)
+                                                       blue:(rgb at:3)) onDevice:Display].
 
      img8 := Image fromFile:'goodies/bitmaps/bf.im8'.
      form := img8 paletteImageAsDitheredPseudoFormOn:Display
-		      colors:map
-			nRed:2
-		      nGreen:3
-		       nBlue:2.
+                      colors:map
+                        nRed:2
+                      nGreen:3
+                       nBlue:2.
      img8 := Depth8Image fromForm:form.    'dithered version of original image'.
      img4 := Depth4Image fromImage:img8.
     "
@@ -4244,12 +4304,12 @@
     depth := aDevice depth.
     (depth == 1
     or:[aDevice hasGrayscales not]) ifTrue:[
-	"/ for monochrome, there is specialized
-	"/ monochrome dither code available
-
-	bits := self floydSteinbergDitheredMonochromeBits.
+        "/ for monochrome, there is specialized
+        "/ monochrome dither code available
+
+        bits := self floydSteinbergDitheredMonochromeBits.
     ] ifFalse:[
-	bits := self floydSteinbergDitheredGrayBitsDepth:depth.
+        bits := self floydSteinbergDitheredGrayBitsDepth:depth.
     ].
 
     ^ self makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
@@ -4278,12 +4338,12 @@
     |ditheredBits|
 
     (depth == 1) ifTrue:[
-	^ self asFloydSteinbergDitheredMonochromeImage
+        ^ self asFloydSteinbergDitheredMonochromeImage
     ].
 
     ditheredBits := self floydSteinbergDitheredGrayBitsDepth:depth.
     ^ (self class implementorForDepth:depth)
-	width:width height:height fromArray:ditheredBits
+        width:width height:height fromArray:ditheredBits
 
     "
      |i|
@@ -4299,11 +4359,11 @@
      |i|
 
      i := Depth24Image width:4 height:1
-	  fromArray:#[
-	    16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
-	    16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
-	    16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
-	    16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00].
+          fromArray:#[
+            16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
+            16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
+            16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00
+            16rFF 16r00 16r00   16rFF 16r00 16r00  16rFF 16r00 16r00  16rFF 16r00 16r00].
      i := i magnifiedBy:4@1.
      i inspect.
 
@@ -4316,13 +4376,13 @@
      |i|
 
      i := Depth24Image width:4 height:6
-	  fromArray:#[
-	    16r00 16r00 16r00   16r00 16r00 16r80  16r00 16r00 16rff  16r00 16r80 16r00
-	    16r00 16r80 16r80   16r00 16rFF 16r00  16r00 16rFF 16r80  16r00 16rFF 16rFF
-	    16r80 16r00 16r00   16r80 16r00 16r80  16r80 16r00 16rff  16r80 16r80 16r00
-	    16r80 16r80 16r80   16r80 16rFF 16r00  16r80 16rFF 16r80  16r80 16rFF 16rFF
-	    16rFF 16r00 16r00   16rFF 16r00 16r80  16rFF 16r00 16rff  16rFF 16r80 16r00
-	    16rFF 16r80 16r80   16rFF 16rFF 16r00  16rFF 16rFF 16r80  16rFF 16rFF 16rFF].
+          fromArray:#[
+            16r00 16r00 16r00   16r00 16r00 16r80  16r00 16r00 16rff  16r00 16r80 16r00
+            16r00 16r80 16r80   16r00 16rFF 16r00  16r00 16rFF 16r80  16r00 16rFF 16rFF
+            16r80 16r00 16r00   16r80 16r00 16r80  16r80 16r00 16rff  16r80 16r80 16r00
+            16r80 16r80 16r80   16r80 16rFF 16r00  16r80 16rFF 16r80  16r80 16rFF 16rFF
+            16rFF 16r00 16r00   16rFF 16r00 16r80  16rFF 16r00 16rff  16rFF 16r80 16r00
+            16rFF 16r80 16r80   16rFF 16rFF 16r00  16rFF 16rFF 16r80  16rFF 16rFF 16rFF].
      i := i magnifiedBy:30.
      i inspect.
 
@@ -4354,14 +4414,14 @@
      |i|
 
      i := Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			].
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ].
      i := i magnifiedBy:30.
      i inspect.
      (i asFloydSteinbergDitheredGrayImageDepth:1) inspect.
@@ -4392,16 +4452,16 @@
      |i f|
 
      i := Depth2Image width:8 height:8
-	  fromArray:#[
-			4r0000 4r0000
-			4r0000 4r0000
-			4r1111 4r1111
-			4r1111 4r1111
-			4r2222 4r2222
-			4r2222 4r2222
-			4r3333 4r3333
-			4r3333 4r3333
-		     ].
+          fromArray:#[
+                        4r0000 4r0000
+                        4r0000 4r0000
+                        4r1111 4r1111
+                        4r1111 4r1111
+                        4r2222 4r2222
+                        4r2222 4r2222
+                        4r3333 4r3333
+                        4r3333 4r3333
+                     ].
      (i asFloydSteinbergDitheredMonochromeFormOn:Display) inspect.
     "
 
@@ -4441,14 +4501,14 @@
      |i|
 
      i := Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			].
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ].
      i := i magnifiedBy:30.
      i inspect.
      i asFloydSteinbergDitheredMonochromeImage inspect.
@@ -4468,22 +4528,22 @@
 
     deviceDepth := aDevice depth.
     has8BitImage := (deviceDepth == 8)
-		    or:[ (aDevice supportedImageFormatForDepth:8) notNil ].
+                    or:[ (aDevice supportedImageFormatForDepth:8) notNil ].
 
     has8BitImage ifFalse:[
-	deviceDepth == 4 ifFalse:[^ nil].
-
-	pseudoBits8 := self nfloydSteinbergDitheredDepth8BitsColors:colors.
-	pseudoBits8 isNil ifTrue:[^ nil].
-	"/ convert to devices depth
-
-	pseudoBits := ByteArray new:(width*4+7//8 * height).
-	pseudoBits8 compressPixels:4 width:width height:height into:pseudoBits mapping:nil.
-	d := 4.
+        deviceDepth == 4 ifFalse:[^ nil].
+
+        pseudoBits8 := self nfloydSteinbergDitheredDepth8BitsColors:colors.
+        pseudoBits8 isNil ifTrue:[^ nil].
+        "/ convert to devices depth
+
+        pseudoBits := ByteArray new:(width*4+7//8 * height).
+        pseudoBits8 compressPixels:4 width:width height:height into:pseudoBits mapping:nil.
+        d := 4.
     ] ifTrue:[
-	pseudoBits := self nfloydSteinbergDitheredDepth8BitsColors:colors.
-	pseudoBits isNil ifTrue:[^ nil].
-	d := 8.
+        pseudoBits := self nfloydSteinbergDitheredDepth8BitsColors:colors.
+        pseudoBits isNil ifTrue:[^ nil].
+        d := 8.
     ].
 
     f := Form width:width height:height depth:deviceDepth onDevice:aDevice.
@@ -4495,23 +4555,23 @@
     "/
     map := Array new:256 withAll:0.
     colors do:[:clr |
-	clr notNil ifTrue:[
-	    map at:clr colorId + 1 put:clr
-	]
+        clr notNil ifTrue:[
+            map at:clr colorId + 1 put:clr
+        ]
     ].
     f colorMap:map.
     f initGC.
     f bits:pseudoBits.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:d
-	depth:deviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id) x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:d
+        depth:deviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id) x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "
@@ -4540,70 +4600,70 @@
     ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
 
     mask notNil ifTrue:[
-	mask := mask onDevice:aDevice
+        mask := mask onDevice:aDevice
     ].
     bytes isNil ifTrue:[
-	pixelFunction notNil ifTrue:[
-	    self computeBitsFromPixelFunction.
-	]
+        pixelFunction notNil ifTrue:[
+            self computeBitsFromPixelFunction.
+        ]
     ].
 
     (aDevice depth == 1
     or:[aDevice hasGrayscales not]) ifTrue:[
-	form := self asMonochromeFormOn:aDevice.
+        form := self asMonochromeFormOn:aDevice.
     ] ifFalse:[
-	((visual := aDevice visualType) == #StaticGray) ifTrue:[
-	    form := self asGrayFormOn:aDevice.
-	] ifFalse:[
-	    (visual == #PseudoColor
-	     or:[visual == #StaticColor]) ifTrue:[
-		form := self asPseudoFormQuickOn:aDevice.
-	    ].
-	]
+        ((visual := aDevice visualType) == #StaticGray) ifTrue:[
+            form := self asGrayFormOn:aDevice.
+        ] ifFalse:[
+            (visual == #PseudoColor
+             or:[visual == #StaticColor]) ifTrue:[
+                form := self asPseudoFormQuickOn:aDevice.
+            ].
+        ]
     ].
 
     form isNil ifTrue:[
-	"/ kludge: repair a 'should not happen' situation...
-	photometric isNil ifTrue:[ self repairPhotometric ].
-
-	(photometric == #palette) ifTrue:[
-	    form := self paletteImageAsFormOn:aDevice
-	] ifFalse:[
-	    (photometric == #rgb or:[photometric == #rgba or:[photometric == #argb]]) ifTrue:[
-		form := self rgbImageAsFormOn:aDevice
-	    ] ifFalse:[
-		(photometric == #cmy or:[photometric == #cmyk]) ifTrue:[
-		    form := self rgbImageAsFormOn:aDevice
-		] ifFalse:[
-		    form := self greyImageAsFormOn:aDevice
-		]
-	    ]
-	].
+        "/ kludge: repair a 'should not happen' situation...
+        photometric isNil ifTrue:[ self repairPhotometric ].
+
+        (photometric == #palette) ifTrue:[
+            form := self paletteImageAsFormOn:aDevice
+        ] ifFalse:[
+            (photometric == #rgb or:[photometric == #rgba or:[photometric == #argb]]) ifTrue:[
+                form := self rgbImageAsFormOn:aDevice
+            ] ifFalse:[
+                (photometric == #cmy or:[photometric == #cmyk]) ifTrue:[
+                    form := self rgbImageAsFormOn:aDevice
+                ] ifFalse:[
+                    form := self greyImageAsFormOn:aDevice
+                ]
+            ]
+        ].
     ].
 
     (device isNil or:[aDevice == device]) ifTrue:[
-	"remember this form in the receiver ..."
-
-	form notNil ifTrue:[
-	    form := form asImageForm.
-	    deviceForm := form.
-	    maskedPixelsAre0 := nil.
-	    device isNil ifTrue:[
-		device := aDevice.
-		Lobby register:self
-	    ] ifFalse:[
-		Lobby registerChange:self
-	    ].
-	    mask notNil ifTrue:[
-		self clearMaskedPixels.
-	    ].
-
-	    "
-	     can save space, by not keeping the images data-bits
-	     twice (here and in the device form)
-	    "
-	    form forgetBits
-	]
+        "remember this form in the receiver ..."
+
+        form notNil ifTrue:[
+            form := form asImageForm.
+            deviceForm := form.
+            maskedPixelsAre0 := nil.
+            device isNil ifTrue:[
+                device := aDevice.
+                Lobby register:self
+            ] ifFalse:[
+                Lobby registerChange:self
+            ].
+            mask notNil ifTrue:[
+                self clearMaskedPixels.
+            ].
+
+            "
+             can save space, by not keeping the images data-bits
+             twice (here and in the device form)
+            "
+            form forgetBits
+        ]
     ].
 
     ^ form
@@ -4642,17 +4702,17 @@
     depth := aDevice depth.
     (depth == 1
     or:[aDevice hasGrayscales not]) ifTrue:[
-	^ self asMonochromeFormOn:aDevice
+        ^ self asMonochromeFormOn:aDevice
     ].
 
     (aDitherAlgorithm isNil
     or:[aDitherAlgorithm == #threshold]) ifTrue:[
-	^ self asThresholdGrayFormOn:aDevice
+        ^ self asThresholdGrayFormOn:aDevice
     ].
 
     (aDitherAlgorithm == #pattern
     or:[aDitherAlgorithm == #ordered]) ifTrue:[
-	^ self asOrderedDitheredGrayFormOn:aDevice
+        ^ self asOrderedDitheredGrayFormOn:aDevice
     ].
 
     ^ self asFloydSteinbergDitheredGrayFormOn:aDevice.
@@ -4666,7 +4726,7 @@
 
     ((self colorMap notNil and:[depth <= 8 and:[depth >= self depth]])
     or:[ self depth >= 8 "do need for dither" ]) ifTrue:[
-	^ self copyWithColorMapProcessing:[:clr | Color brightness:(clr brightness)].
+        ^ self copyWithColorMapProcessing:[:clr | Color brightness:(clr brightness)].
     ].
     ^ self asGrayImageDepth:depth dither:DitherAlgorithm.
 
@@ -4686,12 +4746,12 @@
 
     (aDitherAlgorithm isNil
     or:[aDitherAlgorithm == #threshold]) ifTrue:[
-	^ self asThresholdGrayImageDepth:depth
+        ^ self asThresholdGrayImageDepth:depth
     ].
 
     (aDitherAlgorithm == #pattern
     or:[aDitherAlgorithm == #ordered]) ifTrue:[
-	^ self asOrderedDitheredGrayImageDepth:depth
+        ^ self asOrderedDitheredGrayImageDepth:depth
     ].
 
     ^ self asFloydSteinbergDitheredGrayImageDepth:depth
@@ -4732,30 +4792,30 @@
 
     ((aDevice == device) and:[monoDeviceForm notNil]) ifTrue:[^ monoDeviceForm].
     self depth == 1 ifTrue:[
-	((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
-	^ self asFormOn:aDevice
+        ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
+        ^ self asFormOn:aDevice
     ].
 
     form := self asMonochromeFormOn:aDevice dither:DitherAlgorithm.
 
     (device isNil or:[aDevice == device]) ifTrue:[
-	"remember this form in the receiver ..."
-
-	form notNil ifTrue:[
-	    form := form asImageForm.
-	    monoDeviceForm := form.
-	    device isNil ifTrue:[
-		device := aDevice.
-		Lobby register:self
-	    ] ifFalse:[
-		Lobby registerChange:self
-	    ].
-	    "
-	     can save space, by not keeping the images data-bits
-	     twice (here and in the device form)
-	    "
-	    form forgetBits
-	]
+        "remember this form in the receiver ..."
+
+        form notNil ifTrue:[
+            form := form asImageForm.
+            monoDeviceForm := form.
+            device isNil ifTrue:[
+                device := aDevice.
+                Lobby register:self
+            ] ifFalse:[
+                Lobby registerChange:self
+            ].
+            "
+             can save space, by not keeping the images data-bits
+             twice (here and in the device form)
+            "
+            form forgetBits
+        ]
     ].
 
     ^ form
@@ -4777,22 +4837,22 @@
 
     (aDitherAlgorithm isNil
     or:[aDitherAlgorithm == #threshold]) ifTrue:[
-	^ self asThresholdMonochromeFormOn:aDevice
+        ^ self asThresholdMonochromeFormOn:aDevice
     ].
 
     aDitherAlgorithm == #burkes ifTrue:[
-	monoBits := self burkesDitheredMonochromeBits.
+        monoBits := self burkesDitheredMonochromeBits.
     ] ifFalse:[
-	aDitherAlgorithm == #stevensonArce ifTrue:[
-	    monoBits := self stevensonArceDitheredMonochromeBits.
-	] ifFalse:[
-	    (aDitherAlgorithm == #pattern
-	    or:[aDitherAlgorithm == #ordered]) ifTrue:[
-		^ self asOrderedDitheredGrayFormOn:aDevice.
-	    ] ifFalse:[
-		^ self asFloydSteinbergDitheredMonochromeFormOn:aDevice.
-	    ]
-	]
+        aDitherAlgorithm == #stevensonArce ifTrue:[
+            monoBits := self stevensonArceDitheredMonochromeBits.
+        ] ifFalse:[
+            (aDitherAlgorithm == #pattern
+            or:[aDitherAlgorithm == #ordered]) ifTrue:[
+                ^ self asOrderedDitheredGrayFormOn:aDevice.
+            ] ifFalse:[
+                ^ self asFloydSteinbergDitheredMonochromeFormOn:aDevice.
+            ]
+        ]
     ].
 
     "/
@@ -4814,32 +4874,32 @@
 
     "
      example:
-	color reduction from Depth8 to Depth4 can be done by:
+        color reduction from Depth8 to Depth4 can be done by:
 
      |img8 reducedImg8 img4 map form|
 
      map := #(
-		  (0     0   0)
-		  (0     0 100)
-		  (0    50   0)
-		  (0    50 100)
-		  (0   100   0)
-		  (0   100 100)
-		  (100   0   0)
-		  (100   0 100)
-		  (100  50   0)
-		  (100  50 100)
-		  (100 100   0)
-		  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
-						      green:(rgb at:2)
-						       blue:(rgb at:3)) onDevice:Display].
+                  (0     0   0)
+                  (0     0 100)
+                  (0    50   0)
+                  (0    50 100)
+                  (0   100   0)
+                  (0   100 100)
+                  (100   0   0)
+                  (100   0 100)
+                  (100  50   0)
+                  (100  50 100)
+                  (100 100   0)
+                  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+                                                      green:(rgb at:2)
+                                                       blue:(rgb at:3)) onDevice:Display].
 
      img8 := Image fromFile:'goodies/bitmaps/claus.gif'.
      form := img8 asNearestPaintDepth8FormOn:Display
-		      colors:map
-			nRed:2
-		      nGreen:3
-		       nBlue:2.
+                      colors:map
+                        nRed:2
+                      nGreen:3
+                       nBlue:2.
      img8 := Depth8Image fromForm:form.    'dithered version of original image'.
      img4 := Depth4Image fromImage:img8.
     "
@@ -4861,9 +4921,9 @@
 
     deviceDepth := aDevice depth.
     deviceDepth == 8 ifFalse:[
-	(aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
-	    ^ nil
-	]
+        (aDevice supportedImageFormatForDepth:8) isNil ifTrue:[
+            ^ nil
+        ]
     ].
 
     pseudoBits := self nearestPaintDepth8BitsColors:fixColors nRed:nRed nGreen:nGreen nBlue:nBlue.
@@ -4878,51 +4938,51 @@
     "/
     map := Array new:256.
     fixColors do:[:clr |
-	map at:clr colorId + 1 put:clr
+        map at:clr colorId + 1 put:clr
     ].
     f colorMap:map.
     f initGC.
     f bits:pseudoBits.
     aDevice
-	drawBits:pseudoBits
-	bitsPerPixel:8
-	depth:deviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id) x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:pseudoBits
+        bitsPerPixel:8
+        depth:deviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id) x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "
      example:
-	color reduction from Depth8 to Depth4 (dithering) can be done by:
+        color reduction from Depth8 to Depth4 (dithering) can be done by:
 
      |img8 reducedImg8 img4 map form|
 
      map := #(
-		  (0     0   0)
-		  (0     0 100)
-		  (0    50   0)
-		  (0    50 100)
-		  (0   100   0)
-		  (0   100 100)
-		  (100   0   0)
-		  (100   0 100)
-		  (100  50   0)
-		  (100  50 100)
-		  (100 100   0)
-		  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
-						      green:(rgb at:2)
-						       blue:(rgb at:3)) onDevice:Display].
+                  (0     0   0)
+                  (0     0 100)
+                  (0    50   0)
+                  (0    50 100)
+                  (0   100   0)
+                  (0   100 100)
+                  (100   0   0)
+                  (100   0 100)
+                  (100  50   0)
+                  (100  50 100)
+                  (100 100   0)
+                  (100 100 100)) collect:[:rgb | (Color red:(rgb at:1)
+                                                      green:(rgb at:2)
+                                                       blue:(rgb at:3)) onDevice:Display].
 
      img8 := Image fromFile:'goodies/bitmaps/claus.gif'.
      form := img8 asNearestPaintDepth8FormOn:Display
-		      colors:map
-			nRed:2
-		      nGreen:3
-		       nBlue:2.
+                      colors:map
+                        nRed:2
+                      nGreen:3
+                       nBlue:2.
      img8 := Depth8Image fromForm:form.    'dithered version of original image'.
      img4 := Depth4Image fromImage:img8.
     "
@@ -4937,11 +4997,11 @@
     |newBits|
 
     d ~~ 8 ifTrue:[
-	self error:'unsupported depth'
+        self error:'unsupported depth'
     ].
     newBits := self nearestPaintDepth8BitsColors:colors nRed:nil nGreen:nil nBlue:nil.
     newBits isNil ifTrue:[
-	self error:'conversion failed'
+        self error:'conversion failed'
     ].
     ^ (self class newForDepth:d) extent:(self extent); depth:d; palette:colors; bits:newBits
 !
@@ -4955,16 +5015,16 @@
     depth := aDevice depth.
     (depth == 1
     or:[aDevice hasGrayscales not]) ifTrue:[
-	"/ for monochrome, there is highly specialized
-	"/ monochrome dither code available
-
-	^ self asOrderedDitheredMonochromeFormOn:aDevice
+        "/ for monochrome, there is highly specialized
+        "/ monochrome dither code available
+
+        ^ self asOrderedDitheredMonochromeFormOn:aDevice
     ].
 
     bits := self
-		orderedDitheredGrayBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
-		ditherWidth:8
-		depth:depth.
+                orderedDitheredGrayBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
+                ditherWidth:8
+                depth:depth.
 
     ^ self makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
 
@@ -4987,26 +5047,26 @@
     dither := self class orderedDitherMatrixOfSize:8.
 
     (depth == 1) ifTrue:[
-	"/ for monochrome, there is highly specialized
-	"/ monochrome dither code available
-
-	^ Depth1Image
-	    width:width
-	    height:height
-	    fromArray:(
-		self
-		    orderedDitheredMonochromeBitsWithDitherMatrix:dither
-		    ditherWidth:8)
+        "/ for monochrome, there is highly specialized
+        "/ monochrome dither code available
+
+        ^ Depth1Image
+            width:width
+            height:height
+            fromArray:(
+                self
+                    orderedDitheredMonochromeBitsWithDitherMatrix:dither
+                    ditherWidth:8)
     ].
 
     ^ (self class implementorForDepth:depth)
-	width:width
-	height:height
-	fromArray:(
-	    self
-		orderedDitheredGrayBitsWithDitherMatrix:dither
-		ditherWidth:8
-		depth:depth)
+        width:width
+        height:height
+        fromArray:(
+            self
+                orderedDitheredGrayBitsWithDitherMatrix:dither
+                ditherWidth:8
+                depth:depth)
 
     "
      |i i1 i2 i4 i8|
@@ -5061,9 +5121,9 @@
     "/ 4x4 for small number of colors ...
 
     ^ self
-	asOrderedDitheredMonochromeFormOn:aDevice
-	ditherMatrix:(self class orderedDitherMatrixOfSize:4)
-	ditherWidth:4
+        asOrderedDitheredMonochromeFormOn:aDevice
+        ditherMatrix:(self class orderedDitherMatrixOfSize:4)
+        ditherWidth:4
 
 "/    ^ self
 "/        asOrderedDitheredMonochromeFormOn:aDevice
@@ -5151,8 +5211,8 @@
     "/ 4x4 for small number of colors ...
 
     ^ self
-	asOrderedDitheredMonochromeImageWithDitherMatrix:(self class orderedDitherMatrixOfSize:4)
-	ditherWidth:4
+        asOrderedDitheredMonochromeImageWithDitherMatrix:(self class orderedDitherMatrixOfSize:4)
+        ditherWidth:4
 
 "/    ^ self
 "/        asOrderedDitheredMonochromeImageWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
@@ -5208,8 +5268,8 @@
 
      i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      i
-	asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:4)
-	ditherWidth:4
+        asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:4)
+        ditherWidth:4
     "
 
     "order-6 dither:
@@ -5218,8 +5278,8 @@
 
      i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      i
-	asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:8)
-	ditherWidth:8
+        asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:8)
+        ditherWidth:8
     "
 
 
@@ -5229,8 +5289,8 @@
 
      i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      i
-	asOrderedDitheredMonochromeImageWithDitherMatrix:(ByteArray new:16 withAll:8)
-	ditherWidth:4
+        asOrderedDitheredMonochromeImageWithDitherMatrix:(ByteArray new:16 withAll:8)
+        ditherWidth:4
     "
 
     "thresholding at: 0.25 (all above 0.25 becomes white):
@@ -5239,8 +5299,8 @@
 
      i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      i
-	asOrderedDitheredMonochromeImageWithDitherMatrix:(ByteArray new:16 withAll:3)
-	ditherWidth:4
+        asOrderedDitheredMonochromeImageWithDitherMatrix:(ByteArray new:16 withAll:3)
+        ditherWidth:4
     "
 
     "thresholding at: 0.75 (all above 0.75 becomes white):
@@ -5249,8 +5309,8 @@
 
      i := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      i
-	asOrderedDitheredMonochromeImageWithDitherMatrix:(ByteArray new:16 withAll:11)
-	ditherWidth:4
+        asOrderedDitheredMonochromeImageWithDitherMatrix:(ByteArray new:16 withAll:11)
+        ditherWidth:4
     "
 
     "Modified: 7.6.1996 / 17:23:47 / cg"
@@ -5284,18 +5344,18 @@
 
     dDev := aDevice depth.
     (bytesPerLine := dDev) == 8 ifFalse:[
-	bytesPerLine := (w * dDev + 7) // 8.
+        bytesPerLine := (w * dDev + 7) // 8.
     ].
 
     fmt := aDevice supportedImageFormatForDepth:dDev.
     fmt isNil ifTrue:[
-	"/ cannot draw directly
-	^ nil
+        "/ cannot draw directly
+        ^ nil
     ].
     (bytesPerLine * 8) \\ (fmt at:#padding) == 0 ifFalse:[
-	"/ mhmh - ought to repad here;
-	"/ however, the nonQuick converter does it.
-	^ nil
+        "/ mhmh - ought to repad here;
+        "/ however, the nonQuick converter does it.
+        ^ nil
     ].
 
     "/ see if all of the images colors are representable
@@ -5307,78 +5367,78 @@
     idMap := ByteArray new:nClr.
 
     photometric == #palette ifTrue:[
-	nClr := nClr min:(colorMap size)
+        nClr := nClr min:(colorMap size)
     ].
 
     d == 8 ifTrue:[
-	usedColors := bytes usedValues.    "gets us an array filled with used values"
-	1 to:nClr do:[:pixel |
-	    (usedColors includes:(pixel - 1)) ifFalse:[
-		clr := Color black
-	    ] ifTrue:[
-		clr := self colorFromValue:pixel-1.
-		clr := clr exactOn:aDevice.
-		clr isNil ifTrue:[^ nil].
-	    ].
-	    (pix := clr colorId) isNil ifTrue:[^ nil].
-
-	    cMap at:(pixel) put:clr.
-	    idMap at:(pixel) put:pix.
-	].
+        usedColors := bytes usedValues.    "gets us an array filled with used values"
+        1 to:nClr do:[:pixel |
+            (usedColors includes:(pixel - 1)) ifFalse:[
+                clr := Color black
+            ] ifTrue:[
+                clr := self colorFromValue:pixel-1.
+                clr := clr exactOn:aDevice.
+                clr isNil ifTrue:[^ nil].
+            ].
+            (pix := clr colorId) isNil ifTrue:[^ nil].
+
+            cMap at:(pixel) put:clr.
+            idMap at:(pixel) put:pix.
+        ].
     ] ifFalse:[
-	1 to:nClr do:[:pixel |
-	    clr := self colorFromValue:pixel-1.
-	    clr := clr exactOn:aDevice.
-	    clr isNil ifTrue:[^ nil].
-	    (pix := clr colorId) isNil ifTrue:[^ nil].
-
-	    cMap at:(pixel) put:clr.
-	    idMap at:(pixel) put:pix.
-	].
+        1 to:nClr do:[:pixel |
+            clr := self colorFromValue:pixel-1.
+            clr := clr exactOn:aDevice.
+            clr isNil ifTrue:[^ nil].
+            (pix := clr colorId) isNil ifTrue:[^ nil].
+
+            cMap at:(pixel) put:clr.
+            idMap at:(pixel) put:pix.
+        ].
     ].
 
     "/ got all colors; good - simply change depth & translate pixels
 
     (d == 8 and:[dDev == 8]) ifTrue:[
-	"/ only translate
-	temp := ByteArray uninitializedNew:(w * h).
-	bytes expandPixels:8         "xlate only"
-		    width:w
-		   height:h
-		     into:temp
-		  mapping:idMap.
+        "/ only translate
+        temp := ByteArray uninitializedNew:(w * h).
+        bytes expandPixels:8         "xlate only"
+                    width:w
+                   height:h
+                     into:temp
+                  mapping:idMap.
     ] ifFalse:[
-	"/ stupid: expandPixels can only handle any-to-8
-	"/ compressPixels can only handle 8-to-any
-	"/ However, those methods are faster
-	"/ - even if we convert twice.
-	"/ Therefore, convert first from myDepth to 8,
-	"/ then from 8 to the device depth.
-
-	d ~~ 8 ifTrue:[
-	    temp8 := ByteArray uninitializedNew:(w * h).
-
-	    bytes expandPixels:d
-			 width:w
-			height:h
-			  into:temp8
-		       mapping:idMap.
-	    idMap := nil.
-	] ifFalse:[
-	    temp8 := bytes.
-	].
-
-	dDev ~~ 8 ifTrue:[
-	    temp := ByteArray uninitializedNew:(bytesPerLine * h).
-
-	    temp8 compressPixels:dDev
-			 width:w
-			height:h
-			  into:temp
-		       mapping:idMap.
-	] ifFalse:[
-	    temp := temp8
-	].
+        "/ stupid: expandPixels can only handle any-to-8
+        "/ compressPixels can only handle 8-to-any
+        "/ However, those methods are faster
+        "/ - even if we convert twice.
+        "/ Therefore, convert first from myDepth to 8,
+        "/ then from 8 to the device depth.
+
+        d ~~ 8 ifTrue:[
+            temp8 := ByteArray uninitializedNew:(w * h).
+
+            bytes expandPixels:d
+                         width:w
+                        height:h
+                          into:temp8
+                       mapping:idMap.
+            idMap := nil.
+        ] ifFalse:[
+            temp8 := bytes.
+        ].
+
+        dDev ~~ 8 ifTrue:[
+            temp := ByteArray uninitializedNew:(bytesPerLine * h).
+
+            temp8 compressPixels:dDev
+                         width:w
+                        height:h
+                          into:temp
+                       mapping:idMap.
+        ] ifFalse:[
+            temp := temp8
+        ].
     ].
 
     f := Form width:w height:h depth:dDev onDevice:aDevice.
@@ -5388,33 +5448,33 @@
     f initGC.
 
     aDevice
-	drawBits:temp
-	depth:dDev
-	padding:8
-	width:w
-	height:h
-	x:0 y:0
-	into:(f id) x:0 y:0
-	width:w
-	height:h
-	with:(f gcId).
+        drawBits:temp
+        depth:dDev
+        padding:8
+        width:w
+        height:h
+        x:0 y:0
+        into:(f id) x:0 y:0
+        width:w
+        height:h
+        with:(f gcId).
 
     ^ f
 
     "
      (
-	(((Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			]))
-	       magnifiedBy:30
-	 )
-	  asPseudoFormQuickOn:Display
+        (((Depth4Image
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ]))
+               magnifiedBy:30
+         )
+          asPseudoFormQuickOn:Display
       ) inspect
      "
 
@@ -5425,7 +5485,7 @@
     "return a stevenson-arce dithered monochrome image from the receiver image.
      Depending on the images contents, this may or may not look better than
      a floyd-steinberg dithered image.
-     Notice, that floyd-steinberg dithering is faster; both because less
+     Notice that floyd-steinberg dithering is faster; both because less
      error diffusion is done and due to being specially tuned."
 
     |monoBits|
@@ -5460,14 +5520,14 @@
      |i|
 
      i := Depth4Image
-	     width:4
-	     height:4
-	     fromArray:#[
-			    16r01 16r23
-			    16r45 16r67
-			    16r89 16rab
-			    16rcd 16ref
-			].
+             width:4
+             height:4
+             fromArray:#[
+                            16r01 16r23
+                            16r45 16r67
+                            16r89 16rab
+                            16rcd 16ref
+                        ].
      i := i magnifiedBy:30.
      i inspect.
      i asStevensonArceDitheredMonochromeImage inspect.
@@ -5484,16 +5544,16 @@
     |depth|
 
     (depth := aDevice depth) == 1 ifTrue:[
-	^ self asThresholdMonochromeFormOn:aDevice
+        ^ self asThresholdMonochromeFormOn:aDevice
     ].
 
     ^ self
-	makeDeviceGrayPixmapOn:aDevice
-	depth:depth
-	fromArray:(self
-			orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
-			ditherWidth:4
-			depth:depth)
+        makeDeviceGrayPixmapOn:aDevice
+        depth:depth
+        fromArray:(self
+                        orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+                        ditherWidth:4
+                        depth:depth)
 
     "
      |i|
@@ -5510,26 +5570,26 @@
     "return a thresholded depth-x grey image from the receiver image."
 
     (depth == 1) ifTrue:[
-	"/ for monochrome, there is highly specialized
-	"/ monochrome dither code available
-
-	^ Depth1Image
-	    width:width
-	    height:height
-	    fromArray:(
-		self
-		    orderedDitheredMonochromeBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
-		    ditherWidth:4)
+        "/ for monochrome, there is highly specialized
+        "/ monochrome dither code available
+
+        ^ Depth1Image
+            width:width
+            height:height
+            fromArray:(
+                self
+                    orderedDitheredMonochromeBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+                    ditherWidth:4)
     ].
 
     ^ (self class implementorForDepth:depth)
-	width:width
-	height:height
-	fromArray:(
-	    self
-		orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
-		ditherWidth:4
-		depth:depth)
+        width:width
+        height:height
+        fromArray:(
+            self
+                orderedDitheredGrayBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+                ditherWidth:4
+                depth:depth)
 
     "
      |i|
@@ -5559,9 +5619,9 @@
     "return a threshold monochrome form from the image."
 
     ^ self
-	asOrderedDitheredMonochromeFormOn:aDevice
-	ditherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
-	ditherWidth:4
+        asOrderedDitheredMonochromeFormOn:aDevice
+        ditherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+        ditherWidth:4
 
     "
      |i|
@@ -5601,8 +5661,8 @@
      Threshold means: brightness < 0.5 -> black / otherwise white"
 
     ^ self
-	asOrderedDitheredMonochromeImageWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
-	ditherWidth:4
+        asOrderedDitheredMonochromeImageWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+        ditherWidth:4
 
     "
      |i i2|
@@ -5644,17 +5704,17 @@
     ditherMatrix := ByteArray new:256 withAll:(value truncated).
 
     ^ self
-	asOrderedDitheredMonochromeImageWithDitherMatrix:ditherMatrix
-	ditherWidth:16
+        asOrderedDitheredMonochromeImageWithDitherMatrix:ditherMatrix
+        ditherWidth:16
 
     "
      |i|
 
      i := Image width:4 height:4 depth:4
-		fromArray:#[ 16r01 16r23
-			     16r45 16r67
-			     16r89 16rab
-			     16rcd 16ref ].
+                fromArray:#[ 16r01 16r23
+                             16r45 16r67
+                             16r89 16rab
+                             16rcd 16ref ].
      i := i magnifiedBy:30.
      i inspect.
      (i asThresholdMonochromeImage:0.125) inspect.
@@ -5690,11 +5750,7 @@
     deviceForm isNil ifTrue:[^ self].   "/ no device rep.
     mask depth ~~ 1 ifTrue:[^ self].    "/ not done with alpha masks
 
-    deviceForm
-	foreground:Color allColor background:Color noColor function:#and;
-	copyPlaneFrom:(mask asFormOn:device) x:0 y:0 toX:0 y:0 width:width height:height.
-
-"/    deviceForm clearMaskedPixels:(mask asFormOn:device).
+    deviceForm clearMaskedPixels:(mask asFormOn:device).
     maskedPixelsAre0 := true.
 
 
@@ -5725,9 +5781,9 @@
     samplesPerPixel := self samplesPerPixel.
 
     aForm hasBits ifFalse:[
-	"/ must read the data from the device
-	self from:aForm in:(0@0 extent:aForm extent).
-	^ self
+        "/ must read the data from the device
+        self from:aForm in:(0@0 extent:aForm extent).
+        ^ self
     ].
 
     "/ the form has all data available
@@ -5736,34 +5792,34 @@
     map := aForm colorMap.
 
     aForm depth == 1 ifTrue:[
-	map isNil ifTrue:[
-	    photometric := #whiteIs0
-	] ifFalse:[
-	    c0 := map at:1.
-	    c1 := map at:2.
-	    ((c0 = Color white)
-	    and:[c1 = Color black]) ifTrue:[
-		photometric := #whiteIs0
-	    ] ifFalse:[
-		((c0 = Color black)
-		and:[c1 = Color white]) ifTrue:[
-		    photometric := #blackIs0
-		] ifFalse:[
-		    photometric := #palette.
-		    self setColorMap:(Array with:c0 with:c1).
-		]
-	    ]
-	]
+        map isNil ifTrue:[
+            photometric := #whiteIs0
+        ] ifFalse:[
+            c0 := map at:1.
+            c1 := map at:2.
+            ((c0 = Color white)
+            and:[c1 = Color black]) ifTrue:[
+                photometric := #whiteIs0
+            ] ifFalse:[
+                ((c0 = Color black)
+                and:[c1 = Color white]) ifTrue:[
+                    photometric := #blackIs0
+                ] ifFalse:[
+                    photometric := #palette.
+                    self setColorMap:(Array with:c0 with:c1).
+                ]
+            ]
+        ]
     ] ifFalse:[
-	map notNil ifTrue:[
-	    photometric := #palette.
-	    self setColorMap:(map copy).
-	] ifFalse:[
-	    "
-	     photometric stays at default
-	     (which is rgb for d24, greyscale for others)
-	    "
-	]
+        map notNil ifTrue:[
+            photometric := #palette.
+            self setColorMap:(map copy).
+        ] ifFalse:[
+            "
+             photometric stays at default
+             (which is rgb for d24, greyscale for others)
+            "
+        ]
     ].
 
     "Modified: 5.7.1996 / 16:24:31 / cg"
@@ -5800,18 +5856,18 @@
     samplesPerPixel := self samplesPerPixel.
 
     photometricOrNil isNil ifTrue:[
-	photometric := self class defaultPhotometric
-	"/ photometric := anImage photometric
+        photometric := self class defaultPhotometric
+        "/ photometric := anImage photometric
     ] ifFalse:[
-	photometricOrNil == #rgba ifTrue:[
-	    samplesPerPixel == 3 ifTrue:[ photometric := #rgb ]
-	] ifFalse:[
-	    photometric := photometricOrNil
-	].
+        photometricOrNil == #rgba ifTrue:[
+            samplesPerPixel == 3 ifTrue:[ photometric := #rgb ]
+        ] ifFalse:[
+            photometric := photometricOrNil
+        ].
     ].
 
     photometric == #palette ifTrue:[
-	self colormapFromImage:anImage photometric:photometric.
+        self colormapFromImage:anImage photometric:photometric.
     ].
     self mask:anImage mask.
 
@@ -5820,46 +5876,46 @@
     otherDepth := anImage depth.
 
     ((myDepth = otherDepth) and:[samePhotometric]) ifTrue:[
-	self bits:(anImage bits copy).
-	^ self.
+        self bits:(anImage bits copy).
+        ^ self.
     ].
 
     self bits:(ByteArray new: "uninitializedNew:"(self bytesPerRow * height)).
 
     myDepth >= otherDepth ifTrue:[
-	otherDepth <= 12 ifTrue:[
-
-	    "/ if my depth is greater, all colors can be represented,
-	    "/ and the loop can be done over pixel values ...
-
-	    (colorMap isNil or:[samePhotometric not]) ifTrue:[
-		map := Array new:(1 bitShift:otherDepth).
-		1 to:map size do:[:i |
-		    clr := anImage colorFromValue:(i - 1).
-		    map at:i put:(self valueFromColor:clr).
-		].
-	    ].
-	    mappedRowPixels := self pixelArraySpecies new:width.
-	    h := height-1.
-	    w := width.
-	    0 to:h do:[:row |
-		anImage rowAt:row into:mappedRowPixels startingAt:1.
-		map notNil ifTrue:[
-		    1 to:w do:[:i |
-			mappedRowPixels at:i put:(map at:(mappedRowPixels at:i)+1)
-		    ].
-		].
-		self rowAt:row putAll:mappedRowPixels
-	    ].
-	    ^ self
-	].
+        otherDepth <= 12 ifTrue:[
+
+            "/ if my depth is greater, all colors can be represented,
+            "/ and the loop can be done over pixel values ...
+
+            (colorMap isNil or:[samePhotometric not]) ifTrue:[
+                map := Array new:(1 bitShift:otherDepth).
+                1 to:map size do:[:i |
+                    clr := anImage colorFromValue:(i - 1).
+                    map at:i put:(self valueFromColor:clr).
+                ].
+            ].
+            mappedRowPixels := self pixelArraySpecies new:width.
+            h := height-1.
+            w := width.
+            0 to:h do:[:row |
+                anImage rowAt:row into:mappedRowPixels startingAt:1.
+                map notNil ifTrue:[
+                    1 to:w do:[:i |
+                        mappedRowPixels at:i put:(map at:(mappedRowPixels at:i)+1)
+                    ].
+                ].
+                self rowAt:row putAll:mappedRowPixels
+            ].
+            ^ self
+        ].
     ].
 
     "/ a hack, for now - alpha is in the low-byte !!!!!!
     (myDepth == 24 and:[otherDepth == 32]) ifTrue:[
-	(samePhotometric and:[photometric == #rgb]) ifTrue:[
-	    "/ can do the bits by simple stripping off the alpha channel
-	    self copyPixels32AlphaLowTo24From:anImage.
+        (samePhotometric and:[photometric == #rgb]) ifTrue:[
+            "/ can do the bits by simple stripping off the alpha channel
+            self copyPixels32AlphaLowTo24From:anImage.
 "/    anImage valuesFromX:0 y:0 toX:(width-1) y:(height-1) do:[:x :y :pixel |
 "/        |a r g b rgbPixel|
 "/
@@ -5871,12 +5927,12 @@
 "/        rgbPixel := r + (g bitShift:8) + (b bitShift:16).
 "/        self pixelAtX:x y:y put:rgbPixel
 "/    ].
-	    ^ self
-	].
+            ^ self
+        ].
     ].
 
     anImage colorsFromX:0 y:0 toX:(width-1) y:(height-1) do:[:x :y :clr |
-	self colorAtX:x y:y put:clr
+        self colorAtX:x y:y put:clr
     ].
 
     "
@@ -5901,9 +5957,9 @@
 
      i := Image fromFile:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'.
      Transcript showCR:(
-	Time millisecondsToRun:[
-	    i24 := Depth24Image fromImage:i.
-	]
+        Time millisecondsToRun:[
+            i24 := Depth24Image fromImage:i.
+        ]
      ).
      i24 inspect.
     "
@@ -5912,7 +5968,7 @@
 
      i := Image fromFile:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'.
      MessageTally spyOn:[
-	i24 := Depth24Image fromImage:i.
+        i24 := Depth24Image fromImage:i.
      ]
     "
 
@@ -5935,17 +5991,17 @@
     imgHeight := anImage height.
 
     xL isFloat ifTrue:[
-	xL := (imgWidth * xL) rounded min: imgWidth.
+        xL := (imgWidth * xL) rounded min: imgWidth.
     ].
     yT isFloat ifTrue:[
-	yT := (imgHeight * yT) rounded min:imgHeight.
+        yT := (imgHeight * yT) rounded min:imgHeight.
     ].
     w isFloat ifTrue:[
-	w := (imgWidth * w) rounded.
+        w := (imgWidth * w) rounded.
     ].
     w := w min:(imgWidth - xL).
     h isFloat ifTrue:[
-	h := (imgHeight * h) rounded.
+        h := (imgHeight * h) rounded.
     ].
     h := h min:(imgHeight - yT).
     self fromSubImage:anImage inX:xL y:yT width:w height:h
@@ -5997,24 +6053,24 @@
     ((photometric == anImage photometric)
     and:[self bitsPerPixel = anImage bitsPerPixel
     and:[colorMap = anImage colorMap]]) ifTrue:[
-	"/ can do it by value
-	anImage
-	    valuesFromX:xL y:yT toX:xR y:yB
-	    do:[:x :y :pixelValue | self pixelAtX:x-xL y:y-yT put:pixelValue ]
+        "/ can do it by value
+        anImage
+            valuesFromX:xL y:yT toX:xR y:yB
+            do:[:x :y :pixelValue | self pixelAtX:x-xL y:y-yT put:pixelValue ]
     ] ifFalse:[
-	"/ must do it by colors
-	anImage
-	    colorsFromX:xL y:yT toX:xR y:yB
-	    do:[:x :y :clr | self colorAtX:x-xL y:y-yT put:clr ]
+        "/ must do it by colors
+        anImage
+            colorsFromX:xL y:yT toX:xR y:yB
+            do:[:x :y :clr | self colorAtX:x-xL y:y-yT put:clr ]
     ].
 
     (imagesMask := anImage mask) notNil ifTrue:[
-	imagesMask depth == 1 ifTrue:[
-	    maskClass := ImageMask
-	] ifFalse:[
-	    maskClass := imagesMask class.
-	].
-	mask := maskClass new fromSubImage:imagesMask inX:xL y:yT width:w height:h
+        imagesMask depth == 1 ifTrue:[
+            maskClass := ImageMask
+        ] ifFalse:[
+            maskClass := imagesMask class.
+        ].
+        mask := maskClass new fromSubImage:imagesMask inX:xL y:yT width:w height:h
     ].
 
     "
@@ -6041,10 +6097,10 @@
 
     ((aDevice == device) and:[monoDeviceForm notNil]) ifTrue:[^ self].
     (device notNil and:[aDevice ~~ device]) ifTrue:[
-	"oops, I am already accociated to another device
-	 - need a copy ...
-	"
-	^ self copy monochromeOn:aDevice
+        "oops, I am already accociated to another device
+         - need a copy ...
+        "
+        ^ self copy monochromeOn:aDevice
     ].
     monoDeviceForm := self asMonochromeFormOn:aDevice.
 !
@@ -6081,16 +6137,16 @@
     ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ self].
 
     (device notNil and:[aDevice ~~ device]) ifTrue:[
-	"oops, I am already associated to another device
-	 - need a copy ...
-	"
-	^ self copy onDevice:aDevice
+        "oops, I am already associated to another device
+         - need a copy ...
+        "
+        ^ self copy onDevice:aDevice
     ].
     deviceForm := self asFormOn:aDevice.
     device := aDevice.
     maskedPixelsAre0 := nil.
     mask notNil ifTrue:[
-	self clearMaskedPixels.
+        self clearMaskedPixels.
     ].
     Lobby register:self
 
@@ -6107,7 +6163,7 @@
 
     nPlanes := samplesPerPixel.
     (nPlanes == 2) ifTrue:[
-	'Image [info]: alpha plane ignored' infoPrintCR.
+        'Image [info]: alpha plane ignored' infoPrintCR.
     ].
     "/ first plane only
     pictureDepth := bitsPerSample at:1.
@@ -6115,11 +6171,11 @@
     "monochrome is very easy ..."
 
     (pictureDepth == 1) ifTrue:[
-	^ Form width:width height:height fromArray:self bits onDevice:aDevice
+        ^ Form width:width height:height fromArray:self bits onDevice:aDevice
     ].
 
     (aDevice visualType == #TrueColor) ifTrue:[
-	^ self greyImageAsTrueColorFormOn:aDevice
+        ^ self greyImageAsTrueColorFormOn:aDevice
     ].
 
     "/ PseudoColor conversion also works for StaticColor,
@@ -6143,66 +6199,66 @@
     pictureDepth := bitsPerSample at:1.
 
     (#(2 4 8) includes:pictureDepth) ifFalse:[
-	self error:'currently only depth-2, 4 or 8 supported'.
-	^ nil
+        self error:'currently only depth-2, 4 or 8 supported'.
+        ^ nil
     ].
 
     wideBits := ByteArray uninitializedNew:(width * height).
 
     (pictureDepth == 8) ifTrue:[
-	"for 8bits, we scan for used colors first;
-	 to avoid allocating too many colors"
-
-	(grayColors := aDevice fixGrayColors) notNil ifTrue:[
-	    DitherAlgorithm == #floydSteinberg ifTrue:[
-		f := self
-		       asFloydSteinbergDitheredDepth8FormOn:aDevice
-		       colors:grayColors
-	    ].
-	    f notNil ifTrue:[^ f].
-	].
-
-	(cube := aDevice fixColors) notNil ifTrue:[
-	    nR := aDevice numFixRed.
-	    nG := aDevice numFixGreen.
-	    nB := aDevice numFixBlue.
-
-	    DitherAlgorithm == #floydSteinberg ifTrue:[
-		f := self
-		       asFloydSteinbergDitheredDepth8FormOn:aDevice
-		       colors:cube
-		       nRed:nR
-		       nGreen:nG
-		       nBlue:nB.
-	    ] ifFalse:[
-		f := self
-		       asNearestPaintDepth8FormOn:aDevice
-		       colors:cube
-		       nRed:nR
-		       nGreen:nG
-		       nBlue:nB.
-	    ].
-	    f notNil ifTrue:[^ f].
-	].
-
-	usedColors := self bits usedValues.
-	nUsed := usedColors max + 1.
-
-	colorMap := Array new:nUsed.
-	range := 100 / 255.0.
-	usedColors do:[:grey |
-	    colorMap at:(grey + 1) put:(Color gray:(range * grey))
-	].
+        "for 8bits, we scan for used colors first;
+         to avoid allocating too many colors"
+
+        (grayColors := aDevice fixGrayColors) notNil ifTrue:[
+            DitherAlgorithm == #floydSteinberg ifTrue:[
+                f := self
+                       asFloydSteinbergDitheredDepth8FormOn:aDevice
+                       colors:grayColors
+            ].
+            f notNil ifTrue:[^ f].
+        ].
+
+        (cube := aDevice fixColors) notNil ifTrue:[
+            nR := aDevice numFixRed.
+            nG := aDevice numFixGreen.
+            nB := aDevice numFixBlue.
+
+            DitherAlgorithm == #floydSteinberg ifTrue:[
+                f := self
+                       asFloydSteinbergDitheredDepth8FormOn:aDevice
+                       colors:cube
+                       nRed:nR
+                       nGreen:nG
+                       nBlue:nB.
+            ] ifFalse:[
+                f := self
+                       asNearestPaintDepth8FormOn:aDevice
+                       colors:cube
+                       nRed:nR
+                       nGreen:nG
+                       nBlue:nB.
+            ].
+            f notNil ifTrue:[^ f].
+        ].
+
+        usedColors := self bits usedValues.
+        nUsed := usedColors max + 1.
+
+        colorMap := Array new:nUsed.
+        range := 100 / 255.0.
+        usedColors do:[:grey |
+            colorMap at:(grey + 1) put:(Color gray:(range * grey))
+        ].
     ] ifFalse:[
-	nColors := (1 bitShift:pictureDepth).
-	colorMap := Array new:nColors.
-	range := 100 / (nColors - 1) asFloat.
-	1 to:nColors do:[:i |
-	    colorMap at:i put:(Color gray:(i - 1) * range).
-	].
+        nColors := (1 bitShift:pictureDepth).
+        colorMap := Array new:nColors.
+        range := 100 / (nColors - 1) asFloat.
+        1 to:nColors do:[:i |
+            colorMap at:i put:(Color gray:(i - 1) * range).
+        ].
     ].
     photometric ~~ #blackIs0 ifTrue:[
-	colorMap reverse
+        colorMap reverse
     ].
 
     "allocate those colors & setup the translation map"
@@ -6211,47 +6267,47 @@
     map := ByteArray uninitializedNew:256.
     nColors := colorMap size.
     1 to:nColors do:[:i |
-	aColor := colorMap at:i.
-	aColor notNil ifTrue:[
-	    aColor := aColor onDevice:aDevice.
-	    colorMap at:i put:aColor.
-	    id := aColor colorId.
-	    id isNil ifTrue:[
-		id := 0.
-		fit := false.
-	    ].
-	    map at:i put:id
-	]
+        aColor := colorMap at:i.
+        aColor notNil ifTrue:[
+            aColor := aColor onDevice:aDevice.
+            colorMap at:i put:aColor.
+            id := aColor colorId.
+            id isNil ifTrue:[
+                id := 0.
+                fit := false.
+            ].
+            map at:i put:id
+        ]
     ].
 
     fit ifFalse:[
-	"/ here comes the hard part - some grey value
-	"/ could not be allocated.
-	"/ Must dither.
+        "/ here comes the hard part - some grey value
+        "/ could not be allocated.
+        "/ Must dither.
 
     ].
 
     "expand & translate"
     self bits
-	expandPixels:pictureDepth
-	width:width height:height
-	into:wideBits
-	mapping:map.
+        expandPixels:pictureDepth
+        width:width height:height
+        into:wideBits
+        mapping:map.
 
     f := Form width:width height:height depth:8 onDevice:aDevice.
     f isNil ifTrue:[^ nil].
     f colorMap:colorMap.
     f initGC.
     aDevice
-	drawBits:wideBits
-	depth:8
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id)
-	x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:wideBits
+        depth:8
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id)
+        x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "Modified: 19.10.1997 / 05:19:44 / cg"
@@ -6284,8 +6340,8 @@
     depth := aDevice depth.
     myDepth := self depth.
     myDepth > 16 ifTrue:[
-	self error:'unsupported depth' mayProceed:true.
-	^ nil
+        self error:'unsupported depth' mayProceed:true.
+        ^ nil
     ].
 
     "/ compute scale to map from my pixels into devices range
@@ -6303,21 +6359,21 @@
     nColors := (1 bitShift:myDepth).
     colorValues := Array new:nColors.
     1 to:nColors do:[:colorIdx |
-	|v gv bv rv nv|
-
-	"/ scale down to 0..1
-	v := (colorIdx-1) / scaleDown.
-	rv := (v * scaleRed) truncated.
-	gv := (v * scaleGreen) truncated.
-	bv := (v * scaleBlue) truncated.
-	nv := rv bitShift:redShift.
-	nv := nv bitOr:(gv bitShift:greenShift).
-	nv := nv bitOr:(bv bitShift:blueShift).
-	colorValues at:colorIdx put:nv
+        |v gv bv rv nv|
+
+        "/ scale down to 0..1
+        v := (colorIdx-1) / scaleDown.
+        rv := (v * scaleRed) truncated.
+        gv := (v * scaleGreen) truncated.
+        bv := (v * scaleBlue) truncated.
+        nv := rv bitShift:redShift.
+        nv := nv bitOr:(gv bitShift:greenShift).
+        nv := nv bitOr:(bv bitShift:blueShift).
+        colorValues at:colorIdx put:nv
     ].
     photometric == #whiteIs0 ifTrue:[
-	"/ reverse the order; 0 is brightest
-	colorValues reverse
+        "/ reverse the order; 0 is brightest
+        colorValues reverse
     ].
 
     bestFormat := self bestSupportedImageFormatFor:aDevice.
@@ -6341,12 +6397,12 @@
     newPixelArray := i pixelArraySpecies new:width.
 
     0 to:h do:[:y |
-	self rowAt:y into:pixelArray.
-	0 to:w do:[:x |
-	    greyValue := pixelArray at:(x+1).
-	    newPixelArray at:(x+1) put:(colorValues at:greyValue + 1).
-	].
-	i rowAt:y putAll:newPixelArray.
+        self rowAt:y into:pixelArray.
+        0 to:w do:[:x |
+            greyValue := pixelArray at:(x+1).
+            newPixelArray at:(x+1) put:(colorValues at:greyValue + 1).
+        ].
+        i rowAt:y putAll:newPixelArray.
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
@@ -6354,13 +6410,13 @@
     form initGC.
 
     form
-	copyBitsFrom:imageBits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	toX:0 y:0.
+        copyBitsFrom:imageBits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        toX:0 y:0.
 
     ^ form
 
@@ -6378,27 +6434,27 @@
     ddepth := aDevice depth.
 
     aDevice hasGrayscales ifFalse:[
-	^ self asMonochromeFormOn:aDevice
+        ^ self asMonochromeFormOn:aDevice
     ].
 
     ((type := aDevice visualType) == #StaticGray) ifTrue:[
-	ddepth == 8 ifTrue:[
-	    ^ self paletteImageAsGray8FormOn:aDevice
-	].
-	^ self asGrayFormOn:aDevice
+        ddepth == 8 ifTrue:[
+            ^ self paletteImageAsGray8FormOn:aDevice
+        ].
+        ^ self asGrayFormOn:aDevice
     ].
 
     (type == #TrueColor) ifTrue:[
-	DitherAlgorithm == #floydSteinberg ifTrue:[
-	    ddepth == 8 ifTrue:[
-		self depth == 8 ifTrue:[
-		    "/ use fixColor dither algorithm
-		    ^ self asDitheredTrueColor8FormOn:aDevice
-		]
-	    ]
-	].
-
-	^ self paletteImageAsTrueColorFormOn:aDevice
+        DitherAlgorithm == #floydSteinberg ifTrue:[
+            ddepth == 8 ifTrue:[
+                self depth == 8 ifTrue:[
+                    "/ use fixColor dither algorithm
+                    ^ self asDitheredTrueColor8FormOn:aDevice
+                ]
+            ]
+        ].
+
+        ^ self paletteImageAsTrueColorFormOn:aDevice
     ].
 
     "/ the PseudoColor conversion also works for
@@ -6416,21 +6472,21 @@
 
     d := self depth.
     (#(1 2 4 8) includes:d) ifTrue:[
-	"
-	 fallback code for some depth's:
-	 create a temporary Depth8Image and use its conversion method
-	"
-	temp8 := ByteArray uninitializedNew:(width * height).
-
-	self bits
-	    expandPixels:d
-	    width:width height:height
-	    into:temp8
-	    mapping:nil.
-
-	tempImage := Image width:width height:height depth:8 fromArray:temp8.
-	tempImage colorMap:colorMap.
-	^ tempImage paletteImageAsPseudoFormOn:aDevice
+        "
+         fallback code for some depth's:
+         create a temporary Depth8Image and use its conversion method
+        "
+        temp8 := ByteArray uninitializedNew:(width * height).
+
+        self bits
+            expandPixels:d
+            width:width height:height
+            into:temp8
+            mapping:nil.
+
+        tempImage := Image width:width height:height depth:8 fromArray:temp8.
+        tempImage colorMap:colorMap.
+        ^ tempImage paletteImageAsPseudoFormOn:aDevice
     ].
     ^ self subclassResponsibility
 !
@@ -6456,7 +6512,7 @@
     bestFormat := self bestSupportedImageFormatFor:aDevice.
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceDepth == 1 ifTrue:[
-	^ self asMonochromeFormOn:aDevice.
+        ^ self asMonochromeFormOn:aDevice.
     ].
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
 
@@ -6470,33 +6526,33 @@
 
     nColors := colorMap size.
     nColors <= 4096 ifTrue:[
-	"/ precompute scales to map from 0..100 into devices range
-	"/ (this may be different for the individual components)
-	colorValues := Array uninitializedNew:nColors.
-
-	1 to:nColors do:[:index |
-	    r := colorMap redByteAt:index.
-	    g := colorMap greenByteAt:index.
-	    b := colorMap blueByteAt:index.
+        "/ precompute scales to map from 0..100 into devices range
+        "/ (this may be different for the individual components)
+        colorValues := Array uninitializedNew:nColors.
+
+        1 to:nColors do:[:index |
+            r := colorMap redByteAt:index.
+            g := colorMap greenByteAt:index.
+            b := colorMap blueByteAt:index.
 "/        clr := colorMap at:index.
-	    true "clr notNil" ifTrue:[
+            true "clr notNil" ifTrue:[
 "/            r := clr red.
 "/            g := clr green.
 "/            b := clr blue.
-		rv := (r * scaleRed) rounded.
-		gv := (g * scaleGreen) rounded.
-		bv := (b * scaleBlue) rounded.
-
-		v := rv bitShift:redShift.
-		v := v bitOr:(gv bitShift:greenShift).
-		v := v bitOr:(bv bitShift:blueShift).
-		colorValues at:index put:v.
+                rv := (r * scaleRed) rounded.
+                gv := (g * scaleGreen) rounded.
+                bv := (b * scaleBlue) rounded.
+
+                v := rv bitShift:redShift.
+                v := v bitOr:(gv bitShift:greenShift).
+                v := v bitOr:(bv bitShift:blueShift).
+                colorValues at:index put:v.
 "/ clr print. ' ' print.
 "/ rv print. ' ' print. gv print. ' ' print. bv print. ' ' print.
 "/ ' -> ' print. v printNL.
 
-	    ]
-	].
+            ]
+        ].
     ].
 
     "/ the temporary helper image is only needed to allow
@@ -6515,37 +6571,37 @@
     newPixelArray := i pixelArraySpecies new:width.
 
     colorValues notNil ifTrue:[
-	0 to:h do:[:y |
-	    self rowAt:y into:pixelArray.
-	    1 to:width do:[:x |
-		pixel := pixelArray at:x.
-		newPixelArray at:x put:(colorValues at:pixel + 1 ifAbsent:0).
-	    ].
-	    i rowAt:y putAll:newPixelArray.
-	].
+        0 to:h do:[:y |
+            self rowAt:y into:pixelArray.
+            1 to:width do:[:x |
+                pixel := pixelArray at:x.
+                newPixelArray at:x put:(colorValues at:pixel + 1 ifAbsent:0).
+            ].
+            i rowAt:y putAll:newPixelArray.
+        ].
     ] ifFalse:[
-	0 to:h do:[:y |
-	    self rowAt:y into:pixelArray.
-	    1 to:width do:[:x |
-
-		pixel := pixelArray at:x.
-		clr := self colorFromValue:pixel.
-		r := clr redByte.
-		g := clr greenByte.
-		b := clr blueByte.
-
-		rv := (r * scaleRed) rounded.
-		gv := (g * scaleGreen) rounded.
-		bv := (b * scaleBlue) rounded.
-
-		v := rv bitShift:redShift.
-		v := v bitOr:(gv bitShift:greenShift).
-		v := v bitOr:(bv bitShift:blueShift).
-
-		newPixelArray at:x put:v.
-	    ].
-	    i rowAt:y putAll:newPixelArray.
-	].
+        0 to:h do:[:y |
+            self rowAt:y into:pixelArray.
+            1 to:width do:[:x |
+
+                pixel := pixelArray at:x.
+                clr := self colorFromValue:pixel.
+                r := clr redByte.
+                g := clr greenByte.
+                b := clr blueByte.
+
+                rv := (r * scaleRed) rounded.
+                gv := (g * scaleGreen) rounded.
+                bv := (b * scaleBlue) rounded.
+
+                v := rv bitShift:redShift.
+                v := v bitOr:(gv bitShift:greenShift).
+                v := v bitOr:(bv bitShift:blueShift).
+
+                newPixelArray at:x put:v.
+            ].
+            i rowAt:y putAll:newPixelArray.
+        ].
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
@@ -6553,13 +6609,13 @@
     form initGC.
 
     form
-	copyBitsFrom:imageBits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	toX:0 y:0.
+        copyBitsFrom:imageBits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        toX:0 y:0.
 
     ^ form
 
@@ -6594,21 +6650,21 @@
 
     dstIdx := 1.
     0 to:nRed - 1 do:[:sR |
-	0 to:nGreen - 1 do:[:sG |
-	    0 to:nBlue - 1 do:[:sB |
-		pixel := (sR bitShift:shiftRed)
-			 + (sG bitShift:shiftGreen)
-			 + (sB bitShift:shiftBlue).
-		fixColors at:dstIdx put:(Color colorId:(pixel)).
-		dstIdx := dstIdx + 1
-	    ]
-	]
+        0 to:nGreen - 1 do:[:sG |
+            0 to:nBlue - 1 do:[:sB |
+                pixel := (sR bitShift:shiftRed)
+                         + (sG bitShift:shiftGreen)
+                         + (sB bitShift:shiftBlue).
+                fixColors at:dstIdx put:(Color colorId:(pixel)).
+                dstIdx := dstIdx + 1
+            ]
+        ]
     ].
 
     ^ self
-	asFloydSteinbergDitheredDepth8FormOn:aDevice
-	colors:fixColors
-	nRed:nRed nGreen:nGreen nBlue:nBlue
+        asFloydSteinbergDitheredDepth8FormOn:aDevice
+        colors:fixColors
+        nRed:nRed nGreen:nGreen nBlue:nBlue
 
     "Created: 14.6.1996 / 17:23:52 / cg"
     "Modified: 23.6.1997 / 15:22:36 / cg"
@@ -6622,15 +6678,15 @@
     depth := self depth.
     usedColors := self realUsedColors.
     sortBlockForColors := [:a :b |
-	    a redByte == b redByte ifTrue:[
-		a greenByte == b greenByte ifTrue:[
-		    a blueByte < b blueByte
-		] ifFalse:[
-		    a greenByte < b greenByte
-		]
-	    ] ifFalse:[
-		a redByte < b redByte
-	    ]
+            a redByte == b redByte ifTrue:[
+                a greenByte == b greenByte ifTrue:[
+                    a blueByte < b blueByte
+                ] ifFalse:[
+                    a greenByte < b greenByte
+                ]
+            ] ifFalse:[
+                a redByte < b redByte
+            ]
       ].
 
     "/ translation table
@@ -6638,40 +6694,40 @@
     newColorMap := usedColors asArray.
     newColorMap sort:sortBlockForColors.
     self colorMap notNil ifTrue:[
-	self colorMap asArray keysAndValuesDo:[:oldIdx :clr |
-	    |newPixel|
-
-	    (usedColors includes:clr) ifTrue:[
-		newPixel := newColorMap indexOf:clr.
-		oldToNew at:oldIdx put:newPixel-1.
-	    ]
-	].
+        self colorMap asArray keysAndValuesDo:[:oldIdx :clr |
+            |newPixel|
+
+            (usedColors includes:clr) ifTrue:[
+                newPixel := newColorMap indexOf:clr.
+                oldToNew at:oldIdx put:newPixel-1.
+            ]
+        ].
     ].
 
     oldBits := self bits.
     newBits := ByteArray new:(oldBits size).
     depth ~~ 8 ifTrue:[
-	"/ expand/compress can only handle 8bits
-	tmpBits := ByteArray uninitializedNew:(self width*self height).
-	oldBits
-	    expandPixels:depth
-	    width:self width
-	    height:self height
-	    into:tmpBits
-	    mapping:oldToNew.
-	tmpBits
-	    compressPixels:depth
-	    width:self width
-	    height:self height
-	    into:newBits
-	    mapping:nil
+        "/ expand/compress can only handle 8bits
+        tmpBits := ByteArray uninitializedNew:(self width*self height).
+        oldBits
+            expandPixels:depth
+            width:self width
+            height:self height
+            into:tmpBits
+            mapping:oldToNew.
+        tmpBits
+            compressPixels:depth
+            width:self width
+            height:self height
+            into:newBits
+            mapping:nil
     ] ifFalse:[
-	oldBits
-	    expandPixels:depth
-	    width:self width
-	    height:self height
-	    into:newBits
-	    mapping:oldToNew.
+        oldBits
+            expandPixels:depth
+            width:self width
+            height:self height
+            into:newBits
+            mapping:oldToNew.
     ].
 
     self bits:newBits.
@@ -6695,46 +6751,46 @@
     if (__isByteArrayLike(_myBits)
      && __isByteArrayLike(imageBits)
      && __bothSmallInteger(w, h)) {
-	int _idx;
-	int _w = __intVal(w);
-	int _h = __intVal(h);
-	int _mySize = __byteArraySize(_myBits);
-	int _imgSize = __byteArraySize(imageBits);
-	char *_myBitsPtr = __ByteArrayInstPtr(_myBits)->ba_element;
-	char *_imgBitsPtr = __ByteArrayInstPtr(imageBits)->ba_element;
-	char *_myBitsEndPtr = _myBitsPtr + (_w * _h * 3);
-	char *_imgBitsEndPtr = _imgBitsPtr + (_w * _h * 4);
-
-	if ((_w * _h * 3) > _mySize) goto error;
-	if ((_w * _h * 4) > _imgSize) goto error;
-
-	while (_myBitsPtr < _myBitsEndPtr) {
-	    // fetch r,g,b skip a
-	    unsigned char _r = _imgBitsPtr[0];
-	    unsigned char _g = _imgBitsPtr[1];
-	    unsigned char _b = _imgBitsPtr[2];
-	    _myBitsPtr[0] = _r;
-	    _myBitsPtr[1] = _g;
-	    _myBitsPtr[2] = _b;
-	    _myBitsPtr += 3;
-	    _imgBitsPtr += 4;
-	}
-	RETURN( self );
+        int _idx;
+        int _w = __intVal(w);
+        int _h = __intVal(h);
+        int _mySize = __byteArraySize(_myBits);
+        int _imgSize = __byteArraySize(imageBits);
+        char *_myBitsPtr = __ByteArrayInstPtr(_myBits)->ba_element;
+        char *_imgBitsPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+        char *_myBitsEndPtr = _myBitsPtr + (_w * _h * 3);
+        char *_imgBitsEndPtr = _imgBitsPtr + (_w * _h * 4);
+
+        if ((_w * _h * 3) > _mySize) goto error;
+        if ((_w * _h * 4) > _imgSize) goto error;
+
+        while (_myBitsPtr < _myBitsEndPtr) {
+            // fetch r,g,b skip a
+            unsigned char _r = _imgBitsPtr[0];
+            unsigned char _g = _imgBitsPtr[1];
+            unsigned char _b = _imgBitsPtr[2];
+            _myBitsPtr[0] = _r;
+            _myBitsPtr[1] = _g;
+            _myBitsPtr[2] = _b;
+            _myBitsPtr += 3;
+            _imgBitsPtr += 4;
+        }
+        RETURN( self );
     }
 error: ;
     console_printf("Image: oops - bits-size in copyPixels32\n");
 %}.
 
     anImage valuesFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :pixel |
-	|a r g b rgbPixel|
-
-	"/ bgra-pixel
-	"/ a := pixel bitAnd:16rFF.
-	r := (pixel bitShift:-8) bitAnd:16rFF.
-	g := (pixel bitShift:-16) bitAnd:16rFF.
-	b := (pixel bitShift:-24) bitAnd:16rFF.
-	rgbPixel := r + (g bitShift:8) + (b bitShift:16).
-	self pixelAtX:x y:y put:rgbPixel
+        |a r g b rgbPixel|
+
+        "/ bgra-pixel
+        "/ a := pixel bitAnd:16rFF.
+        r := (pixel bitShift:-8) bitAnd:16rFF.
+        g := (pixel bitShift:-16) bitAnd:16rFF.
+        b := (pixel bitShift:-24) bitAnd:16rFF.
+        rgbPixel := r + (g bitShift:8) + (b bitShift:16).
+        self pixelAtX:x y:y put:rgbPixel
     ].
 !
 
@@ -6746,10 +6802,10 @@
 
     visual := aDevice visualType.
     (visual == #StaticGray) ifTrue:[
-	^ self asGrayFormOn:aDevice
+        ^ self asGrayFormOn:aDevice
     ].
     (visual == #TrueColor) ifTrue:[
-	^ self rgbImageAsTrueColorFormOn:aDevice
+        ^ self rgbImageAsTrueColorFormOn:aDevice
     ].
 
     "/ PseudoColor conversion also works for StaticColor, GrayScale
@@ -6768,21 +6824,21 @@
      palette f|
 
     (depth := self depth) <= 8 ifTrue:[
-	"/ simulate it via a temporary palette image
-
-	palette := Array new:(1 bitShift:depth).
-
-	n := (1 bitShift:depth)-1.
-	0 to:n do:[:pixelValue |
-	    palette at:(pixelValue+1) put:(self colorFromValue:pixelValue)
-	].
-
-	self setColorMap:palette.
-	photometric := #palette.
-	f := self paletteImageAsPseudoFormOn:aDevice.
-	self setColorMap:nil.
-	photometric := #rgb.
-	^ f
+        "/ simulate it via a temporary palette image
+
+        palette := Array new:(1 bitShift:depth).
+
+        n := (1 bitShift:depth)-1.
+        0 to:n do:[:pixelValue |
+            palette at:(pixelValue+1) put:(self colorFromValue:pixelValue)
+        ].
+
+        self setColorMap:palette.
+        photometric := #palette.
+        f := self paletteImageAsPseudoFormOn:aDevice.
+        self setColorMap:nil.
+        photometric := #rgb.
+        ^ f
     ].
 
     ^ self subclassResponsibility
@@ -6802,7 +6858,7 @@
 
     "/ kludge for some 15bit XFree servers (should return 16 here - does not)
     usedDeviceBitsPerPixel == 15 ifTrue:[
-	usedDeviceBitsPerPixel := 16
+        usedDeviceBitsPerPixel := 16
     ].
 
     "/
@@ -6811,27 +6867,27 @@
     "/ be done in concrete subclasses (see D24Image)
     "/
     self bitsPerPixel == usedDeviceBitsPerPixel ifFalse:[
-	"/ kludge - convert to a deep image first, then to a form.
-	^ ((Image implementorForDepth:usedDeviceBitsPerPixel) fromImage:self) asFormOn:aDevice
+        "/ kludge - convert to a deep image first, then to a form.
+        ^ ((Image implementorForDepth:usedDeviceBitsPerPixel) fromImage:self) asFormOn:aDevice
 "/        'Image [warning]: unimplemented trueColor depth in rgbImageAsTrueColorFormOn: ' errorPrint. self bitsPerPixel errorPrintCR.
 "/        ^ self asMonochromeFormOn:aDevice
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth onDevice:aDevice.
     form isNil ifTrue:[
-	'Image [warning]: display bitmap creation failed' errorPrintCR.
-	^ nil
+        'Image [warning]: display bitmap creation failed' errorPrintCR.
+        ^ nil
     ].
     form initGC.
 
     form
-	copyBitsFrom:self bits
-	bitsPerPixel:usedDeviceBitsPerPixel
-	depth:usedDeviceDepth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	toX:0 y:0.
+        copyBitsFrom:self bits
+        bitsPerPixel:usedDeviceBitsPerPixel
+        depth:usedDeviceDepth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        toX:0 y:0.
 
     ^ form
 
@@ -6846,9 +6902,9 @@
 
     bytes := bytes copy.
     (colorMap isNil or:[colorMap isKindOf:Colormap]) ifFalse:[
-	colorMap := MappedPalette withColors:colorMap.
+        colorMap := MappedPalette withColors:colorMap.
     ] ifTrue:[
-	colorMap := colorMap copy.
+        colorMap := colorMap copy.
     ].
     device := deviceForm := monoDeviceForm := fullColorDeviceForm := nil.
     mask := mask copy.
@@ -6861,17 +6917,18 @@
     "a helper for deepCopy; only indices for which this method returns
      false are copied in a deep copy."
 
-    index == 17 ifTrue:[
-	^ true "/ skip device
-    ].
-    index == 18 ifTrue:[
-	^ true "/ skip deviceForm
-    ].
-    index == 19 ifTrue:[
-	^ true "/ skip monoDeviceForm
-    ].
-    index == 20 ifTrue:[
-	^ true "/ skip fullColorDeviceForm
+    "
+        self allInstanceVariableNames indexOf:#device
+    "
+
+    index == 13 ifTrue:[
+        ^ true "/ skip device
+    ].
+    index == 14 ifTrue:[
+        ^ true "/ skip deviceForm
+    ].
+    index == 15 ifTrue:[
+        ^ true "/ skip monoDeviceForm
     ].
     ^ false
 ! !
@@ -6909,9 +6966,9 @@
      Smalltalk-80 compatibility"
 
     opaque ifTrue:[
-	self displayOpaqueOn:aGC x:x y:y .
+        self displayOpaqueOn:aGC x:x y:y .
     ] ifFalse:[
-	self displayOn:aGC x:x y:y .
+        self displayOn:aGC x:x y:y .
     ].
 !
 
@@ -6965,7 +7022,7 @@
      grey|
 
     self depth > 12 ifTrue:[
-	^ self floydSteinbergDitheredMonochromeBits
+        ^ self floydSteinbergDitheredMonochromeBits
     ].
 
     w := width.
@@ -6985,90 +7042,90 @@
     greyValues := self greyMapForRange:(255*1024).
 
     0 to:(h-1) do:[:y |
-	nextDst := dstIndex + bytesPerMonoRow.
-	byte := 0.
-	bitCnt := 8.
-
-	t := errorArray.
-	errorArray := errorArray1.
-	errorArray1 := t.
-
-	errorArray1 atAllPut:0.
-
-	self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
-	    |eP "{Class: SmallInteger }"
-	     eD
-	     eI "{Class: SmallInteger }"
-	     xE "{Class: SmallInteger }"
-	     xN "{Class: SmallInteger }" |
-
-	    "/ get the colors grey value [0 .. 1]
-	    grey := greyValues at:(pixel + 1).
-
-	    "/ adjust error
-	    xE := x + 2 + 1.
-	    grey := (grey + (errorArray at:xE)).
-
-	    byte := byte bitShift:1.
-	    grey > (127*1024) ifTrue:[
-		byte := byte bitOr:1.      "/ white
-		e := grey - (255*1024)
-	    ] ifFalse:[
-		e := grey                  "/ black
-	    ].
-
-	    e ~= 0 ifTrue:[
-		"/ distribute the error:
-		"/                  XX  8  4
-		"/             2  4  8  4  2
-
-		eD := e.
-		eI := e // 32.
-
-		eP := eI * 8. eD := eD - eP.
-
-		xN := xE + 1.
-		errorArray at:xN put:(errorArray at:xN) + eP.
-
-		eD := eD - eP.
-		errorArray1 at:xE put:(errorArray1 at:xE) + eP.
-
-		eP := eI * 4. eD := eD - eP.
-		xN := xE + 2.
-		errorArray at:xN put:(errorArray at:xN) + eP.
-
-		eD := eD - eP.
-		xN := xE - 1.
-		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
-
-		eD := eD - eP.
-		xN := xE + 1.
-		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
-
-		eP := eI * 2. eD := eD - eP.
-		xN := xE - 2.
-		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
-
-		"/ eD := eD.
-		xN := xE + 2.
-		errorArray1 at:xN put:(errorArray1 at:xN) + eP.
-	    ].
-
-	    bitCnt := bitCnt - 1.
-	    bitCnt == 0 ifTrue:[
-		monoBits at:dstIndex put:byte.
-		dstIndex := dstIndex + 1.
-		byte := 0.
-		bitCnt := 8.
-	    ].
-
-	].
-	bitCnt ~~ 8 ifTrue:[
-	    byte := byte bitShift:bitCnt.
-	    monoBits at:dstIndex put:byte.
-	].
-
-	dstIndex := nextDst.
+        nextDst := dstIndex + bytesPerMonoRow.
+        byte := 0.
+        bitCnt := 8.
+
+        t := errorArray.
+        errorArray := errorArray1.
+        errorArray1 := t.
+
+        errorArray1 atAllPut:0.
+
+        self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
+            |eP "{Class: SmallInteger }"
+             eD
+             eI "{Class: SmallInteger }"
+             xE "{Class: SmallInteger }"
+             xN "{Class: SmallInteger }" |
+
+            "/ get the colors grey value [0 .. 1]
+            grey := greyValues at:(pixel + 1).
+
+            "/ adjust error
+            xE := x + 2 + 1.
+            grey := (grey + (errorArray at:xE)).
+
+            byte := byte bitShift:1.
+            grey > (127*1024) ifTrue:[
+                byte := byte bitOr:1.      "/ white
+                e := grey - (255*1024)
+            ] ifFalse:[
+                e := grey                  "/ black
+            ].
+
+            e ~= 0 ifTrue:[
+                "/ distribute the error:
+                "/                  XX  8  4
+                "/             2  4  8  4  2
+
+                eD := e.
+                eI := e // 32.
+
+                eP := eI * 8. eD := eD - eP.
+
+                xN := xE + 1.
+                errorArray at:xN put:(errorArray at:xN) + eP.
+
+                eD := eD - eP.
+                errorArray1 at:xE put:(errorArray1 at:xE) + eP.
+
+                eP := eI * 4. eD := eD - eP.
+                xN := xE + 2.
+                errorArray at:xN put:(errorArray at:xN) + eP.
+
+                eD := eD - eP.
+                xN := xE - 1.
+                errorArray1 at:xN put:(errorArray1 at:xN) + eP.
+
+                eD := eD - eP.
+                xN := xE + 1.
+                errorArray1 at:xN put:(errorArray1 at:xN) + eP.
+
+                eP := eI * 2. eD := eD - eP.
+                xN := xE - 2.
+                errorArray1 at:xN put:(errorArray1 at:xN) + eP.
+
+                "/ eD := eD.
+                xN := xE + 2.
+                errorArray1 at:xN put:(errorArray1 at:xN) + eP.
+            ].
+
+            bitCnt := bitCnt - 1.
+            bitCnt == 0 ifTrue:[
+                monoBits at:dstIndex put:byte.
+                dstIndex := dstIndex + 1.
+                byte := 0.
+                bitCnt := 8.
+            ].
+
+        ].
+        bitCnt ~~ 8 ifTrue:[
+            byte := byte bitShift:bitCnt.
+            monoBits at:dstIndex put:byte.
+        ].
+
+        dstIndex := nextDst.
     ].
 
     ^ monoBits
@@ -7106,61 +7163,61 @@
 
     "/ collect valid ditherColors ...
     aMapOrNil isNil ifTrue:[
-	ditherColors := colors select:[:clr | clr notNil].
+        ditherColors := colors select:[:clr | clr notNil].
     ] ifFalse:[
-	ditherColors := colors
+        ditherColors := colors
     ].
 
     "/ ... and sort by manhatten distance from black
 
     qScramble := #(
-		"/  2rX00X00X00X00
-
-		    2r000000000000    "/ 0
-		    2r000000000100    "/ 1
-		    2r000000100000    "/ 2
-		    2r000000100100    "/ 3
-		    2r000100000000    "/ 4
-		    2r000100000100    "/ 5
-		    2r000100100000    "/ 6
-		    2r000100100100    "/ 7
-		    2r100000000000    "/ 8
-		    2r100000000100    "/ 9
-		    2r100000100000    "/ a
-		    2r100000100100    "/ b
-		    2r100100000000    "/ c
-		    2r100100000100    "/ d
-		    2r100100100000    "/ e
-		    2r100100100100    "/ f
-		  ).
+                "/  2rX00X00X00X00
+
+                    2r000000000000    "/ 0
+                    2r000000000100    "/ 1
+                    2r000000100000    "/ 2
+                    2r000000100100    "/ 3
+                    2r000100000000    "/ 4
+                    2r000100000100    "/ 5
+                    2r000100100000    "/ 6
+                    2r000100100100    "/ 7
+                    2r100000000000    "/ 8
+                    2r100000000100    "/ 9
+                    2r100000100000    "/ a
+                    2r100000100100    "/ b
+                    2r100100000000    "/ c
+                    2r100100000100    "/ d
+                    2r100100100000    "/ e
+                    2r100100100100    "/ f
+                  ).
 
     ditherColors := ditherColors sort:[:a :b |
-				|cr "{Class: SmallInteger }"
-				 cg "{Class: SmallInteger }"
-				 cb "{Class: SmallInteger }"
-				 i1 "{Class: SmallInteger }"
-				 i2 "{Class: SmallInteger }"|
-
-				cr := a redByte.
-				cg := a greenByte.
-				cb := a blueByte.
-				i1 := qScramble at:((cr bitShift:-4) bitAnd:16r0F) + 1.
-				i1 := i1 + ((qScramble at:((cg bitShift:-4) bitAnd:16r0F) + 1) bitShift:-1).
-				i1 := i1 + ((qScramble at:((cb bitShift:-4) bitAnd:16r0F) + 1) bitShift:-2).
-
-				cr := b redByte.
-				cg := b greenByte.
-				cb := b blueByte.
-				i2 := qScramble at:((cr bitShift:-4) bitAnd:16r0F) + 1.
-				i2 := i2 + ((qScramble at:((cg bitShift:-4) bitAnd:16r0F) + 1) bitShift:-1).
-				i2 := i2 + ((qScramble at:((cb bitShift:-4) bitAnd:16r0F) + 1) bitShift:-2).
-
-				i1 < i2
-		    ].
+                                |cr "{Class: SmallInteger }"
+                                 cg "{Class: SmallInteger }"
+                                 cb "{Class: SmallInteger }"
+                                 i1 "{Class: SmallInteger }"
+                                 i2 "{Class: SmallInteger }"|
+
+                                cr := a redByte.
+                                cg := a greenByte.
+                                cb := a blueByte.
+                                i1 := qScramble at:((cr bitShift:-4) bitAnd:16r0F) + 1.
+                                i1 := i1 + ((qScramble at:((cg bitShift:-4) bitAnd:16r0F) + 1) bitShift:-1).
+                                i1 := i1 + ((qScramble at:((cb bitShift:-4) bitAnd:16r0F) + 1) bitShift:-2).
+
+                                cr := b redByte.
+                                cg := b greenByte.
+                                cb := b blueByte.
+                                i2 := qScramble at:((cr bitShift:-4) bitAnd:16r0F) + 1.
+                                i2 := i2 + ((qScramble at:((cg bitShift:-4) bitAnd:16r0F) + 1) bitShift:-1).
+                                i2 := i2 + ((qScramble at:((cb bitShift:-4) bitAnd:16r0F) + 1) bitShift:-2).
+
+                                i1 < i2
+                    ].
     aMapOrNil isNil ifTrue:[
-	ditherIds := (ditherColors asArray collect:[:clr | clr colorId]) asByteArray.
+        ditherIds := (ditherColors asArray collect:[:clr | clr colorId]) asByteArray.
     ] ifFalse:[
-	ditherIds := aMapOrNil asByteArray
+        ditherIds := aMapOrNil asByteArray
     ].
 
     "/ build an index table, for fast lookup from manhatten-r-g-b distance
@@ -7169,20 +7226,20 @@
     clrLookup := ByteArray new:(4096).
     index := 0.
     ditherColors keysAndValuesDo:[:clrPosition :clr |
-	|r g b i|
-
-	r := clr redByte.
-	g := clr greenByte.
-	b := clr blueByte.
-	i := qScramble at:((r bitShift:-4) bitAnd:16r0F) + 1.
-	i := i + ((qScramble at:((g bitShift:-4) bitAnd:16r0F) + 1) bitShift:-1).
-	i := i + ((qScramble at:((b bitShift:-4) bitAnd:16r0F) + 1) bitShift:-2).
-	lookupPos := i.
-
-	[index < lookupPos] whileTrue:[
-	    clrLookup at:(index+1) put:(clrPosition-1-1).
-	    index := index + 1
-	]
+        |r g b i|
+
+        r := clr redByte.
+        g := clr greenByte.
+        b := clr blueByte.
+        i := qScramble at:((r bitShift:-4) bitAnd:16r0F) + 1.
+        i := i + ((qScramble at:((g bitShift:-4) bitAnd:16r0F) + 1) bitShift:-1).
+        i := i + ((qScramble at:((b bitShift:-4) bitAnd:16r0F) + 1) bitShift:-2).
+        lookupPos := i.
+
+        [index < lookupPos] whileTrue:[
+            clrLookup at:(index+1) put:(clrPosition-1-1).
+            index := index + 1
+        ]
     ].
     clrLookup from:index+1 to:4096 put:(ditherColors size - 1).
 
@@ -7198,16 +7255,16 @@
     ditherRGBBytes := ByteArray uninitializedNew:(lastColor * 3).
     index := 1.
     1 to:lastColor do:[:pix |
-	clr := ditherColors at:pix.
-	ditherRGBBytes at:index put:(clr redByte).
-	ditherRGBBytes at:index+1 put:(clr greenByte).
-	ditherRGBBytes at:index+2 put:(clr blueByte).
-	aMapOrNil isNil ifTrue:[
-	    ditherIds at:pix put:clr colorId.
-	] ifFalse:[
-	    ditherIds at:pix put:(aMapOrNil at:pix).
-	].
-	index := index + 3.
+        clr := ditherColors at:pix.
+        ditherRGBBytes at:index put:(clr redByte).
+        ditherRGBBytes at:index+1 put:(clr greenByte).
+        ditherRGBBytes at:index+2 put:(clr blueByte).
+        aMapOrNil isNil ifTrue:[
+            ditherIds at:pix put:clr colorId.
+        ] ifFalse:[
+            ditherIds at:pix put:(aMapOrNil at:pix).
+        ].
+        index := index + 3.
     ].
 
     pseudoBits := ByteArray uninitializedNew:(width * height).
@@ -7236,23 +7293,23 @@
     int __nColors = __intVal(lastColor);
     int __wR = -1, __wG, __wB;
     static int __qScramble[16] = {
-		    0x000 /* 2r000000000000    0 */,
-		    0x004 /* 2r000000000100    1 */,
-		    0x020 /* 2r000000100000    2 */,
-		    0x024 /* 2r000000100100    3 */,
-		    0x100 /* 2r000100000000    4 */,
-		    0x104 /* 2r000100000100    5 */,
-		    0x120 /* 2r000100100000    6 */,
-		    0x124 /* 2r000100100100    7 */,
-		    0x800 /* 2r100000000000    8 */,
-		    0x804 /* 2r100000000100    9 */,
-		    0x820 /* 2r100000100000    a */,
-		    0x824 /* 2r100000100100    b */,
-		    0x900 /* 2r100100000000    c */,
-		    0x904 /* 2r100100000100    d */,
-		    0x920 /* 2r100100100000    e */,
-		    0x924 /* 2r100100100100    f */,
-		  };
+                    0x000 /* 2r000000000000    0 */,
+                    0x004 /* 2r000000000100    1 */,
+                    0x020 /* 2r000000100000    2 */,
+                    0x024 /* 2r000000100100    3 */,
+                    0x100 /* 2r000100000000    4 */,
+                    0x104 /* 2r000100000100    5 */,
+                    0x120 /* 2r000100100000    6 */,
+                    0x124 /* 2r000100100100    7 */,
+                    0x800 /* 2r100000000000    8 */,
+                    0x804 /* 2r100000000100    9 */,
+                    0x820 /* 2r100000100000    a */,
+                    0x824 /* 2r100000100100    b */,
+                    0x900 /* 2r100100000000    c */,
+                    0x904 /* 2r100100000100    d */,
+                    0x920 /* 2r100100100000    e */,
+                    0x924 /* 2r100100100100    f */,
+                  };
 
     if (__isByteArrayLike(__INST(bytes))
      && __isByteArray(pseudoBits)
@@ -7260,49 +7317,49 @@
      && __isByteArray(ditherIds)
      && __isByteArray(clrLookup)
      && __isByteArray(error)) {
-	failed = false;
-
-	srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-	dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
-	idP = __ByteArrayInstPtr(ditherIds)->ba_element;
-	__clrLookup = __ByteArrayInstPtr(clrLookup)->ba_element;
-	errP = (short *) __ByteArrayInstPtr(error)->ba_element;
-
-	/*
-	 * clear error accumulator
-	 */
-	eP = errP;
-	bzero(eP, (__w+2) * 2 * 3);
-
-	for (__y=__h; __y>0; __y--) {
-	    __eR = __eG = __eB = 0;
-
-	    eP = &(errP[3]);
-	    __eR = eP[0];
-	    __eG = eP[1];
-	    __eB = eP[2];
-
-	    for (__x=__w; __x>0; __x--) {
-		int __want;
-		int pix;
-		int __wantR, __wantG, __wantB;
-		int idx;
-		int tR, tG, tB;
-		int nR, nG, nB;
-		int dR, dG, dB;
-		int minDelta, bestIdx;
-		int cnt;
-
-		__wantR = *srcP++;
-		__wantG = *srcP++;
-		__wantB = *srcP++;
-
-		/*
-		 * wR, wG and wB is the wanted r/g/b value;
-		 */
-		__wantR = __wantR + __eR;
-		__wantG = __wantG + __eG;
-		__wantB = __wantB + __eB;
+        failed = false;
+
+        srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+        dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
+        idP = __ByteArrayInstPtr(ditherIds)->ba_element;
+        __clrLookup = __ByteArrayInstPtr(clrLookup)->ba_element;
+        errP = (short *) __ByteArrayInstPtr(error)->ba_element;
+
+        /*
+         * clear error accumulator
+         */
+        eP = errP;
+        bzero(eP, (__w+2) * 2 * 3);
+
+        for (__y=__h; __y>0; __y--) {
+            __eR = __eG = __eB = 0;
+
+            eP = &(errP[3]);
+            __eR = eP[0];
+            __eG = eP[1];
+            __eB = eP[2];
+
+            for (__x=__w; __x>0; __x--) {
+                int __want;
+                int pix;
+                int __wantR, __wantG, __wantB;
+                int idx;
+                int tR, tG, tB;
+                int nR, nG, nB;
+                int dR, dG, dB;
+                int minDelta, bestIdx;
+                int cnt;
+
+                __wantR = *srcP++;
+                __wantG = *srcP++;
+                __wantB = *srcP++;
+
+                /*
+                 * wR, wG and wB is the wanted r/g/b value;
+                 */
+                __wantR = __wantR + __eR;
+                __wantG = __wantG + __eG;
+                __wantB = __wantB + __eB;
 
 #define RED_SCALE 30
 #define GREEN_SCALE 59
@@ -7319,236 +7376,236 @@
 #define NPROBE 8
 
 #ifndef FAST_LOOKUP
-		if ((__wantR == __wR)
-		 && (__wantG == __wG)
-		 && (__wantB == __wB)) {
-		    /*
-		     * same color again - reuse last bestMatch
-		     */
-		} else
+                if ((__wantR == __wR)
+                 && (__wantG == __wG)
+                 && (__wantB == __wB)) {
+                    /*
+                     * same color again - reuse last bestMatch
+                     */
+                } else
 #endif
-		{
-		    __wR = __wantR;
-		    __wG = __wantG;
-		    __wB = __wantB;
+                {
+                    __wR = __wantR;
+                    __wG = __wantG;
+                    __wB = __wantB;
 
 #ifdef FAST_LOOKUP
-		    if(__wR > 255) __wR = 255;
-		    else if (__wR < 0) __wR = 0;
-		    if(__wG > 255) __wG = 255;
-		    else if (__wG < 0) __wG = 0;
-		    if(__wB > 255) __wB = 255;
-		    else if (__wB < 0) __wB = 0;
-
-		    {
-			int lookupIndex;
-			int idx, idx0;
-			int d, delta;
-			unsigned char *dp0;
-
-			dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
-			lookupIndex =    __qScramble[((__wR & 0xF0)>>4)];
-			lookupIndex |=   __qScramble[((__wG & 0xF0)>>4)] >> 1;
-			lookupIndex |=   __qScramble[((__wB & 0xF0)>>4)] >> 2;
-			idx = bestIdx =__clrLookup[lookupIndex];
-			dp += (idx+idx+idx);
-
-			/* try color at lookupIndex */
-
-			d = dp[0];
-			delta = (__wR - d) * RED_SCALE;
-			if (delta < 0) delta = -delta;
-
-			d = dp[1];
-			if (__wG > d)
-			    delta += (__wG - d) * GREEN_SCALE;
-			else
-			    delta += (d - __wG) * GREEN_SCALE;
-			d = dp[2];
-			if (__wB > d)
-			    delta += (__wB - d) * BLUE_SCALE;
-			else
-			    delta += (d - __wB) * BLUE_SCALE;
-
-			if (delta <= GOOD_DELTA) {
-			    goto foundBest;
-			}
-			minDelta = delta;
+                    if(__wR > 255) __wR = 255;
+                    else if (__wR < 0) __wR = 0;
+                    if(__wG > 255) __wG = 255;
+                    else if (__wG < 0) __wG = 0;
+                    if(__wB > 255) __wB = 255;
+                    else if (__wB < 0) __wB = 0;
+
+                    {
+                        int lookupIndex;
+                        int idx, idx0;
+                        int d, delta;
+                        unsigned char *dp0;
+
+                        dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
+                        lookupIndex =    __qScramble[((__wR & 0xF0)>>4)];
+                        lookupIndex |=   __qScramble[((__wG & 0xF0)>>4)] >> 1;
+                        lookupIndex |=   __qScramble[((__wB & 0xF0)>>4)] >> 2;
+                        idx = bestIdx =__clrLookup[lookupIndex];
+                        dp += (idx+idx+idx);
+
+                        /* try color at lookupIndex */
+
+                        d = dp[0];
+                        delta = (__wR - d) * RED_SCALE;
+                        if (delta < 0) delta = -delta;
+
+                        d = dp[1];
+                        if (__wG > d)
+                            delta += (__wG - d) * GREEN_SCALE;
+                        else
+                            delta += (d - __wG) * GREEN_SCALE;
+                        d = dp[2];
+                        if (__wB > d)
+                            delta += (__wB - d) * BLUE_SCALE;
+                        else
+                            delta += (d - __wB) * BLUE_SCALE;
+
+                        if (delta <= GOOD_DELTA) {
+                            goto foundBest;
+                        }
+                        minDelta = delta;
 # ifndef ONE_SHOT
-			idx0 = idx; dp0 = dp;
-			cnt = 0;
-			while ((++cnt <= NPROBE) && (idx > 0)) {
-			    /* try previous color(s) */
-
-			    idx--; dp -= 3;
-			    d = dp[0];
-			    delta = (__wR - d) * RED_SCALE;
-			    if (delta < 0) delta = -delta;
-			    d = dp[1];
-			    if (__wG > d)
-				delta += (__wG - d) * GREEN_SCALE;
-			    else
-				delta += (d - __wG) * GREEN_SCALE;
-			    d = dp[2];
-			    if (__wB > d)
-				delta += (__wB - d) * BLUE_SCALE;
-			    else
-				delta += (d - __wB) * BLUE_SCALE;
-
-			    if (delta < minDelta) {
-				bestIdx = idx;
-				if (delta <= GOOD_DELTA) {
-				    goto foundBest;
-				}
-				minDelta = delta;
-			    }
-			}
-
-			idx = idx0; dp = dp0;
-			cnt = 0;
-			while ((++cnt <= NPROBE) && (++idx < __nColors)) {
-			    /* try next color */
-
-			    dp += 3;
-			    d = dp[0];
-			    delta = (__wR - d) * RED_SCALE;
-			    if (delta < 0) delta = -delta;
-			    d = dp[1];
-			    if (__wG > d)
-				delta += (__wG - d) * GREEN_SCALE;
-			    else
-				delta += (d - __wG) * GREEN_SCALE;
-			    d = dp[2];
-			    if (__wB > d)
-				delta += (__wB - d) * BLUE_SCALE;
-			    else
-				delta += (d - __wB) * BLUE_SCALE;
-
-			    if (delta < minDelta) {
-				bestIdx = idx;
-				if (delta <= GOOD_DELTA) {
-				    goto foundBest;
-				}
-				minDelta = delta;
-			    }
-			}
+                        idx0 = idx; dp0 = dp;
+                        cnt = 0;
+                        while ((++cnt <= NPROBE) && (idx > 0)) {
+                            /* try previous color(s) */
+
+                            idx--; dp -= 3;
+                            d = dp[0];
+                            delta = (__wR - d) * RED_SCALE;
+                            if (delta < 0) delta = -delta;
+                            d = dp[1];
+                            if (__wG > d)
+                                delta += (__wG - d) * GREEN_SCALE;
+                            else
+                                delta += (d - __wG) * GREEN_SCALE;
+                            d = dp[2];
+                            if (__wB > d)
+                                delta += (__wB - d) * BLUE_SCALE;
+                            else
+                                delta += (d - __wB) * BLUE_SCALE;
+
+                            if (delta < minDelta) {
+                                bestIdx = idx;
+                                if (delta <= GOOD_DELTA) {
+                                    goto foundBest;
+                                }
+                                minDelta = delta;
+                            }
+                        }
+
+                        idx = idx0; dp = dp0;
+                        cnt = 0;
+                        while ((++cnt <= NPROBE) && (++idx < __nColors)) {
+                            /* try next color */
+
+                            dp += 3;
+                            d = dp[0];
+                            delta = (__wR - d) * RED_SCALE;
+                            if (delta < 0) delta = -delta;
+                            d = dp[1];
+                            if (__wG > d)
+                                delta += (__wG - d) * GREEN_SCALE;
+                            else
+                                delta += (d - __wG) * GREEN_SCALE;
+                            d = dp[2];
+                            if (__wB > d)
+                                delta += (__wB - d) * BLUE_SCALE;
+                            else
+                                delta += (d - __wB) * BLUE_SCALE;
+
+                            if (delta < minDelta) {
+                                bestIdx = idx;
+                                if (delta <= GOOD_DELTA) {
+                                    goto foundBest;
+                                }
+                                minDelta = delta;
+                            }
+                        }
 # endif
-		    }
-	foundBest: ;
+                    }
+        foundBest: ;
 #else
 /*
-		    if(__wR > 255) __wR = 255;
-		    else if (__wR < 0) __wR = 0;
-		    if(__wG > 255) __wG = 255;
-		    else if (__wG < 0) __wG = 0;
-		    if(__wB > 255) __wB = 255;
-		    else if (__wB < 0) __wB = 0;
+                    if(__wR > 255) __wR = 255;
+                    else if (__wR < 0) __wR = 0;
+                    if(__wG > 255) __wG = 255;
+                    else if (__wG < 0) __wG = 0;
+                    if(__wB > 255) __wB = 255;
+                    else if (__wB < 0) __wB = 0;
 */
 
-		    /* find the best matching color */
-
-		    minDelta = 99999;
-		    bestIdx = -1;
-		    dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
-		    for (idx = 0; idx<__nColors; idx++) {
-			int d, delta;
-
-			d = dp[0];
-			delta = (__wR - d) * RED_SCALE;
-			if (delta < 0) delta = -delta;
-			if (delta < minDelta) {
-			    d = dp[1];
-			    if (__wG > d)
-				delta += (__wG - d) * GREEN_SCALE;
-			    else
-				delta += (d - __wG) * GREEN_SCALE;
-			    if (delta < minDelta) {
-				d = dp[2];
-				if (__wB > d)
-				    delta += (__wB - d) * BLUE_SCALE;
-				else
-				    delta += (d - __wB) * BLUE_SCALE;
-
-				if (delta < minDelta) {
-				    bestIdx = idx;
-				    if (delta <= GOOD_DELTA) {
-					break;
-				    }
-				    minDelta = delta;
-				}
-			    }
-			}
-			dp += 3;
-		    }
+                    /* find the best matching color */
+
+                    minDelta = 99999;
+                    bestIdx = -1;
+                    dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
+                    for (idx = 0; idx<__nColors; idx++) {
+                        int d, delta;
+
+                        d = dp[0];
+                        delta = (__wR - d) * RED_SCALE;
+                        if (delta < 0) delta = -delta;
+                        if (delta < minDelta) {
+                            d = dp[1];
+                            if (__wG > d)
+                                delta += (__wG - d) * GREEN_SCALE;
+                            else
+                                delta += (d - __wG) * GREEN_SCALE;
+                            if (delta < minDelta) {
+                                d = dp[2];
+                                if (__wB > d)
+                                    delta += (__wB - d) * BLUE_SCALE;
+                                else
+                                    delta += (d - __wB) * BLUE_SCALE;
+
+                                if (delta < minDelta) {
+                                    bestIdx = idx;
+                                    if (delta <= GOOD_DELTA) {
+                                        break;
+                                    }
+                                    minDelta = delta;
+                                }
+                            }
+                        }
+                        dp += 3;
+                    }
 #endif
-		}
-		dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
-		dp += bestIdx * 3;
-		dR = dp[0];
-		dG = dp[1];
-		dB = dp[2];
+                }
+                dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
+                dp += bestIdx * 3;
+                dR = dp[0];
+                dG = dp[1];
+                dB = dp[2];
 
 /*
 console_fprintf(stderr, "want: %d/%d/%d (%d/%d/%d) got: %d/%d/%d\n",
-		__wantR, __wantG, __wantB,
-		__wR, __wG, __wB,
-		dR, dG, dB);
+                __wantR, __wantG, __wantB,
+                __wR, __wG, __wB,
+                dR, dG, dB);
 */
-		/*
-		 * store the corresponding dither colors colorId
-		 */
-		*dstP++ = idP[bestIdx];
-
-		/*
-		 * the new error & distribute the error
-		 */
-		__eR = __wantR - dR;
-		if (__eR) {
-		    tR = __eR >> 4;  /* 16th of error */
-		    nR = eP[3] + (tR * 7);/* from accu: error for (x+1 / y) */
-		    eP[0] = tR*5;         /* 5/16th for (x / y+1) */
-		    eP[-3] = tR*3;        /* 3/16th for (x-1 / y+1) */
-		    eP[3] = __eR - (tR*15);  /* 1/16th for (x+1 / y+1) */
-		    __eR = nR;
-		} else {
-		    __eR = eP[3];
-		    eP[0] = eP[-3] = eP[3] = 0;
-		}
-
-		__eG = __wantG - dG;
-		if (__eG) {
-		    tG = __eG >> 4;
-		    nG = eP[4] + (tG * 7);/* plus 7/16'th of this error */
-		    eP[1] = tG*5;
-		    eP[-2] = tG*3;
-		    eP[4] = __eG - (tG*15);
-		    __eG = nG;
-		} else {
-		    __eG = eP[4];
-		    eP[1] = eP[-2] = eP[4] = 0;
-		}
-
-		__eB = __wantB - dB;
-		if (__eB) {
-		    tB = __eB >> 4;
-		    nB = eP[5] + (tB * 7);
-		    eP[2] = tB*5;
-		    eP[-1] = tB*3;
-		    eP[5] = __eB - (tB*15);
-		    __eB = nB;
-		} else {
-		    __eB = eP[5];
-		    eP[2] = eP[-1] = eP[5] = 0;
-		}
-
-		eP += 3;
-	    }
-	}
+                /*
+                 * store the corresponding dither colors colorId
+                 */
+                *dstP++ = idP[bestIdx];
+
+                /*
+                 * the new error & distribute the error
+                 */
+                __eR = __wantR - dR;
+                if (__eR) {
+                    tR = __eR >> 4;  /* 16th of error */
+                    nR = eP[3] + (tR * 7);/* from accu: error for (x+1 / y) */
+                    eP[0] = tR*5;         /* 5/16th for (x / y+1) */
+                    eP[-3] = tR*3;        /* 3/16th for (x-1 / y+1) */
+                    eP[3] = __eR - (tR*15);  /* 1/16th for (x+1 / y+1) */
+                    __eR = nR;
+                } else {
+                    __eR = eP[3];
+                    eP[0] = eP[-3] = eP[3] = 0;
+                }
+
+                __eG = __wantG - dG;
+                if (__eG) {
+                    tG = __eG >> 4;
+                    nG = eP[4] + (tG * 7);/* plus 7/16'th of this error */
+                    eP[1] = tG*5;
+                    eP[-2] = tG*3;
+                    eP[4] = __eG - (tG*15);
+                    __eG = nG;
+                } else {
+                    __eG = eP[4];
+                    eP[1] = eP[-2] = eP[4] = 0;
+                }
+
+                __eB = __wantB - dB;
+                if (__eB) {
+                    tB = __eB >> 4;
+                    nB = eP[5] + (tB * 7);
+                    eP[2] = tB*5;
+                    eP[-1] = tB*3;
+                    eP[5] = __eB - (tB*15);
+                    __eB = nB;
+                } else {
+                    __eB = eP[5];
+                    eP[2] = eP[-1] = eP[5] = 0;
+                }
+
+                eP += 3;
+            }
+        }
     }
 %}.
     failed ifTrue:[
-	self primitiveFailed.
-	^ nil
+        self primitiveFailed.
+        ^ nil
     ].
 
     ^ pseudoBits
@@ -7591,8 +7648,8 @@
 
     "/ simple check
     (fixR * fixG * fixB) ~~ fixColors size ifTrue:[
-	self error:'invalid color array passed'.
-	^ nil
+        self error:'invalid color array passed'.
+        ^ nil
     ].
     fixIds := (fixColors asArray collect:[:clr | clr colorId]) asByteArray.
 
@@ -7604,17 +7661,17 @@
     index := 1.
 
     photometric == #palette ifTrue:[
-	lastColor := colorMap size - 1
+        lastColor := colorMap size - 1
     ] ifFalse:[
-	lastColor := 255.
+        lastColor := 255.
     ].
     0 to:lastColor do:[:pix |
-	clr := self colorFromValue:pix.
-	rgbBytes at:index put:(clr redByte).
-	rgbBytes at:index+1 put:(clr greenByte).
-	rgbBytes at:index+2 put:(clr blueByte).
-
-	index := index + 3.
+        clr := self colorFromValue:pix.
+        rgbBytes at:index put:(clr redByte).
+        rgbBytes at:index+1 put:(clr greenByte).
+        rgbBytes at:index+2 put:(clr blueByte).
+
+        index := index + 3.
     ].
 
     pseudoBits := ByteArray uninitializedNew:(width * height).
@@ -7632,18 +7689,18 @@
     fixGfixB := fixG * fixB.
     index := 1.
     0 to:255 do:[:i |
-	rgbIDX := (i * (fixR-1) + 128) // 255. "red index rounded"
-	idxAndErrRBytes at:index put:(rgbIDX * fixGfixB).
-	idxAndErrRBytes at:index+1 put:i - (rgbIDX * 255 // (fixR-1)) + 128.
-
-	rgbIDX := (i * (fixG-1) + 128) // 255. "green index rounded"
-	idxAndErrGBytes at:index put:(rgbIDX * fixB).
-	idxAndErrGBytes at:index+1 put:i - (rgbIDX * 255 // (fixG-1)) + 128.
-
-	rgbIDX := (i * (fixB-1) + 128) // 255. "blue index rounded"
-	idxAndErrBBytes at:index put:(rgbIDX ).
-	idxAndErrBBytes at:index+1 put:i - (rgbIDX * 255 // (fixB-1)) + 128.
-	index := index + 2.
+        rgbIDX := (i * (fixR-1) + 128) // 255. "red index rounded"
+        idxAndErrRBytes at:index put:(rgbIDX * fixGfixB).
+        idxAndErrRBytes at:index+1 put:i - (rgbIDX * 255 // (fixR-1)) + 128.
+
+        rgbIDX := (i * (fixG-1) + 128) // 255. "green index rounded"
+        idxAndErrGBytes at:index put:(rgbIDX * fixB).
+        idxAndErrGBytes at:index+1 put:i - (rgbIDX * 255 // (fixG-1)) + 128.
+
+        rgbIDX := (i * (fixB-1) + 128) // 255. "blue index rounded"
+        idxAndErrBBytes at:index put:(rgbIDX ).
+        idxAndErrBBytes at:index+1 put:i - (rgbIDX * 255 // (fixB-1)) + 128.
+        index := index + 2.
     ].
 
     failed := true.
@@ -7666,121 +7723,121 @@
      && __isByteArray(error)
      && __bothSmallInteger(fixR, fixG)
      && __isSmallInteger(fixB)) {
-	failed = false;
-
-	srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-	dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
-	rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
-	idP = __ByteArrayInstPtr(fixIds)->ba_element;
-	__idxAndErrRBytes = __ByteArrayInstPtr(idxAndErrRBytes)->ba_element;
-	__idxAndErrGBytes = __ByteArrayInstPtr(idxAndErrGBytes)->ba_element;
-	__idxAndErrBBytes = __ByteArrayInstPtr(idxAndErrBBytes)->ba_element;
-	errP = (short *) __ByteArrayInstPtr(error)->ba_element;
-
-	eP = errP;
-
-	for (__y=__intVal(h); __y>0; __y--) {
-	    __eR = __eG = __eB = 0;
-
-	    eP = &(errP[3]);
-	    __eR = eP[0];
-	    __eG = eP[1];
-	    __eB = eP[2];
-
-	    for (__x=__w; __x>0; __x--) {
-		int __want;
-		int pix;
-		int idx;
-		int tR, tG, tB;
-		int nR, nG, nB;
-		int iRGB;
-
-		pix = *srcP++;
-
-		/*
-		 * wR, wG and wB is the wanted r/g/b value;
-		 */
-		pix = pix+pix+pix;  /* pix * 3 */
-
-		/*
-		 * compute indexR/G/B and the new error:
-		 */
-		__want = rgbP[pix]   + __eR;
-		if (__want > 255) __want = 255;
-		else if (__want < 0) __want = 0;
-		__want += __want;
-		idx = __idxAndErrRBytes[__want];
-		__eR = __idxAndErrRBytes[__want+1];
-		__eR -= 128;
-
-		__want = rgbP[pix+1] + __eG;
-		if (__want > 255) __want = 255;
-		else if (__want < 0) __want = 0;
-		__want += __want;
-		idx += __idxAndErrGBytes[__want];
-		__eG = __idxAndErrGBytes[__want+1];
-		__eG -= 128;
-
-		__want = rgbP[pix+2] + __eB;
-		if (__want > 255) __want = 255;
-		else if (__want < 0) __want = 0;
-		__want += __want;
-		idx += __idxAndErrBBytes[__want];
-		__eB = __idxAndErrBBytes[__want+1];
-		__eB -= 128;
-
-		/*
-		 * store the corresponding dither colors colorId
-		 */
-		*dstP++ = idP[idx];
-
-		/*
-		 * distribute the error
-		 */
-		if (__eR) {
-		    tR = __eR >> 4;  /* 16th of error */
-		    nR = eP[3] + (tR * 7);/* from accu: error for (x+1 / y) */
-		    eP[0] = tR*5;         /* 5/16th for (x / y+1) */
-		    eP[-3] = tR*3;        /* 3/16th for (x-1 / y+1) */
-		    eP[3] = __eR - (tR*15);  /* 1/16th for (x+1 / y+1) */
-		    __eR = nR;
-		} else {
-		    __eR = eP[3];
-		    eP[0] = eP[-3] = eP[3] = 0;
-		}
-
-		if (__eG) {
-		    tG = __eG >> 4;  /* 16th of error */
-		    nG = eP[4] + (tG * 7);/* plus 7/16'th of this error */
-		    eP[1] = tG*5;
-		    eP[-2] = tG*3;
-		    eP[4] = __eG - (tG*15);
-		    __eG = nG;
-		} else {
-		    __eG = eP[4];
-		    eP[1] = eP[-2] = eP[4] = 0;
-		}
-
-		if (__eB) {
-		    tB = __eB >> 4;  /* 16th of error */
-		    nB = eP[5] + (tB * 7);
-		    eP[2] = tB*5;
-		    eP[-1] = tB*3;
-		    eP[5] = __eB - (tB*15);
-		    __eB = nB;
-		} else {
-		    __eB = eP[5];
-		    eP[2] = eP[-1] = eP[5] = 0;
-		}
-
-		eP += 3;
-	    }
-	}
+        failed = false;
+
+        srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+        dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
+        rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
+        idP = __ByteArrayInstPtr(fixIds)->ba_element;
+        __idxAndErrRBytes = __ByteArrayInstPtr(idxAndErrRBytes)->ba_element;
+        __idxAndErrGBytes = __ByteArrayInstPtr(idxAndErrGBytes)->ba_element;
+        __idxAndErrBBytes = __ByteArrayInstPtr(idxAndErrBBytes)->ba_element;
+        errP = (short *) __ByteArrayInstPtr(error)->ba_element;
+
+        eP = errP;
+
+        for (__y=__intVal(h); __y>0; __y--) {
+            __eR = __eG = __eB = 0;
+
+            eP = &(errP[3]);
+            __eR = eP[0];
+            __eG = eP[1];
+            __eB = eP[2];
+
+            for (__x=__w; __x>0; __x--) {
+                int __want;
+                int pix;
+                int idx;
+                int tR, tG, tB;
+                int nR, nG, nB;
+                int iRGB;
+
+                pix = *srcP++;
+
+                /*
+                 * wR, wG and wB is the wanted r/g/b value;
+                 */
+                pix = pix+pix+pix;  /* pix * 3 */
+
+                /*
+                 * compute indexR/G/B and the new error:
+                 */
+                __want = rgbP[pix]   + __eR;
+                if (__want > 255) __want = 255;
+                else if (__want < 0) __want = 0;
+                __want += __want;
+                idx = __idxAndErrRBytes[__want];
+                __eR = __idxAndErrRBytes[__want+1];
+                __eR -= 128;
+
+                __want = rgbP[pix+1] + __eG;
+                if (__want > 255) __want = 255;
+                else if (__want < 0) __want = 0;
+                __want += __want;
+                idx += __idxAndErrGBytes[__want];
+                __eG = __idxAndErrGBytes[__want+1];
+                __eG -= 128;
+
+                __want = rgbP[pix+2] + __eB;
+                if (__want > 255) __want = 255;
+                else if (__want < 0) __want = 0;
+                __want += __want;
+                idx += __idxAndErrBBytes[__want];
+                __eB = __idxAndErrBBytes[__want+1];
+                __eB -= 128;
+
+                /*
+                 * store the corresponding dither colors colorId
+                 */
+                *dstP++ = idP[idx];
+
+                /*
+                 * distribute the error
+                 */
+                if (__eR) {
+                    tR = __eR >> 4;  /* 16th of error */
+                    nR = eP[3] + (tR * 7);/* from accu: error for (x+1 / y) */
+                    eP[0] = tR*5;         /* 5/16th for (x / y+1) */
+                    eP[-3] = tR*3;        /* 3/16th for (x-1 / y+1) */
+                    eP[3] = __eR - (tR*15);  /* 1/16th for (x+1 / y+1) */
+                    __eR = nR;
+                } else {
+                    __eR = eP[3];
+                    eP[0] = eP[-3] = eP[3] = 0;
+                }
+
+                if (__eG) {
+                    tG = __eG >> 4;  /* 16th of error */
+                    nG = eP[4] + (tG * 7);/* plus 7/16'th of this error */
+                    eP[1] = tG*5;
+                    eP[-2] = tG*3;
+                    eP[4] = __eG - (tG*15);
+                    __eG = nG;
+                } else {
+                    __eG = eP[4];
+                    eP[1] = eP[-2] = eP[4] = 0;
+                }
+
+                if (__eB) {
+                    tB = __eB >> 4;  /* 16th of error */
+                    nB = eP[5] + (tB * 7);
+                    eP[2] = tB*5;
+                    eP[-1] = tB*3;
+                    eP[5] = __eB - (tB*15);
+                    __eB = nB;
+                } else {
+                    __eB = eP[5];
+                    eP[2] = eP[-1] = eP[5] = 0;
+                }
+
+                eP += 3;
+            }
+        }
     }
 %}.
     failed ifTrue:[
-	self primitiveFailed.
-	^ nil
+        self primitiveFailed.
+        ^ nil
     ].
 
     ^ pseudoBits
@@ -7807,8 +7864,8 @@
      eR eRB eB eLB |
 
     depth > 8 ifTrue:[
-	self error:'unimplemented conversion'.
-	^ nil
+        self error:'unimplemented conversion'.
+        ^ nil
     ].
 
     w := width.
@@ -7828,176 +7885,176 @@
     bitCnt := 8.
 
     self depth <= 12 ifTrue:[
-	"/ fetch scaled brightness values outside of loop into a table;
-	"/ use table-value in loop
-
-	greyValues := self greyMapForRange:(greyLevels).
-
-	greyPixels := greyValues collect:[:v | v isNil ifTrue:[
-						   0
-					       ] ifFalse:[
-						   v truncated]].
-
-	greyPixels := ByteArray withAll:greyPixels.
-
-	greyErrors := greyValues collect:[:v | v isNil ifTrue:[
-						   0
-					       ] ifFalse:[
-						   ((v - v truncated) * 1024) truncated
-					       ]].
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerOutRow.
-	    byte := 0.
-
-	    t := errorArray.
-	    errorArray := nextErrorArray.
-	    nextErrorArray := t.
-
-	    nextErrorArray atAllPut:0.
-
-	    self valuesAtY:y from:0 to:(w-1) do:[:x :value |
-		|e     "{ Class: SmallInteger }"
-		 pixel "{ Class: SmallInteger }"
-		 error "{ Class: SmallInteger }"
-		 e16   "{ Class: SmallInteger }"
-		 xE    "{ Class: SmallInteger }"
-		 xN    "{ Class: SmallInteger }" |
-
-		pixel := greyPixels at:(value + 1).
-
-		"/ adjust error
-		xE := x + 2.
-		error := (greyErrors at:(value + 1)) + (errorArray at:xE).
-
-		byte := byte bitShift:depth.
-		error > 512 "0.5" ifTrue:[
-		    pixel := pixel + 1.
-		    e := error - 1024 "1.0"
-		] ifFalse:[
-		    e := error
-		].
-		byte := byte bitOr:pixel.
-
-		e ~= 0 ifTrue:[
-		    e16 := e // 16.
-
-		    eR  := e16 * 7.              "/ 7/16 to right
-		    eRB := e16 "* 1".            "/ 1/16 to right below
-		    eB  := e16 * 5.              "/ 5/16 to below
-		    eLB := e - eR - eRB - eB.  "/ 3/16 to left below
-
-		    xN := xE + 1.
-		    eR ~= 0 ifTrue:[
-			errorArray     at:xN put:(errorArray at:xN) + eR.
-		    ].
-		    eRB ~= 0 ifTrue:[
-			nextErrorArray at:xN put:(nextErrorArray at:xN) + eRB.
-		    ].
-		    eB ~= 0 ifTrue:[
-			nextErrorArray at:xE put:(nextErrorArray at:xE) + eB.
-		    ].
-		    eLB ~= 0 ifTrue:[
-			xN := xE - 1.
-			nextErrorArray at:xN put:(nextErrorArray at:xN) + eLB.
-		    ].
-		].
-
-		bitCnt := bitCnt - depth.
-		bitCnt == 0 ifTrue:[
-		    outBits at:dstIndex put:byte.
-		    dstIndex := dstIndex + 1.
-		    byte := 0.
-		    bitCnt := 8.
-		].
-
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		outBits at:dstIndex put:byte.
-		bitCnt := 8.
-	    ].
-
-	    dstIndex := nextDst.
-	].
+        "/ fetch scaled brightness values outside of loop into a table;
+        "/ use table-value in loop
+
+        greyValues := self greyMapForRange:(greyLevels).
+
+        greyPixels := greyValues collect:[:v | v isNil ifTrue:[
+                                                   0
+                                               ] ifFalse:[
+                                                   v truncated]].
+
+        greyPixels := ByteArray withAll:greyPixels.
+
+        greyErrors := greyValues collect:[:v | v isNil ifTrue:[
+                                                   0
+                                               ] ifFalse:[
+                                                   ((v - v truncated) * 1024) truncated
+                                               ]].
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerOutRow.
+            byte := 0.
+
+            t := errorArray.
+            errorArray := nextErrorArray.
+            nextErrorArray := t.
+
+            nextErrorArray atAllPut:0.
+
+            self valuesAtY:y from:0 to:(w-1) do:[:x :value |
+                |e     "{ Class: SmallInteger }"
+                 pixel "{ Class: SmallInteger }"
+                 error "{ Class: SmallInteger }"
+                 e16   "{ Class: SmallInteger }"
+                 xE    "{ Class: SmallInteger }"
+                 xN    "{ Class: SmallInteger }" |
+
+                pixel := greyPixels at:(value + 1).
+
+                "/ adjust error
+                xE := x + 2.
+                error := (greyErrors at:(value + 1)) + (errorArray at:xE).
+
+                byte := byte bitShift:depth.
+                error > 512 "0.5" ifTrue:[
+                    pixel := pixel + 1.
+                    e := error - 1024 "1.0"
+                ] ifFalse:[
+                    e := error
+                ].
+                byte := byte bitOr:pixel.
+
+                e ~= 0 ifTrue:[
+                    e16 := e // 16.
+
+                    eR  := e16 * 7.              "/ 7/16 to right
+                    eRB := e16 "* 1".            "/ 1/16 to right below
+                    eB  := e16 * 5.              "/ 5/16 to below
+                    eLB := e - eR - eRB - eB.  "/ 3/16 to left below
+
+                    xN := xE + 1.
+                    eR ~= 0 ifTrue:[
+                        errorArray     at:xN put:(errorArray at:xN) + eR.
+                    ].
+                    eRB ~= 0 ifTrue:[
+                        nextErrorArray at:xN put:(nextErrorArray at:xN) + eRB.
+                    ].
+                    eB ~= 0 ifTrue:[
+                        nextErrorArray at:xE put:(nextErrorArray at:xE) + eB.
+                    ].
+                    eLB ~= 0 ifTrue:[
+                        xN := xE - 1.
+                        nextErrorArray at:xN put:(nextErrorArray at:xN) + eLB.
+                    ].
+                ].
+
+                bitCnt := bitCnt - depth.
+                bitCnt == 0 ifTrue:[
+                    outBits at:dstIndex put:byte.
+                    dstIndex := dstIndex + 1.
+                    byte := 0.
+                    bitCnt := 8.
+                ].
+
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                outBits at:dstIndex put:byte.
+                bitCnt := 8.
+            ].
+
+            dstIndex := nextDst.
+        ].
     ] ifFalse:[
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerOutRow.
-	    byte := 0.
-
-	    t := errorArray.
-	    errorArray := nextErrorArray.
-	    nextErrorArray := t.
-
-	    nextErrorArray atAllPut:0.
-
-	    self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
-		|e     "{ Class: SmallInteger }"
-		 pixel "{ Class: SmallInteger }"
-		 error "{ Class: SmallInteger }"
-		 e16   "{ Class: SmallInteger }"
-		 xE    "{ Class: SmallInteger }"
-		 xN    "{ Class: SmallInteger }" |
-
-		grey := (clr brightness * greyLevels).
-		pixel := grey truncated.
-		error := ((grey - pixel) * 1024) truncated.
-
-		"/ adjust error
-		xE := x + 2.
-		error := error + (errorArray at:xE).
-
-		byte := byte bitShift:depth.
-		error > 512 "0.5" ifTrue:[
-		    pixel := pixel + 1.
-		    e := error - 1024 "1.0"
-		] ifFalse:[
-		    e := error
-		].
-
-		byte := byte bitOr:pixel.
-
-		e ~= 0 ifTrue:[
-		    e16 := e // 16.
-
-		    eR  := e16 * 7.              "/ 7/16 to right
-		    eRB := e16 "* 1".            "/ 1/16 to right below
-		    eB  := e16 * 5.              "/ 5/16 to below
-		    eLB := e - eR - eRB - eB.  "/ 3/16 to left below
-
-		    xN := xE + 1.
-		    eR ~= 0 ifTrue:[
-			errorArray     at:xN put:(errorArray at:xN) + eR.
-		    ].
-		    eRB ~= 0 ifTrue:[
-			nextErrorArray at:xN put:(nextErrorArray at:xN) + eRB.
-		    ].
-		    eB ~= 0 ifTrue:[
-			nextErrorArray at:xE put:(nextErrorArray at:xE) + eB.
-		    ].
-		    eLB ~= 0 ifTrue:[
-			xN := xE - 1.
-			nextErrorArray at:xN put:(nextErrorArray at:xN) + eLB.
-		    ].
-		].
-
-		bitCnt := bitCnt - depth.
-		bitCnt == 0 ifTrue:[
-		    outBits at:dstIndex put:byte.
-		    dstIndex := dstIndex + 1.
-		    byte := 0.
-		    bitCnt := 8.
-		].
-
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		outBits at:dstIndex put:byte.
-		bitCnt := 8.
-	    ].
-
-	    dstIndex := nextDst.
-	].
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerOutRow.
+            byte := 0.
+
+            t := errorArray.
+            errorArray := nextErrorArray.
+            nextErrorArray := t.
+
+            nextErrorArray atAllPut:0.
+
+            self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
+                |e     "{ Class: SmallInteger }"
+                 pixel "{ Class: SmallInteger }"
+                 error "{ Class: SmallInteger }"
+                 e16   "{ Class: SmallInteger }"
+                 xE    "{ Class: SmallInteger }"
+                 xN    "{ Class: SmallInteger }" |
+
+                grey := (clr brightness * greyLevels).
+                pixel := grey truncated.
+                error := ((grey - pixel) * 1024) truncated.
+
+                "/ adjust error
+                xE := x + 2.
+                error := error + (errorArray at:xE).
+
+                byte := byte bitShift:depth.
+                error > 512 "0.5" ifTrue:[
+                    pixel := pixel + 1.
+                    e := error - 1024 "1.0"
+                ] ifFalse:[
+                    e := error
+                ].
+
+                byte := byte bitOr:pixel.
+
+                e ~= 0 ifTrue:[
+                    e16 := e // 16.
+
+                    eR  := e16 * 7.              "/ 7/16 to right
+                    eRB := e16 "* 1".            "/ 1/16 to right below
+                    eB  := e16 * 5.              "/ 5/16 to below
+                    eLB := e - eR - eRB - eB.  "/ 3/16 to left below
+
+                    xN := xE + 1.
+                    eR ~= 0 ifTrue:[
+                        errorArray     at:xN put:(errorArray at:xN) + eR.
+                    ].
+                    eRB ~= 0 ifTrue:[
+                        nextErrorArray at:xN put:(nextErrorArray at:xN) + eRB.
+                    ].
+                    eB ~= 0 ifTrue:[
+                        nextErrorArray at:xE put:(nextErrorArray at:xE) + eB.
+                    ].
+                    eLB ~= 0 ifTrue:[
+                        xN := xE - 1.
+                        nextErrorArray at:xN put:(nextErrorArray at:xN) + eLB.
+                    ].
+                ].
+
+                bitCnt := bitCnt - depth.
+                bitCnt == 0 ifTrue:[
+                    outBits at:dstIndex put:byte.
+                    dstIndex := dstIndex + 1.
+                    byte := 0.
+                    bitCnt := 8.
+                ].
+
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                outBits at:dstIndex put:byte.
+                bitCnt := 8.
+            ].
+
+            dstIndex := nextDst.
+        ].
     ].
 
     ^ outBits
@@ -8042,64 +8099,64 @@
     byte := 0.
 
     self depth <= 12 ifTrue:[
-	"/ fetch scaled brightness values outside of loop into a table;
-	"/ use table-value in loop
-
-	greyValues := self greyMapForRange:(255 * 1024).
-	greyValues := greyValues collect:[:v | v rounded].
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerMonoRow.
-
-	    t := errorArray.
-	    errorArray := nextErrorArray.
-	    nextErrorArray := t.
-
-	    nextErrorArray atAllPut:0.
-
-	    self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
+        "/ fetch scaled brightness values outside of loop into a table;
+        "/ use table-value in loop
+
+        greyValues := self greyMapForRange:(255 * 1024).
+        greyValues := greyValues collect:[:v | v rounded].
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerMonoRow.
+
+            t := errorArray.
+            errorArray := nextErrorArray.
+            nextErrorArray := t.
+
+            nextErrorArray atAllPut:0.
+
+            self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
 %{
-		int __grey, __e;
-		int __byte = __intVal(byte);
-		OBJ *__errorArray = __ArrayInstPtr(errorArray)->a_element;
-		OBJ *__nextErrorArray = __ArrayInstPtr(nextErrorArray)->a_element;
-		int __x = __intVal(x);
-		int __eR, __eB, __eRB, __eLB, __eI;
-		int __bitCnt = __intVal(bitCnt);
-
-		__grey = __intVal(__ArrayInstPtr(greyValues)->a_element[__intVal(pixel)]);
-		__grey += __intVal(__errorArray[__x+1]);
-
-		__byte <<= 1;
-		if (__grey > 127*1024) {
-		    __e = __grey - (255*1024);
-		    __byte |= 1;
-		} else {
-		    __e = __grey;
-		}
-		if (__e) {
-		    __eI = __e >> 4;
-		    __eR  = __eI * 7;
-		    __eRB = __eI * 1;
-		    __eB  = __eI * 5;
-		    __eLB = __e - __eR - __eRB - __eB;
-		    __errorArray[__x+2] = __MKSMALLINT(__intVal(__errorArray[__x+2]) + __eR);
-		    __nextErrorArray[__x+2] = __MKSMALLINT(__intVal(__nextErrorArray[__x+2]) + __eRB);
-		    __nextErrorArray[__x+1] = __MKSMALLINT(__intVal(__nextErrorArray[__x+1]) + __eB);
-		    __nextErrorArray[__x  ] = __MKSMALLINT(__intVal(__nextErrorArray[__x  ]) + __eLB);
-
-		}
-		__bitCnt--;
-		if (__bitCnt == 0) {
-		    int __dstIndex = __intVal(dstIndex);
-
-		    __ByteArrayInstPtr(monoBits)->ba_element[__dstIndex-1] = __byte;
-		    dstIndex = __MKSMALLINT(__dstIndex + 1);
-		    __byte = 0;
-		    __bitCnt = 8;
-		}
-		byte = __MKSMALLINT(__byte);
-		bitCnt = __MKSMALLINT(__bitCnt);
+                int __grey, __e;
+                int __byte = __intVal(byte);
+                OBJ *__errorArray = __ArrayInstPtr(errorArray)->a_element;
+                OBJ *__nextErrorArray = __ArrayInstPtr(nextErrorArray)->a_element;
+                int __x = __intVal(x);
+                int __eR, __eB, __eRB, __eLB, __eI;
+                int __bitCnt = __intVal(bitCnt);
+
+                __grey = __intVal(__ArrayInstPtr(greyValues)->a_element[__intVal(pixel)]);
+                __grey += __intVal(__errorArray[__x+1]);
+
+                __byte <<= 1;
+                if (__grey > 127*1024) {
+                    __e = __grey - (255*1024);
+                    __byte |= 1;
+                } else {
+                    __e = __grey;
+                }
+                if (__e) {
+                    __eI = __e >> 4;
+                    __eR  = __eI * 7;
+                    __eRB = __eI * 1;
+                    __eB  = __eI * 5;
+                    __eLB = __e - __eR - __eRB - __eB;
+                    __errorArray[__x+2] = __MKSMALLINT(__intVal(__errorArray[__x+2]) + __eR);
+                    __nextErrorArray[__x+2] = __MKSMALLINT(__intVal(__nextErrorArray[__x+2]) + __eRB);
+                    __nextErrorArray[__x+1] = __MKSMALLINT(__intVal(__nextErrorArray[__x+1]) + __eB);
+                    __nextErrorArray[__x  ] = __MKSMALLINT(__intVal(__nextErrorArray[__x  ]) + __eLB);
+
+                }
+                __bitCnt--;
+                if (__bitCnt == 0) {
+                    int __dstIndex = __intVal(dstIndex);
+
+                    __ByteArrayInstPtr(monoBits)->ba_element[__dstIndex-1] = __byte;
+                    dstIndex = __MKSMALLINT(__dstIndex + 1);
+                    __byte = 0;
+                    __bitCnt = 8;
+                }
+                byte = __MKSMALLINT(__byte);
+                bitCnt = __MKSMALLINT(__bitCnt);
 %}.
 
 "/                |eI "{ Class: SmallInteger }"
@@ -8152,91 +8209,91 @@
 "/                    byte := 0.
 "/                    bitCnt := 8.
 "/                ].
-		  0
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		monoBits at:dstIndex put:byte.
-		bitCnt := 8.
-		byte := 0.
-	    ].
-
-	    dstIndex := nextDst.
-	].
+                  0
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                monoBits at:dstIndex put:byte.
+                bitCnt := 8.
+                byte := 0.
+            ].
+
+            dstIndex := nextDst.
+        ].
     ] ifFalse:[
-	'Image [info]: slow floydSteinberg dither ..' infoPrintCR.
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerMonoRow.
-
-	    t := errorArray.
-	    errorArray := nextErrorArray.
-	    nextErrorArray := t.
-
-	    nextErrorArray atAllPut:0.
-
-	    self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
-		|eI "{ Class: SmallInteger }"
-		 xE "{ Class: SmallInteger }"
-		 xN "{ Class: SmallInteger }" |
-
-		"/ get the colors grey value [0 .. 1]
-		grey := (clr brightness * 255).
-
-		"/ adjust error
-		xE := x + 2.
-		grey := (grey + (errorArray at:xE)) rounded.
-
-		byte := byte bitShift:1.
-		grey > 127 ifTrue:[
-		    byte := byte bitOr:1.      "/ white
-		    e := grey - 255
-		] ifFalse:[
-		    e := grey                  "/ black
-		].
-
-		e ~= 0 ifTrue:[
-		    eD := e.
-		    eI := e // 16.
-		    eR  := eI * 7.              "/ 7/16 to right
-		    eRB := eI "* 1".            "/ 1/16 to right below
-		    eB  := eI * 5.              "/ 5/16 to below
-		    eLB := eD - eR - eRB - eB.  "/ 3/16 to left below
-
-		    xN := xE + 1.
-		    eR ~= 0 ifTrue:[
-			errorArray     at:xN put:(errorArray at:xN) + eR.
-		    ].
-		    eRB ~= 0 ifTrue:[
-			nextErrorArray at:xN put:(nextErrorArray at:xN) + eRB.
-		    ].
-		    eB ~= 0 ifTrue:[
-			nextErrorArray at:xE put:(nextErrorArray at:xE) + eB.
-		    ].
-		    eLB ~= 0 ifTrue:[
-			xN := xE - 1.
-			nextErrorArray at:xN put:(nextErrorArray at:xN) + eLB.
-		    ].
-		].
-
-		bitCnt := bitCnt - 1.
-		bitCnt == 0 ifTrue:[
-		    monoBits at:dstIndex put:byte.
-		    dstIndex := dstIndex + 1.
-		    byte := 0.
-		    bitCnt := 8.
-		].
-
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		monoBits at:dstIndex put:byte.
-		bitCnt := 8.
-		byte := 0.
-	    ].
-
-	    dstIndex := nextDst.
-	].
+        'Image [info]: slow floydSteinberg dither ..' infoPrintCR.
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerMonoRow.
+
+            t := errorArray.
+            errorArray := nextErrorArray.
+            nextErrorArray := t.
+
+            nextErrorArray atAllPut:0.
+
+            self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
+                |eI "{ Class: SmallInteger }"
+                 xE "{ Class: SmallInteger }"
+                 xN "{ Class: SmallInteger }" |
+
+                "/ get the colors grey value [0 .. 1]
+                grey := (clr brightness * 255).
+
+                "/ adjust error
+                xE := x + 2.
+                grey := (grey + (errorArray at:xE)) rounded.
+
+                byte := byte bitShift:1.
+                grey > 127 ifTrue:[
+                    byte := byte bitOr:1.      "/ white
+                    e := grey - 255
+                ] ifFalse:[
+                    e := grey                  "/ black
+                ].
+
+                e ~= 0 ifTrue:[
+                    eD := e.
+                    eI := e // 16.
+                    eR  := eI * 7.              "/ 7/16 to right
+                    eRB := eI "* 1".            "/ 1/16 to right below
+                    eB  := eI * 5.              "/ 5/16 to below
+                    eLB := eD - eR - eRB - eB.  "/ 3/16 to left below
+
+                    xN := xE + 1.
+                    eR ~= 0 ifTrue:[
+                        errorArray     at:xN put:(errorArray at:xN) + eR.
+                    ].
+                    eRB ~= 0 ifTrue:[
+                        nextErrorArray at:xN put:(nextErrorArray at:xN) + eRB.
+                    ].
+                    eB ~= 0 ifTrue:[
+                        nextErrorArray at:xE put:(nextErrorArray at:xE) + eB.
+                    ].
+                    eLB ~= 0 ifTrue:[
+                        xN := xE - 1.
+                        nextErrorArray at:xN put:(nextErrorArray at:xN) + eLB.
+                    ].
+                ].
+
+                bitCnt := bitCnt - 1.
+                bitCnt == 0 ifTrue:[
+                    monoBits at:dstIndex put:byte.
+                    dstIndex := dstIndex + 1.
+                    byte := 0.
+                    bitCnt := 8.
+                ].
+
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                monoBits at:dstIndex put:byte.
+                bitCnt := 8.
+                byte := 0.
+            ].
+
+            dstIndex := nextDst.
+        ].
     ].
 
     ^ monoBits
@@ -8269,49 +8326,49 @@
     self depth ~~ 8 ifTrue:[^ nil].
 
     photometric == #palette ifTrue:[
-	lastColor := colorMap size - 1
+        lastColor := colorMap size - 1
     ] ifFalse:[
-	lastColor := 255.
+        lastColor := 255.
     ].
     idMap := ByteArray uninitializedNew:256.
 
     (nRed isNil or:[nGreen isNil or:[nBlue isNil]]) ifTrue:[
-	0 to:lastColor do:[:pix |
-	    |clr repClr|
-
-	    clr := self colorFromValue:pix.
-	    repClr := clr nearestIn:fixColors.
-	    idMap at:(pix+1) put:(fixColors identityIndexOf:repClr)-1.
-	].
+        0 to:lastColor do:[:pix |
+            |clr repClr|
+
+            clr := self colorFromValue:pix.
+            repClr := clr nearestIn:fixColors.
+            idMap at:(pix+1) put:(fixColors identityIndexOf:repClr)-1.
+        ].
     ] ifFalse:[
-	fixR := nRed.
-	fixR == 0 ifTrue:[ ^ nil].
-	fixG := nGreen.
-	fixG == 0 ifTrue:[ ^ nil].
-	fixB := nBlue.
-	fixB == 0 ifTrue:[ ^ nil].
-
-	"/ simple check
-	(fixR * fixG * fixB) ~~ fixColors size ifTrue:[
-	    self error:'invalid color array passed'.
-	    ^ nil
-	].
-
-	"/
-	"/ collect colorIds
-	"/
-	fixGfixB := fixG * fixB.
-
-	0 to:lastColor do:[:pix |
-	    clr := self colorFromValue:pix.
-	    r := clr redByte.
-	    g := clr greenByte.
-	    b := clr blueByte.
-	    idx := ((r * (fixR-1) + 128) // 255) * fixGfixB.
-	    idx := idx + (((g * (fixG-1) + 128) // 255) * fixB).
-	    idx := idx + ((b * (fixB-1) + 128) // 255).
-	    idMap at:(pix+1) put:(fixColors at:(idx+1)) colorId.
-	].
+        fixR := nRed.
+        fixR == 0 ifTrue:[ ^ nil].
+        fixG := nGreen.
+        fixG == 0 ifTrue:[ ^ nil].
+        fixB := nBlue.
+        fixB == 0 ifTrue:[ ^ nil].
+
+        "/ simple check
+        (fixR * fixG * fixB) ~~ fixColors size ifTrue:[
+            self error:'invalid color array passed'.
+            ^ nil
+        ].
+
+        "/
+        "/ collect colorIds
+        "/
+        fixGfixB := fixG * fixB.
+
+        0 to:lastColor do:[:pix |
+            clr := self colorFromValue:pix.
+            r := clr redByte.
+            g := clr greenByte.
+            b := clr blueByte.
+            idx := ((r * (fixR-1) + 128) // 255) * fixGfixB.
+            idx := idx + (((g * (fixG-1) + 128) // 255) * fixB).
+            idx := idx + ((b * (fixB-1) + 128) // 255).
+            idMap at:(pix+1) put:(fixColors at:(idx+1)) colorId.
+        ].
     ].
 
     pseudoBits := ByteArray uninitializedNew:(width * height).
@@ -8319,10 +8376,10 @@
     "/ translate
 
     self bits
-	expandPixels:8         "xlate only"
-	width:width height:height
-	into:pseudoBits
-	mapping:idMap.
+        expandPixels:8         "xlate only"
+        width:width height:height
+        into:pseudoBits
+        mapping:idMap.
 
     ^ pseudoBits
 
@@ -8379,18 +8436,18 @@
     rgbBytes := ByteArray uninitializedNew:256 * 3.
 
     photometric == #palette ifTrue:[
-	lastColor := colorMap size - 1
+        lastColor := colorMap size - 1
     ] ifFalse:[
-	lastColor := 255.
+        lastColor := 255.
     ].
     index := 1.
     0 to:lastColor do:[:pix |
-	clr := self colorFromValue:pix.
-	rgbBytes at:index put:(clr redByte).
-	rgbBytes at:index+1 put:(clr greenByte).
-	rgbBytes at:index+2 put:(clr blueByte).
-
-	index := index + 3.
+        clr := self colorFromValue:pix.
+        rgbBytes at:index put:(clr redByte).
+        rgbBytes at:index+1 put:(clr greenByte).
+        rgbBytes at:index+2 put:(clr blueByte).
+
+        index := index + 3.
     ].
 
     "/ collect valid ditherColors ...
@@ -8405,13 +8462,13 @@
     ditherRGBBytes := ByteArray uninitializedNew:(lastColor * 3).
     index := 1.
     1 to:lastColor do:[:pix |
-	clr := ditherColors at:pix.
-	ditherRGBBytes at:index put:(clr redByte).
-	ditherRGBBytes at:index+1 put:(clr greenByte).
-	ditherRGBBytes at:index+2 put:(clr blueByte).
-	ditherIds at:pix put:clr colorId.
-
-	index := index + 3.
+        clr := ditherColors at:pix.
+        ditherRGBBytes at:index put:(clr redByte).
+        ditherRGBBytes at:index+1 put:(clr greenByte).
+        ditherRGBBytes at:index+2 put:(clr blueByte).
+        ditherIds at:pix put:clr colorId.
+
+        index := index + 3.
     ].
 
     "/ place the ditherColor positions into a color cube
@@ -8439,17 +8496,17 @@
     maxIDX := numR*numG*numB.
     cube := Array new:maxIDX.
     1 to:lastColor do:[:clrIdx |
-	clr := ditherColors at:clrIdx.
-	rI := clr scaledRed. rI := (rI bitShift:shR) bitAnd:maskR.
-	gI := clr scaledGreen. gI := (gI bitShift:shG) bitAnd:maskG.
-	bI := clr scaledBlue. bI := (bI bitShift:shB) bitAnd:maskB.
-	index := rI + gI + bI + 1.
-	subCubeColorCollection := cube at:index.
-	subCubeColorCollection isNil ifTrue:[
-	    subCubeColorCollection := OrderedCollection new.
-	    cube at:index put:subCubeColorCollection.
-	].
-	subCubeColorCollection add:(clrIdx - 1).
+        clr := ditherColors at:clrIdx.
+        rI := clr scaledRed. rI := (rI bitShift:shR) bitAnd:maskR.
+        gI := clr scaledGreen. gI := (gI bitShift:shG) bitAnd:maskG.
+        bI := clr scaledBlue. bI := (bI bitShift:shB) bitAnd:maskB.
+        index := rI + gI + bI + 1.
+        subCubeColorCollection := cube at:index.
+        subCubeColorCollection isNil ifTrue:[
+            subCubeColorCollection := OrderedCollection new.
+            cube at:index put:subCubeColorCollection.
+        ].
+        subCubeColorCollection add:(clrIdx - 1).
     ].
 
     shR := 1 bitShift:(bitsG+bitsB).
@@ -8457,10 +8514,10 @@
     shB := 1.
 
     1 to:maxIDX do:[:i |
-	subCubeColorCollection := cube at:i.
-	subCubeColorCollection notNil ifTrue:[
-	    cube at:i put:(subCubeColorCollection asByteArray)
-	]
+        subCubeColorCollection := cube at:i.
+        subCubeColorCollection notNil ifTrue:[
+            cube at:i put:(subCubeColorCollection asByteArray)
+        ]
     ].
 
 "/    nCube := cube copy.
@@ -8556,307 +8613,307 @@
      && __isByteArray(ditherRGBBytes)
      && __isByteArray(ditherIds)
      && __isByteArray(error)) {
-	failed = false;
-
-	srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-	dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
-	rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
-	idP = __ByteArrayInstPtr(ditherIds)->ba_element;
-	errP = (short *) __ByteArrayInstPtr(error)->ba_element;
-	__cube = __ArrayInstPtr(cube)->a_element;
-
-	eP = errP;
-
-	for (__y=__h; __y>0; __y--) {
-	    eP = &(errP[3]);
-	    __eR = eP[0];
-	    __eG = eP[1];
-	    __eB = eP[2];
-
-	    for (__x=__w; __x>0; __x--) {
-		int __want;
-		int pix;
-		int __wantR, __wantG, __wantB;
-		int idx;
-		int tR, tG, tB;
-		int nR, nG, nB;
-		int __dR, __dG, __dB;
-		int minDelta, bestIdx;
-		int __iR, __iG, __iB;
-		int cR, cG, cB;
-		int delta;
-		OBJ subCubeColors;
-
-		pix = *srcP++;
-
-		/*
-		 * wR, wG and wB is the wanted r/g/b value;
-		 */
-		idx = pix+pix+pix;  /* pix * 3 */
-
-		__wR = __wantR = rgbP[idx] + __eR;
-		__wG = __wantG = rgbP[idx+1] + __eG;
-		__wB = __wantB = rgbP[idx+2] + __eB;
-		if(__wR > 255) __wR = 255;
-		else if (__wR < 0) __wR = 0;
-		if(__wG > 255) __wG = 255;
-		else if (__wG < 0) __wG = 0;
-		if(__wB > 255) __wB = 255;
-		else if (__wB < 0) __wB = 0;
-
-		__iR = __wR >> (8-BITSR);
-		__iG = __wG >> (8-BITSG);
-		__iB = __wB >> (8-BITSB);
-
-		cubeIndex = (__iR<<SHR) + (__iG<<SHG) + __iB;
-		subCubeColors = __cube[cubeIndex];
-
-		if (subCubeColors == nil) {
-		    /* search around in spirals, for the first match */
-
-		    delta = 1;
-		    while (delta < MAXRGB) {
-			/* check plane above */
-			cR = __iR + delta;
-			if ((unsigned)cR < NR) {
-			    for (cG=__iG-delta; cG<=__iG+delta; cG++) {
-				if ((unsigned)cG < NG) {
-				    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
-					if ((unsigned)cB < NB) {
-					    cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
-					    subCubeColors = __cube[cubeIndex2];
-					    if (__isNonNilObject(subCubeColors)) {
-						goto found;
-					    }
-					}
-				    }
-				}
-			    }
-			}
-
-			/* check plane below */
-			cR = __iR - delta;
-			if ((unsigned)cR < NR) {
-			    for (cG=__iG-delta; cG<=__iG+delta; cG++) {
-				if ((unsigned)cG < NG) {
-				    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
-					if ((unsigned)cB < NB) {
-					    cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
-					    subCubeColors = __cube[cubeIndex2];
-					    if (__isNonNilObject(subCubeColors)) {
-						goto found;
-					    }
-					}
-				    }
-				}
-			    }
-			}
-
-			/* check plane to the right */
-			cG = __iG + delta;
-			if ((unsigned)cG < NG) {
-			    for (cR=__iR-delta+1; cR<=__iR+delta-1; cR++) {
-				if ((unsigned)cR < NR) {
-				    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
-					if ((unsigned)cB < NB) {
-					    cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
-					    subCubeColors = __cube[cubeIndex2];
-					    if (__isNonNilObject(subCubeColors)) {
-						goto found;
-					    }
-					}
-				    }
-				}
-			    }
-			}
-
-			/* check plane to the left */
-			cG = __iG - delta;
-			if ((unsigned)cG < NG) {
-			    for (cR=__iR-delta+1; cR<=__iR+delta-1; cR++) {
-				if ((unsigned)cR < NR) {
-				    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
-					if ((unsigned)cB < NB) {
-					    cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
-					    subCubeColors = __cube[cubeIndex2];
-					    if (__isNonNilObject(subCubeColors)) {
-						goto found;
-					    }
-					}
-				    }
-				}
-			    }
-			}
-
-			/* check plane at back */
-			cB = __iB + delta;
-			if ((unsigned)cB < NB) {
-			    for (cR=__iR-delta+1; cR<=(__iR+delta-1); cR++) {
-				if ((unsigned)cR < NR) {
-				    for (cG=__iG-delta+1; cG<=(__iG+delta-1); cG++) {
-					if ((unsigned)cG < NG) {
-					    cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
-					    subCubeColors = __cube[cubeIndex2];
-					    if (__isNonNilObject(subCubeColors)) {
-						goto found;
-					    }
-					}
-				    }
-				}
-			    }
-			}
-
-			/* check plane at front */
-			cB = __iB - delta;
-			if ((unsigned)cB < NB) {
-			    for (cR=__iR-delta+1; cR<=(__iR+delta-1); cR++) {
-				if ((unsigned)cR < NR) {
-				    for (cG=__iG-delta+1; cG<=(__iG+delta-1); cG++) {
-					if ((unsigned)cG < NG) {
-					    cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
-					    subCubeColors = __cube[cubeIndex2];
-					    if (__isNonNilObject(subCubeColors)) {
-						goto found;
-					    }
-					}
-				    }
-				}
-			    }
-			}
-			delta = delta + 1;
-
-		    }
-		    /* cannot happen - will lead to a segmentation violation ... */
-		    subCubeColors = nil;
+        failed = false;
+
+        srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+        dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
+        rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
+        idP = __ByteArrayInstPtr(ditherIds)->ba_element;
+        errP = (short *) __ByteArrayInstPtr(error)->ba_element;
+        __cube = __ArrayInstPtr(cube)->a_element;
+
+        eP = errP;
+
+        for (__y=__h; __y>0; __y--) {
+            eP = &(errP[3]);
+            __eR = eP[0];
+            __eG = eP[1];
+            __eB = eP[2];
+
+            for (__x=__w; __x>0; __x--) {
+                int __want;
+                int pix;
+                int __wantR, __wantG, __wantB;
+                int idx;
+                int tR, tG, tB;
+                int nR, nG, nB;
+                int __dR, __dG, __dB;
+                int minDelta, bestIdx;
+                int __iR, __iG, __iB;
+                int cR, cG, cB;
+                int delta;
+                OBJ subCubeColors;
+
+                pix = *srcP++;
+
+                /*
+                 * wR, wG and wB is the wanted r/g/b value;
+                 */
+                idx = pix+pix+pix;  /* pix * 3 */
+
+                __wR = __wantR = rgbP[idx] + __eR;
+                __wG = __wantG = rgbP[idx+1] + __eG;
+                __wB = __wantB = rgbP[idx+2] + __eB;
+                if(__wR > 255) __wR = 255;
+                else if (__wR < 0) __wR = 0;
+                if(__wG > 255) __wG = 255;
+                else if (__wG < 0) __wG = 0;
+                if(__wB > 255) __wB = 255;
+                else if (__wB < 0) __wB = 0;
+
+                __iR = __wR >> (8-BITSR);
+                __iG = __wG >> (8-BITSG);
+                __iB = __wB >> (8-BITSB);
+
+                cubeIndex = (__iR<<SHR) + (__iG<<SHG) + __iB;
+                subCubeColors = __cube[cubeIndex];
+
+                if (subCubeColors == nil) {
+                    /* search around in spirals, for the first match */
+
+                    delta = 1;
+                    while (delta < MAXRGB) {
+                        /* check plane above */
+                        cR = __iR + delta;
+                        if ((unsigned)cR < NR) {
+                            for (cG=__iG-delta; cG<=__iG+delta; cG++) {
+                                if ((unsigned)cG < NG) {
+                                    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
+                                        if ((unsigned)cB < NB) {
+                                            cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
+                                            subCubeColors = __cube[cubeIndex2];
+                                            if (__isNonNilObject(subCubeColors)) {
+                                                goto found;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* check plane below */
+                        cR = __iR - delta;
+                        if ((unsigned)cR < NR) {
+                            for (cG=__iG-delta; cG<=__iG+delta; cG++) {
+                                if ((unsigned)cG < NG) {
+                                    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
+                                        if ((unsigned)cB < NB) {
+                                            cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
+                                            subCubeColors = __cube[cubeIndex2];
+                                            if (__isNonNilObject(subCubeColors)) {
+                                                goto found;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* check plane to the right */
+                        cG = __iG + delta;
+                        if ((unsigned)cG < NG) {
+                            for (cR=__iR-delta+1; cR<=__iR+delta-1; cR++) {
+                                if ((unsigned)cR < NR) {
+                                    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
+                                        if ((unsigned)cB < NB) {
+                                            cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
+                                            subCubeColors = __cube[cubeIndex2];
+                                            if (__isNonNilObject(subCubeColors)) {
+                                                goto found;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* check plane to the left */
+                        cG = __iG - delta;
+                        if ((unsigned)cG < NG) {
+                            for (cR=__iR-delta+1; cR<=__iR+delta-1; cR++) {
+                                if ((unsigned)cR < NR) {
+                                    for (cB=__iB-delta; cB<=__iB+delta; cB++) {
+                                        if ((unsigned)cB < NB) {
+                                            cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
+                                            subCubeColors = __cube[cubeIndex2];
+                                            if (__isNonNilObject(subCubeColors)) {
+                                                goto found;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* check plane at back */
+                        cB = __iB + delta;
+                        if ((unsigned)cB < NB) {
+                            for (cR=__iR-delta+1; cR<=(__iR+delta-1); cR++) {
+                                if ((unsigned)cR < NR) {
+                                    for (cG=__iG-delta+1; cG<=(__iG+delta-1); cG++) {
+                                        if ((unsigned)cG < NG) {
+                                            cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
+                                            subCubeColors = __cube[cubeIndex2];
+                                            if (__isNonNilObject(subCubeColors)) {
+                                                goto found;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* check plane at front */
+                        cB = __iB - delta;
+                        if ((unsigned)cB < NB) {
+                            for (cR=__iR-delta+1; cR<=(__iR+delta-1); cR++) {
+                                if ((unsigned)cR < NR) {
+                                    for (cG=__iG-delta+1; cG<=(__iG+delta-1); cG++) {
+                                        if ((unsigned)cG < NG) {
+                                            cubeIndex2 = (cR<<SHR) + (cG<<SHG) + cB;
+                                            subCubeColors = __cube[cubeIndex2];
+                                            if (__isNonNilObject(subCubeColors)) {
+                                                goto found;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        delta = delta + 1;
+
+                    }
+                    /* cannot happen - will lead to a segmentation violation ... */
+                    subCubeColors = nil;
 
     found:
-		    __iR = cR;
-		    __iG = cG;
-		    __iB = cB;
-		    bestIdx = __ByteArrayInstPtr(subCubeColors)->ba_element[0];
+                    __iR = cR;
+                    __iG = cG;
+                    __iB = cB;
+                    bestIdx = __ByteArrayInstPtr(subCubeColors)->ba_element[0];
 #ifdef REMEMBER_SEARCH
-		    __cube[cubeIndex] = __MKSMALLINT(bestIdx);
+                    __cube[cubeIndex] = __MKSMALLINT(bestIdx);
 #endif
-		} else {
+                } else {
 #ifdef REMEMBER_SEARCH
-		    if (__isSmallInteger(subCubeColors)) {
-			bestIdx = __intVal(subCubeColors);
-		    } else
+                    if (__isSmallInteger(subCubeColors)) {
+                        bestIdx = __intVal(subCubeColors);
+                    } else
 #endif
-		    {
-			bestIdx = __ByteArrayInstPtr(subCubeColors)->ba_element[0];
-		    }
-		}
-
-		/*
-		 * ok, now, we have found a collection of nearby
-		 * colors in subCubeColors.
-		 *
-		 * since the error is at most 1/16 (i.e. roughly 6%),
-		 * dont care for searching the best - simply take the
-		 * first color found there.
-		 * (statistic reduces the error to even a smaller value).
-		 * There is no real problem due to that error, since
-		 * it will be diffused anyway ...
-		 */
+                    {
+                        bestIdx = __ByteArrayInstPtr(subCubeColors)->ba_element[0];
+                    }
+                }
+
+                /*
+                 * ok, now, we have found a collection of nearby
+                 * colors in subCubeColors.
+                 *
+                 * since the error is at most 1/16 (i.e. roughly 6%),
+                 * dont care for searching the best - simply take the
+                 * first color found there.
+                 * (statistic reduces the error to even a smaller value).
+                 * There is no real problem due to that error, since
+                 * it will be diffused anyway ...
+                 */
 
 #ifndef NO_FLOYD_STEINBERG
-		{
-		    unsigned char *dp;
-
-		    /*
-		     * fetch that colors r/g/b components
-		     */
-		    dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
-		    dp += bestIdx * 3;
-		    __dR = dp[0];
-		    __dG = dp[1];
-		    __dB = dp[2];
-		}
+                {
+                    unsigned char *dp;
+
+                    /*
+                     * fetch that colors r/g/b components
+                     */
+                    dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
+                    dp += bestIdx * 3;
+                    __dR = dp[0];
+                    __dG = dp[1];
+                    __dB = dp[2];
+                }
 #endif
 
 /*
 console_fprintf(stderr, "want: %d/%d/%d (%d/%d/%d) got: %d/%d/%d\n",
-		__wantR, __wantG, __wantB,
-		__wR, __wG, __wB,
-		__dR, __dG, __dB);
+                __wantR, __wantG, __wantB,
+                __wR, __wG, __wB,
+                __dR, __dG, __dB);
 */
-		/*
-		 * store the corresponding dither colors colorId
-		 */
-		*dstP++ = idP[bestIdx];
+                /*
+                 * store the corresponding dither colors colorId
+                 */
+                *dstP++ = idP[bestIdx];
 
 #ifndef NO_FLOYD_STEINBERG
-		/*
-		 * the new error & distribute the error
-		 */
-		__eR = __wantR - __dR;
-		if (__eR) {
-		    tR = __eR >> 4;  /* 16th of error */
-		    nR = eP[3] + (tR * 7);/* from accu: error for (x+1 / y) */
-		    eP[0] = tR*5;         /* 5/16th for (x / y+1) */
-		    eP[-3] = tR*3;        /* 3/16th for (x-1 / y+1) */
-		    eP[3] = __eR - (tR*15);  /* 1/16th for (x+1 / y+1) */
-		    __eR = nR;
-		} else {
-		    __eR = eP[3];
-		    eP[0] = eP[-3] = eP[3] = 0;
-		}
-
-		__eG = __wantG - __dG;
-		if (__eG) {
-		    tG = __eG >> 4;
-		    nG = eP[4] + (tG * 7);/* plus 7/16'th of this error */
-		    eP[1] = tG*5;
-		    eP[-2] = tG*3;
-		    eP[4] = __eG - (tG*15);
-		    __eG = nG;
-		} else {
-		    __eG = eP[4];
-		    eP[1] = eP[-2] = eP[4] = 0;
-		}
-
-		__eB = __wantB - __dB;
-		if (__eB) {
-		    tB = __eB >> 4;
-		    nB = eP[5] + (tB * 7);
-		    eP[2] = tB*5;
-		    eP[-1] = tB*3;
-		    eP[5] = __eB - (tB*15);
-		    __eB = nB;
-		} else {
-		    __eB = eP[5];
-		    eP[2] = eP[-1] = eP[5] = 0;
-		}
-
-		eP += 3;
+                /*
+                 * the new error & distribute the error
+                 */
+                __eR = __wantR - __dR;
+                if (__eR) {
+                    tR = __eR >> 4;  /* 16th of error */
+                    nR = eP[3] + (tR * 7);/* from accu: error for (x+1 / y) */
+                    eP[0] = tR*5;         /* 5/16th for (x / y+1) */
+                    eP[-3] = tR*3;        /* 3/16th for (x-1 / y+1) */
+                    eP[3] = __eR - (tR*15);  /* 1/16th for (x+1 / y+1) */
+                    __eR = nR;
+                } else {
+                    __eR = eP[3];
+                    eP[0] = eP[-3] = eP[3] = 0;
+                }
+
+                __eG = __wantG - __dG;
+                if (__eG) {
+                    tG = __eG >> 4;
+                    nG = eP[4] + (tG * 7);/* plus 7/16'th of this error */
+                    eP[1] = tG*5;
+                    eP[-2] = tG*3;
+                    eP[4] = __eG - (tG*15);
+                    __eG = nG;
+                } else {
+                    __eG = eP[4];
+                    eP[1] = eP[-2] = eP[4] = 0;
+                }
+
+                __eB = __wantB - __dB;
+                if (__eB) {
+                    tB = __eB >> 4;
+                    nB = eP[5] + (tB * 7);
+                    eP[2] = tB*5;
+                    eP[-1] = tB*3;
+                    eP[5] = __eB - (tB*15);
+                    __eB = nB;
+                } else {
+                    __eB = eP[5];
+                    eP[2] = eP[-1] = eP[5] = 0;
+                }
+
+                eP += 3;
 #endif
-	    }
-
-	    /*
-	     * allow for an interrupt after every row.
-	     * but care to refetch C variables
-	     */
-	    if (InterruptPending) {
-		int d_srcP = srcP - __ByteArrayInstPtr(__INST(bytes))->ba_element;
-		int d_dstP = dstP - __ByteArrayInstPtr(pseudoBits)->ba_element;
-		int d_errP = errP - (short *) __ByteArrayInstPtr(error)->ba_element;
-
-		__interrupt__();
-
-		srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element + d_srcP;
-		dstP = __ByteArrayInstPtr(pseudoBits)->ba_element + d_dstP;
-		rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
-		idP = __ByteArrayInstPtr(ditherIds)->ba_element;
-		errP = (short *) __ByteArrayInstPtr(error)->ba_element + d_errP;
-		__cube = __ArrayInstPtr(cube)->a_element;
-	    }
-	}
+            }
+
+            /*
+             * allow for an interrupt after every row.
+             * but care to refetch C variables
+             */
+            if (InterruptPending) {
+                int d_srcP = srcP - __ByteArrayInstPtr(__INST(bytes))->ba_element;
+                int d_dstP = dstP - __ByteArrayInstPtr(pseudoBits)->ba_element;
+                int d_errP = errP - (short *) __ByteArrayInstPtr(error)->ba_element;
+
+                __interrupt__();
+
+                srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element + d_srcP;
+                dstP = __ByteArrayInstPtr(pseudoBits)->ba_element + d_dstP;
+                rgbP = __ByteArrayInstPtr(rgbBytes)->ba_element;
+                idP = __ByteArrayInstPtr(ditherIds)->ba_element;
+                errP = (short *) __ByteArrayInstPtr(error)->ba_element + d_errP;
+                __cube = __ArrayInstPtr(cube)->a_element;
+            }
+        }
     }
 %}.
     failed ifTrue:[
-	self primitiveFailed.
-	^ nil
+        self primitiveFailed.
+        ^ nil
     ].
 
     ^ pseudoBits
@@ -8866,9 +8923,9 @@
     "return the bitmap for a dithered depth-bitmap from the image"
 
     ^ self
-	orderedDitheredGrayBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
-	ditherWidth:8
-	depth:depth.
+        orderedDitheredGrayBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
+        ditherWidth:8
+        depth:depth.
 
     "Created: 24.6.1997 / 22:20:12 / cg"
 !
@@ -8893,8 +8950,8 @@
      byte            "{Class: SmallInteger }" |
 
     depth > 8 ifTrue:[
-	'IMAGE: unimplemented orderedDither conversion' errorPrintCR.
-	^ nil
+        'IMAGE: unimplemented orderedDither conversion' errorPrintCR.
+        ^ nil
     ].
 
     nDither := ditherMatrix size.
@@ -8912,144 +8969,144 @@
     dstIndex := 1.
 
     self bitsPerPixel <= 12 ifTrue:[
-	"/ fetch scaled brightness values outside of loop into a table;
-	"/ use table-value in loop
-
-	greyValues := self greyMapForRange:(greyLevels-1).
-	greyPixels := greyValues collect:[:v | v isNil ifTrue:[
-						   0
-					       ] ifFalse:[
-						   v truncated]].
-	greyPixels := ByteArray withAll:greyPixels.
-
-	greyErrors := greyValues collect:[:v | v isNil ifTrue:[
-						   0
-					       ] ifFalse:[
-						   ((v - v truncated) * nDither) rounded
-					       ]].
-	greyErrors := ByteArray withAll:greyErrors.
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerOutRow.
-	    byte := 0.
-	    bitCnt := 8.
-
-	    self valuesAtY:y from:0 to:(w-1) do:[:x :value |
+        "/ fetch scaled brightness values outside of loop into a table;
+        "/ use table-value in loop
+
+        greyValues := self greyMapForRange:(greyLevels-1).
+        greyPixels := greyValues collect:[:v | v isNil ifTrue:[
+                                                   0
+                                               ] ifFalse:[
+                                                   v truncated]].
+        greyPixels := ByteArray withAll:greyPixels.
+
+        greyErrors := greyValues collect:[:v | v isNil ifTrue:[
+                                                   0
+                                               ] ifFalse:[
+                                                   ((v - v truncated) * nDither) rounded
+                                               ]].
+        greyErrors := ByteArray withAll:greyErrors.
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerOutRow.
+            byte := 0.
+            bitCnt := 8.
+
+            self valuesAtY:y from:0 to:(w-1) do:[:x :value |
 %{
-		int __dW = __intVal(dW);
-		int __byte = __intVal(byte);
-		/* Note: __value is reserved in Visual C++ 8 (2005) */
-		int __val = __intVal(value);
-		int __dT;
-		int __dstIdx;
-		int __pixel, __grey;
-		int __bitCnt = __intVal(bitCnt);
-		unsigned char *__greyPixels = __ByteArrayInstPtr(greyPixels)->ba_element;
-		unsigned char *__greyErrors = __ByteArrayInstPtr(greyErrors)->ba_element;
-
-		__pixel = __greyPixels[__val];
-		__grey = __greyErrors[__val];
-
-		__dT = __ByteArrayInstPtr(ditherMatrix)
-			    ->ba_element[__intVal(x) % __dW
-					 + (__intVal(y) % __intVal(dH)) * __dW];
-
-		if (__grey > __dT) {
-		    __pixel++;
-		}
-		__byte = (__byte << __intVal(depth)) | __pixel;
-
-		__bitCnt = __bitCnt - __intVal(depth);
-		if (__bitCnt == 0) {
-		    __dstIdx = __intVal(dstIndex);
-		    __ByteArrayInstPtr(outBits)->ba_element[__dstIdx-1] = __byte;
-		    __dstIdx = __dstIdx + 1;
-		    dstIndex = __MKSMALLINT(__dstIdx);
-		    __byte = 0;
-		    __bitCnt = 8;
-		}
-		byte = __MKSMALLINT(__byte);
-		bitCnt = __MKSMALLINT(__bitCnt);
+                int __dW = __intVal(dW);
+                int __byte = __intVal(byte);
+                /* Note: __value is reserved in Visual C++ 8 (2005) */
+                int __val = __intVal(value);
+                int __dT;
+                int __dstIdx;
+                int __pixel, __grey;
+                int __bitCnt = __intVal(bitCnt);
+                unsigned char *__greyPixels = __ByteArrayInstPtr(greyPixels)->ba_element;
+                unsigned char *__greyErrors = __ByteArrayInstPtr(greyErrors)->ba_element;
+
+                __pixel = __greyPixels[__val];
+                __grey = __greyErrors[__val];
+
+                __dT = __ByteArrayInstPtr(ditherMatrix)
+                            ->ba_element[__intVal(x) % __dW
+                                         + (__intVal(y) % __intVal(dH)) * __dW];
+
+                if (__grey > __dT) {
+                    __pixel++;
+                }
+                __byte = (__byte << __intVal(depth)) | __pixel;
+
+                __bitCnt = __bitCnt - __intVal(depth);
+                if (__bitCnt == 0) {
+                    __dstIdx = __intVal(dstIndex);
+                    __ByteArrayInstPtr(outBits)->ba_element[__dstIdx-1] = __byte;
+                    __dstIdx = __dstIdx + 1;
+                    dstIndex = __MKSMALLINT(__dstIdx);
+                    __byte = 0;
+                    __bitCnt = 8;
+                }
+                byte = __MKSMALLINT(__byte);
+                bitCnt = __MKSMALLINT(__bitCnt);
 %}.
-		0
-
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		outBits at:dstIndex put:byte.
-	    ].
-	    dstIndex := nextDst.
-	].
+                0
+
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                outBits at:dstIndex put:byte.
+            ].
+            dstIndex := nextDst.
+        ].
     ] ifFalse:[
-	'Image [info]: slow ordered dither ..' infoPrintCR.
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerOutRow.
-	    byte := 0.
-	    bitCnt := 8.
-
-	    "/ this is the representaion independent (but slow)
-	    "/ inner loop - it extracts colors from the receiver
-
-	    self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
-		|dstClr grey dT pixel|
-
-		"/ get the colors grey value [0 .. 1]
-		grey := clr brightness.
-
-		"/ remap into [0 .. greyLevels-1]
-		grey := grey * (greyLevels-1).
-
-		"/ get threshold pixel [0 .. greyLevels-1]
-
-		pixel := grey truncated.
-
-		"/ compute the error [0..1]
-		grey := grey - pixel.
-
-		"/ map into dither space [0 .. nDither]
-		grey := (grey * (nDither)) rounded.
+        'Image [info]: slow ordered dither ..' infoPrintCR.
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerOutRow.
+            byte := 0.
+            bitCnt := 8.
+
+            "/ this is the representaion independent (but slow)
+            "/ inner loop - it extracts colors from the receiver
+
+            self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
+                |dstClr grey dT pixel|
+
+                "/ get the colors grey value [0 .. 1]
+                grey := clr brightness.
+
+                "/ remap into [0 .. greyLevels-1]
+                grey := grey * (greyLevels-1).
+
+                "/ get threshold pixel [0 .. greyLevels-1]
+
+                pixel := grey truncated.
+
+                "/ compute the error [0..1]
+                grey := grey - pixel.
+
+                "/ map into dither space [0 .. nDither]
+                grey := (grey * (nDither)) rounded.
 
 %{
-		int __dW = __intVal(dW);
-		int __byte = __intVal(byte);
-		int __dT;
-		int __dstIdx;
-		int __pixel;
-		int __bitCnt = __intVal(bitCnt);
-
-		__dT = __ByteArrayInstPtr(ditherMatrix)
-			    ->ba_element[__intVal(x) % __dW
-					 + (__intVal(y) % __intVal(dH)) * __dW];
-
-		__pixel = __intVal(pixel);
-
-		if (__intVal(grey) > __dT) {
-		    __pixel++;
-		}
-		__byte = (__byte << __intVal(depth)) | __pixel;
-
-		__bitCnt = __bitCnt - __intVal(depth);
-		if (__bitCnt == 0) {
-		    __dstIdx = __intVal(dstIndex);
-		    __ByteArrayInstPtr(outBits)->ba_element[__dstIdx-1] = __byte;
-		    __dstIdx = __dstIdx + 1;
-		    dstIndex = __MKSMALLINT(__dstIdx);
-		    __byte = 0;
-		    __bitCnt = 8;
-		}
-		byte = __MKSMALLINT(__byte);
-		bitCnt = __MKSMALLINT(__bitCnt);
+                int __dW = __intVal(dW);
+                int __byte = __intVal(byte);
+                int __dT;
+                int __dstIdx;
+                int __pixel;
+                int __bitCnt = __intVal(bitCnt);
+
+                __dT = __ByteArrayInstPtr(ditherMatrix)
+                            ->ba_element[__intVal(x) % __dW
+                                         + (__intVal(y) % __intVal(dH)) * __dW];
+
+                __pixel = __intVal(pixel);
+
+                if (__intVal(grey) > __dT) {
+                    __pixel++;
+                }
+                __byte = (__byte << __intVal(depth)) | __pixel;
+
+                __bitCnt = __bitCnt - __intVal(depth);
+                if (__bitCnt == 0) {
+                    __dstIdx = __intVal(dstIndex);
+                    __ByteArrayInstPtr(outBits)->ba_element[__dstIdx-1] = __byte;
+                    __dstIdx = __dstIdx + 1;
+                    dstIndex = __MKSMALLINT(__dstIdx);
+                    __byte = 0;
+                    __bitCnt = 8;
+                }
+                byte = __MKSMALLINT(__byte);
+                bitCnt = __MKSMALLINT(__bitCnt);
 %}.
-		0
-
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		outBits at:dstIndex put:byte.
-	    ].
-	    dstIndex := nextDst.
-	].
+                0
+
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                outBits at:dstIndex put:byte.
+            ].
+            dstIndex := nextDst.
+        ].
     ].
     ^ outBits
 !
@@ -9059,8 +9116,8 @@
      using a default ditherMatrix."
 
     ^ self
-	orderedDitheredMonochromeBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
-	ditherWidth:8
+        orderedDitheredMonochromeBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
+        ditherWidth:8
 
     "Created: 11.6.1996 / 16:48:57 / cg"
 !
@@ -9095,99 +9152,99 @@
     dstIndex := 1.
 
     self bitsPerPixel <= 12 ifTrue:[
-	"/ fetch scaled brightness values outside of loop into a table;
-	"/ use table-value in loop
-
-	greyValues := self greyByteMapForRange:nDither.
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerMonoRow.
-	    byte := 0.
-	    bitCnt := 8.
-	    self valuesAtY:y from:0 to:(w-1) do:[:x :value |
+        "/ fetch scaled brightness values outside of loop into a table;
+        "/ use table-value in loop
+
+        greyValues := self greyByteMapForRange:nDither.
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerMonoRow.
+            byte := 0.
+            bitCnt := 8.
+            self valuesAtY:y from:0 to:(w-1) do:[:x :value |
 %{
-		int __dW = __intVal(dW);
-		int __byte = __intVal(byte);
-		int __dT;
-		int __dstIdx;
-		int __bitCnt = __intVal(bitCnt);
-		int __grey;
-		unsigned char *__greyValues = __ByteArrayInstPtr(greyValues)->ba_element;
-
-		__grey = __greyValues[__intVal(value)];
-
-		__dT = __ByteArrayInstPtr(ditherMatrix)
-			    ->ba_element[__intVal(x) % __dW
-					 + (__intVal(y) % __intVal(dH)) * __dW];
-
-		__byte = __byte << 1;
-		if (__grey > __dT) {
-		    __byte = __byte | 1;            /* white */
-		}
-		__bitCnt = __bitCnt - 1;
-		if (__bitCnt == 0) {
-		    __dstIdx = __intVal(dstIndex);
-		    __ByteArrayInstPtr(monoBits)->ba_element[__dstIdx-1] = __byte;
-		    __dstIdx = __dstIdx + 1;
-		    dstIndex = __MKSMALLINT(__dstIdx);
-		    __byte = 0;
-		    __bitCnt = 8;
-		}
-		byte = __MKSMALLINT(__byte);
-		bitCnt = __MKSMALLINT(__bitCnt);
+                int __dW = __intVal(dW);
+                int __byte = __intVal(byte);
+                int __dT;
+                int __dstIdx;
+                int __bitCnt = __intVal(bitCnt);
+                int __grey;
+                unsigned char *__greyValues = __ByteArrayInstPtr(greyValues)->ba_element;
+
+                __grey = __greyValues[__intVal(value)];
+
+                __dT = __ByteArrayInstPtr(ditherMatrix)
+                            ->ba_element[__intVal(x) % __dW
+                                         + (__intVal(y) % __intVal(dH)) * __dW];
+
+                __byte = __byte << 1;
+                if (__grey > __dT) {
+                    __byte = __byte | 1;            /* white */
+                }
+                __bitCnt = __bitCnt - 1;
+                if (__bitCnt == 0) {
+                    __dstIdx = __intVal(dstIndex);
+                    __ByteArrayInstPtr(monoBits)->ba_element[__dstIdx-1] = __byte;
+                    __dstIdx = __dstIdx + 1;
+                    dstIndex = __MKSMALLINT(__dstIdx);
+                    __byte = 0;
+                    __bitCnt = 8;
+                }
+                byte = __MKSMALLINT(__byte);
+                bitCnt = __MKSMALLINT(__bitCnt);
 %}.
-		0
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		monoBits at:dstIndex put:byte.
-	    ].
-	    dstIndex := nextDst.
-	].
+                0
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                monoBits at:dstIndex put:byte.
+            ].
+            dstIndex := nextDst.
+        ].
     ] ifFalse:[
-	'Image [info]: slow ordered dither ..' infoPrintCR.
-
-	0 to:(h-1) do:[:y |
-	    nextDst := dstIndex + bytesPerMonoRow.
-	    byte := 0.
-	    bitCnt := 8.
-	    self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
-		|dstClr grey dT|
-
-		"/ get the colors grey value [0 .. 1]
-		grey := clr brightness.
-
-		"/ map into dither space [0 .. nDither]
-		grey := (grey * (nDither)) rounded.
+        'Image [info]: slow ordered dither ..' infoPrintCR.
+
+        0 to:(h-1) do:[:y |
+            nextDst := dstIndex + bytesPerMonoRow.
+            byte := 0.
+            bitCnt := 8.
+            self colorsAtY:y from:0 to:(w-1) do:[:x :clr |
+                |dstClr grey dT|
+
+                "/ get the colors grey value [0 .. 1]
+                grey := clr brightness.
+
+                "/ map into dither space [0 .. nDither]
+                grey := (grey * (nDither)) rounded.
 
 %{
-		int __dW = __intVal(dW);
-		int __byte = __intVal(byte);
-		int __dT;
-		int __dstIdx;
-		int __bitCnt = __intVal(bitCnt);
-
-		__dT = __ByteArrayInstPtr(ditherMatrix)
-			    ->ba_element[__intVal(x) % __dW
-					 + (__intVal(y) % __intVal(dH)) * __dW];
-
-		__byte = __byte << 1;
-		if (__intVal(grey) > __dT) {
-		    __byte = __byte | 1;            /* white */
-		}
-		__bitCnt = __bitCnt - 1;
-		if (__bitCnt == 0) {
-		    __dstIdx = __intVal(dstIndex);
-		    __ByteArrayInstPtr(monoBits)->ba_element[__dstIdx-1] = __byte;
-		    __dstIdx = __dstIdx + 1;
-		    dstIndex = __MKSMALLINT(__dstIdx);
-		    __byte = 0;
-		    __bitCnt = 8;
-		}
-		byte = __MKSMALLINT(__byte);
-		bitCnt = __MKSMALLINT(__bitCnt);
+                int __dW = __intVal(dW);
+                int __byte = __intVal(byte);
+                int __dT;
+                int __dstIdx;
+                int __bitCnt = __intVal(bitCnt);
+
+                __dT = __ByteArrayInstPtr(ditherMatrix)
+                            ->ba_element[__intVal(x) % __dW
+                                         + (__intVal(y) % __intVal(dH)) * __dW];
+
+                __byte = __byte << 1;
+                if (__intVal(grey) > __dT) {
+                    __byte = __byte | 1;            /* white */
+                }
+                __bitCnt = __bitCnt - 1;
+                if (__bitCnt == 0) {
+                    __dstIdx = __intVal(dstIndex);
+                    __ByteArrayInstPtr(monoBits)->ba_element[__dstIdx-1] = __byte;
+                    __dstIdx = __dstIdx + 1;
+                    dstIndex = __MKSMALLINT(__dstIdx);
+                    __byte = 0;
+                    __bitCnt = 8;
+                }
+                byte = __MKSMALLINT(__byte);
+                bitCnt = __MKSMALLINT(__bitCnt);
 %}.
-		0
+                0
 
 "/                dT := ditherMatrix at:(x \\ dW) + (y \\ dH * dW) + 1.
 "/
@@ -9203,13 +9260,13 @@
 "/                    bitCnt := 8.
 "/                ].
 
-	    ].
-	    bitCnt ~~ 8 ifTrue:[
-		byte := byte bitShift:bitCnt.
-		monoBits at:dstIndex put:byte.
-	    ].
-	    dstIndex := nextDst.
-	].
+            ].
+            bitCnt ~~ 8 ifTrue:[
+                byte := byte bitShift:bitCnt.
+                monoBits at:dstIndex put:byte.
+            ].
+            dstIndex := nextDst.
+        ].
     ].
     ^ monoBits
 !
@@ -9234,7 +9291,7 @@
      xE              "{Class: SmallInteger }" |
 
     self depth > 12 ifTrue:[
-	^ self floydSteinbergDitheredMonochromeBits
+        ^ self floydSteinbergDitheredMonochromeBits
     ].
 
     w := width.
@@ -9256,98 +9313,98 @@
     greyValues := self greyMapForRange:(255 * 1024).
 
     0 to:(h-1) do:[:y |
-	nextDst := dstIndex + bytesPerMonoRow.
-	byte := 0.
-	bitCnt := 8.
-
-	t := errorArray.
-	errorArray := errorArray1.
-	errorArray1 := errorArray2.
-	errorArray2 := errorArray3.
-	errorArray3 := t.
-
-	errorArray3 atAllPut:0.
-
-	self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
-	    |eP eD|
-
-	    "/ get the colors grey value [0 .. 1]
-	    grey := greyValues at:(pixel + 1).
-
-	    "/ adjust error
-	    xE := x + 3 + 1.
-	    grey := (grey + (errorArray at:xE)).
-
-	    byte := byte bitShift:1.
-	    grey > (127 * 1024) ifTrue:[
-		byte := byte bitOr:1.      "/ white
-		e := grey - (255 * 1024)
-	    ] ifFalse:[
-		e := grey                  "/ black
-	    ].
-
-	    e ~= 0 ifTrue:[
-		"/ distribute the error:
-		"/                  XX    32
-		"/         12    26    30    16
-		"/            12    26    12
-		"/          5    12    12     5
-
-		eD := e.
-		e := e // 200.
-
-		eP := e * 32. eD := eD - eP.
-		errorArray at:xE+2 put:(errorArray at:xE+2) + eP.
-
-		eP := e * 30. eD := eD - eP.
-		errorArray1 at:xE+1 put:(errorArray1 at:xE+1) + eP.
-
-		eP := e * 16. eD := eD - eP.
-		errorArray1 at:xE+3 put:(errorArray1 at:xE+3) + eP.
-
-		eP := e * 26. eD := eD - eP.
-		errorArray1 at:xE-1 put:(errorArray1 at:xE-1) + eP.
-
-		eD := eD - eP.
-		errorArray2 at:xE put:(errorArray2 at:xE) + eP.
-
-		eP := e * 12. eD := eD - eP.
-		errorArray1 at:xE-3 put:(errorArray1 at:xE-3) + eP.
-
-		eD := eD - eP.
-		errorArray2 at:xE-2 put:(errorArray2 at:xE-2) + eP.
-
-		eD := eD - eP.
-		errorArray2 at:xE+2 put:(errorArray2 at:xE+2) + eP.
-
-		eD := eD - eP.
-		errorArray3 at:xE-1 put:(errorArray3 at:xE-1) + eP.
-
-		eD := eD - eP.
-		errorArray3 at:xE+1 put:(errorArray3 at:xE+1) + eP.
-
-		eP := e * 5. eD := eD - eP.
-		errorArray3 at:xE-3 put:(errorArray3 at:xE-3) + eP.
-
-		eP := eD.
-		errorArray3 at:xE+3 put:(errorArray3 at:xE+3) + eP.
-	    ].
-
-	    bitCnt := bitCnt - 1.
-	    bitCnt == 0 ifTrue:[
-		monoBits at:dstIndex put:byte.
-		dstIndex := dstIndex + 1.
-		byte := 0.
-		bitCnt := 8.
-	    ].
-
-	].
-	bitCnt ~~ 8 ifTrue:[
-	    byte := byte bitShift:bitCnt.
-	    monoBits at:dstIndex put:byte.
-	].
-
-	dstIndex := nextDst.
+        nextDst := dstIndex + bytesPerMonoRow.
+        byte := 0.
+        bitCnt := 8.
+
+        t := errorArray.
+        errorArray := errorArray1.
+        errorArray1 := errorArray2.
+        errorArray2 := errorArray3.
+        errorArray3 := t.
+
+        errorArray3 atAllPut:0.
+
+        self valuesAtY:y from:0 to:(w-1) do:[:x :pixel |
+            |eP eD|
+
+            "/ get the colors grey value [0 .. 1]
+            grey := greyValues at:(pixel + 1).
+
+            "/ adjust error
+            xE := x + 3 + 1.
+            grey := (grey + (errorArray at:xE)).
+
+            byte := byte bitShift:1.
+            grey > (127 * 1024) ifTrue:[
+                byte := byte bitOr:1.      "/ white
+                e := grey - (255 * 1024)
+            ] ifFalse:[
+                e := grey                  "/ black
+            ].
+
+            e ~= 0 ifTrue:[
+                "/ distribute the error:
+                "/                  XX    32
+                "/         12    26    30    16
+                "/            12    26    12
+                "/          5    12    12     5
+
+                eD := e.
+                e := e // 200.
+
+                eP := e * 32. eD := eD - eP.
+                errorArray at:xE+2 put:(errorArray at:xE+2) + eP.
+
+                eP := e * 30. eD := eD - eP.
+                errorArray1 at:xE+1 put:(errorArray1 at:xE+1) + eP.
+
+                eP := e * 16. eD := eD - eP.
+                errorArray1 at:xE+3 put:(errorArray1 at:xE+3) + eP.
+
+                eP := e * 26. eD := eD - eP.
+                errorArray1 at:xE-1 put:(errorArray1 at:xE-1) + eP.
+
+                eD := eD - eP.
+                errorArray2 at:xE put:(errorArray2 at:xE) + eP.
+
+                eP := e * 12. eD := eD - eP.
+                errorArray1 at:xE-3 put:(errorArray1 at:xE-3) + eP.
+
+                eD := eD - eP.
+                errorArray2 at:xE-2 put:(errorArray2 at:xE-2) + eP.
+
+                eD := eD - eP.
+                errorArray2 at:xE+2 put:(errorArray2 at:xE+2) + eP.
+
+                eD := eD - eP.
+                errorArray3 at:xE-1 put:(errorArray3 at:xE-1) + eP.
+
+                eD := eD - eP.
+                errorArray3 at:xE+1 put:(errorArray3 at:xE+1) + eP.
+
+                eP := e * 5. eD := eD - eP.
+                errorArray3 at:xE-3 put:(errorArray3 at:xE-3) + eP.
+
+                eP := eD.
+                errorArray3 at:xE+3 put:(errorArray3 at:xE+3) + eP.
+            ].
+
+            bitCnt := bitCnt - 1.
+            bitCnt == 0 ifTrue:[
+                monoBits at:dstIndex put:byte.
+                dstIndex := dstIndex + 1.
+                byte := 0.
+                bitCnt := 8.
+            ].
+
+        ].
+        bitCnt ~~ 8 ifTrue:[
+            byte := byte bitShift:bitCnt.
+            monoBits at:dstIndex put:byte.
+        ].
+
+        dstIndex := nextDst.
     ].
 
     ^ monoBits
@@ -9388,7 +9445,7 @@
     hI := self height.
 
     tempForm := Form width:wI height:hI depth:1 onDevice:Screen current.
-    tempForm 
+    tempForm
         paint:(Color colorId:1) on:(Color colorId:0);
         clear.
     tempForm displayArcOrigin:origin corner:corner from:startAngle angle:angle.
@@ -9448,7 +9505,7 @@
     hI := aRectangle height.
 
     tempForm := Form width:wI height:hI depth:1 onDevice:Screen current.
-    tempForm 
+    tempForm
         paint:(Color colorId:1) on:(Color colorId:0);
         clear.
     tempForm displayArcIn:(0@0 extent:wI@hI) from:0 angle:360.
@@ -9489,7 +9546,7 @@
 
     pixelValue := aColorOrPixelValue.
     pixelValue isInteger ifFalse:[
-	pixelValue := self valueFromColor:aColorOrPixelValue
+        pixelValue := self valueFromColor:aColorOrPixelValue
     ].
     self drawLineFrom:startPoint to:endPoint withValue:pixelValue
 
@@ -9525,28 +9582,28 @@
 
     steep := (y1 - y0) abs > (x1 - x0) abs.
     steep ifTrue:[
-	t := x0. x0 := y0. y0 := t.
-	t := x1. x1 := y1. y1 := t.
+        t := x0. x0 := y0. y0 := t.
+        t := x1. x1 := y1. y1 := t.
     ].
     x0 > x1 ifTrue:[
-	t := x0. x0 := x1. x1 := t.
-	t := y0. y0 := y1. y1 := t.
+        t := x0. x0 := x1. x1 := t.
+        t := y0. y0 := y1. y1 := t.
     ].
 
     deltax := x1 - x0.
     deltay := (y1 - y0) abs.
 
     deltax == 0 ifTrue:[
-	y0 to: y1 do:[:y |
-	    self atImageAndMask:x0@y putValue:aPixelValueOrNil.
-	].
-	^ self.
+        y0 to: y1 do:[:y |
+            self atImageAndMask:x0@y putValue:aPixelValueOrNil.
+        ].
+        ^ self.
     ].
     deltay == 0 ifTrue:[
-	x0 to: x1 do:[:x |
-	    self atImageAndMask:x@y0 putValue:aPixelValueOrNil.
-	].
-	^ self.
+        x0 to: x1 do:[:x |
+            self atImageAndMask:x@y0 putValue:aPixelValueOrNil.
+        ].
+        ^ self.
     ].
 
     error := 0.
@@ -9555,16 +9612,16 @@
     y0 < y1 ifTrue:[ ystep := 1 ] ifFalse:[ ystep := -1 ].
 
     x0 to: x1 do:[:x |
-	steep ifTrue:[
-	    self atImageAndMask:y@x putValue:aPixelValueOrNil.
-	] ifFalse:[
-	    self atImageAndMask:x@y putValue:aPixelValueOrNil.
-	].
-	error := error + deltaerr.
-	error >= 0.5 ifTrue:[
-	    y := y + ystep.
-	    error := error - 1.
-	]
+        steep ifTrue:[
+            self atImageAndMask:y@x putValue:aPixelValueOrNil.
+        ] ifFalse:[
+            self atImageAndMask:x@y putValue:aPixelValueOrNil.
+        ].
+        error := error + deltaerr.
+        error >= 0.5 ifTrue:[
+            y := y + ystep.
+            error := error - 1.
+        ]
     ].
     self release. "/ device-image is no longer valid
 
@@ -9616,12 +9673,12 @@
     hI := aRectangle height.
 
     xI to:xI+wI-1 do:[:xRun|
-	self atImageAndMask: xRun@yI put:aPixelValueOrNil.
-	self atImageAndMask: xRun@(yI+hI-1) put:aPixelValueOrNil
+        self atImageAndMask: xRun@yI put:aPixelValueOrNil.
+        self atImageAndMask: xRun@(yI+hI-1) put:aPixelValueOrNil
     ].
     yI+1 to:yI+hI-2 do:[:yRun|
-	self atImageAndMask: xI@yRun put:aPixelValueOrNil.
-	self atImageAndMask: xI+wI-1@yRun put:aPixelValueOrNil
+        self atImageAndMask: xI@yRun put:aPixelValueOrNil.
+        self atImageAndMask: xI+wI-1@yRun put:aPixelValueOrNil
     ].
     self release. "/ device-image is no longer valid
 
@@ -9647,7 +9704,7 @@
     hI := self height.
 
     tempForm := Form width:wI height:hI depth:1 onDevice:Screen current.
-    tempForm 
+    tempForm
         paint:(Color colorId:1) on:(Color colorId:0);
         clear.
     tempForm fillArc:origin radius:r from:startAngle angle:angle.
@@ -9704,7 +9761,7 @@
     hI := self height.
 
     tempForm := Form width:wI height:hI depth:1 onDevice:Screen current.
-    tempForm 
+    tempForm
         paint:(Color colorId:1) on:(Color colorId:0);
         clear.
     tempForm fillArc:origin radius:r from:startAngle angle:angle.
@@ -9771,7 +9828,7 @@
     hI := aRectangle height.
 
     tempForm := Form width:wI height:hI depth:1 onDevice:Screen current.
-    tempForm 
+    tempForm
         paint:(Color colorId:1) on:(Color colorId:0);
         clear.
     tempForm fillArcIn:(0@0 extent:wI@hI) from:0 angle:360.
@@ -9804,8 +9861,8 @@
 
 fillRectangle:aRectangle withColor:aColor
     self
-	fillRectangle:aRectangle
-	withValue:(self valueFromColor:aColor)
+        fillRectangle:aRectangle
+        withValue:(self valueFromColor:aColor)
 !
 
 fillRectangle:aRectangle withValue:aPixelValueOrNil
@@ -9815,9 +9872,9 @@
      otherwise to 1. (used by the bitmap editor)"
 
     self
-	fillRectangleX:aRectangle left y:aRectangle top
-	width:aRectangle width height:aRectangle height
-	withValue:aPixelValueOrNil
+        fillRectangleX:aRectangle left y:aRectangle top
+        width:aRectangle width height:aRectangle height
+        withValue:aPixelValueOrNil
 !
 
 fillRectangleX:x y:y width:w height:h with:aColor
@@ -9845,10 +9902,10 @@
     p := Point new.
 
     yI to:yI+hI-1 do:[:yRun |
-	xI to:xI+wI-1 do:[:xRun |
-	    p x:xRun y:yRun.
-	    self atImageAndMask:p putValue:aPixelValueOrNil.
-	]
+        xI to:xI+wI-1 do:[:xRun |
+            p x:xRun y:yRun.
+            self atImageAndMask:p putValue:aPixelValueOrNil.
+        ]
     ].
     self release. "/ device-image is no longer valid
 
@@ -9962,54 +10019,54 @@
     h := self height.
 
     surroundingPixelsOfDo :=
-	[:pX :pY :fn |
-	    |nX nY|
-
-	    nX := pX + 1.
-	    nY := pY + 1.
-	    (nY < h) ifTrue: [fn value:pX value:nY].
-	    (pY > 0) ifTrue: [fn value:pX value:(pY - 1)].
-	    (nX < w) ifTrue: [fn value:nX value:pY].
-	    (pX > 0) ifTrue: [fn value:(pX - 1) value:pY].
-	].
+        [:pX :pY :fn |
+            |nX nY|
+
+            nX := pX + 1.
+            nY := pY + 1.
+            (nY < h) ifTrue: [fn value:pX value:nY].
+            (pY > 0) ifTrue: [fn value:pX value:(pY - 1)].
+            (nX < w) ifTrue: [fn value:nX value:pY].
+            (pX > 0) ifTrue: [fn value:(pX - 1) value:pY].
+        ].
 
     enumerateDetectedPixelsAndDo :=
-	[:detectedPixels :action |
-	    |idx|
-
-	    idx := 1.
-	    0 to:h-1 do:[:y |
-		0 to:w-1 do:[:x |
-		    (detectedPixels at:idx) ifTrue:[
-			action value:x value:y
-		    ].
-		    idx := idx + 1.
-		].
-	    ].
-	].
+        [:detectedPixels :action |
+            |idx|
+
+            idx := 1.
+            0 to:h-1 do:[:y |
+                0 to:w-1 do:[:x |
+                    (detectedPixels at:idx) ifTrue:[
+                        action value:x value:y
+                    ].
+                    idx := idx + 1.
+                ].
+            ].
+        ].
 
     processPixelToFill :=
-	[:spX :spY |
-	    |samePixel sp idx|
-
-	    mask isNil ifTrue:[
-		samePixel := (self pixelAtX:spX y:spY) == detectedPixel
-	    ] ifFalse:[
-		detectedMask == 0 ifTrue:[
-		    samePixel := (mask pixelAtX:spX y:spY) == 0
-		] ifFalse:[
-		    samePixel := ((self pixelAtX:spX y:spY) == detectedPixel)
-				 and:[ (mask pixelAtX:spX y:spY) == detectedMask ]
-		].
-	    ].
-	    samePixel ifTrue: [
-		idx := 1 + spX + (spY * w).
-		(allDetectedPixelCoordinates at:idx) ifFalse:[
-		    allDetectedPixelCoordinates at:idx put:true.
-		    toDo add:spX @ spY.
-		].
-	    ]
-	].
+        [:spX :spY |
+            |samePixel sp idx|
+
+            mask isNil ifTrue:[
+                samePixel := (self pixelAtX:spX y:spY) == detectedPixel
+            ] ifFalse:[
+                detectedMask == 0 ifTrue:[
+                    samePixel := (mask pixelAtX:spX y:spY) == 0
+                ] ifFalse:[
+                    samePixel := ((self pixelAtX:spX y:spY) == detectedPixel)
+                                 and:[ (mask pixelAtX:spX y:spY) == detectedMask ]
+                ].
+            ].
+            samePixel ifTrue: [
+                idx := 1 + spX + (spY * w).
+                (allDetectedPixelCoordinates at:idx) ifFalse:[
+                    allDetectedPixelCoordinates at:idx put:true.
+                    toDo add:spX @ spY.
+                ].
+            ]
+        ].
 
 "/    (mask notNil and: [(mask pixelAt:aPoint) == 0]) ifTrue:[
 "/        allDetectedPixelCoordinates := mask floodFillAt: aPoint withColor: Color white.
@@ -10021,9 +10078,9 @@
 
     detectedPixel := self pixelAt: aPoint.
     mask isNil ifTrue:[
-	detectedMask := 1
+        detectedMask := 1
     ] ifFalse:[
-	detectedMask := mask pixelAt: aPoint.
+        detectedMask := mask pixelAt: aPoint.
     ].
 
     allDetectedPixelCoordinates := BooleanArray new:(w * h).
@@ -10032,28 +10089,28 @@
     toDo add:aPoint.
 
     [toDo notEmpty] whileTrue:[
-	|p|
-
-	p := toDo removeLast.
-	surroundingPixelsOfDo value:p x value:p y value:processPixelToFill.
+        |p|
+
+        p := toDo removeLast.
+        surroundingPixelsOfDo value:p x value:p y value:processPixelToFill.
     ].
 
     aPixelValueOrNil isNil ifTrue:[
-	drawAction := [:x :y |
-			       mask pixelAtX:x y:y put:0.
-			       self pixelAtX:x y:y put:0.
-		      ].
+        drawAction := [:x :y |
+                               mask pixelAtX:x y:y put:0.
+                               self pixelAtX:x y:y put:0.
+                      ].
     ] ifFalse:[
-	drawAction := [:x :y |
-				mask notNil ifTrue:[
-				    mask pixelAtX:x y:y put:1.
-				].
-				self pixelAtX:x y:y put:aPixelValueOrNil].
+        drawAction := [:x :y |
+                                mask notNil ifTrue:[
+                                    mask pixelAtX:x y:y put:1.
+                                ].
+                                self pixelAtX:x y:y put:aPixelValueOrNil].
     ].
 
     enumerateDetectedPixelsAndDo
-	value:allDetectedPixelCoordinates
-	value:drawAction.
+        value:allDetectedPixelCoordinates
+        value:drawAction.
 
     self release. "/ device-image is no longer valid
     ^ allDetectedPixelCoordinates
@@ -10104,7 +10161,7 @@
     yStart := y1.
     yEnd := y2.
     yStart to:yEnd do:[:yRun |
-	aBlock value:yRun value:(self colorAtX:x y:yRun)
+        aBlock value:yRun value:(self colorAtX:x y:yRun)
     ]
 !
 
@@ -10122,7 +10179,7 @@
     xStart := x1.
     xEnd := x2.
     xStart to:xEnd do:[:xRun |
-	aBlock value:xRun value:(self colorAtX:xRun y:y)
+        aBlock value:xRun value:(self colorAtX:xRun y:y)
     ]
 
     "Created: / 7.6.1996 / 19:12:51 / cg"
@@ -10131,7 +10188,7 @@
 
 colorsFromX:xStart y:yStart toX:xEnd y:yEnd do:aBlock
     "perform aBlock for each color in a rectangular area of the image.
-     Notice, that x and y coordinates start at 0@0 for the upper left corner.
+     Notice that x and y coordinates start at 0@0 for the upper left corner.
      The block is passed the x and y coordinates and pixelValue at each pixel.
      The code here provides a generic and slow implementation, and
      should be redefined in concrete subclasses, to avoid some processing
@@ -10146,10 +10203,10 @@
     yE := yEnd.
 
     yS to:yE do:[:yRun |
-	yR := yRun.
-	self colorsAtY:yRun from:xStart to:xEnd do:[:xRun :color |
-	    aBlock value:xRun value:yR value:color
-	]
+        yR := yRun.
+        self colorsAtY:yRun from:xStart to:xEnd do:[:xRun :color |
+            aBlock value:xRun value:yR value:color
+        ]
     ]
 
     "Modified: 11.7.1996 / 19:50:47 / cg"
@@ -10174,7 +10231,7 @@
      Use #pixelAtT:from:to:do: - for future compatibility.
 
      perform aBlock for each pixelValue from x1 to x2 in row y.
-     Notice, that x and y coordinates start at 0@0 for the upper left corner.
+     Notice that x and y coordinates start at 0@0 for the upper left corner.
      The block is passed the x coordinate and the pixelValue at each pixel.
      (see also Image>>atY:from:to:do:).
      The code here provides a generic and slow implementation, and
@@ -10187,7 +10244,7 @@
     xStart := x1.
     xEnd := x2.
     xStart to:xEnd do:[:xRun |
-	aBlock value:xRun value:(self pixelAtX:xRun y:y)
+        aBlock value:xRun value:(self pixelAtX:xRun y:y)
     ]
 
     "Created: 7.6.1996 / 19:09:51 / cg"
@@ -10196,7 +10253,7 @@
 
 valuesFromX:xStart y:yStart toX:xEnd y:yEnd do:aBlock
     "perform aBlock for each pixelValue in a rectangular area of the image.
-     Notice, that x and y coordinates start at 0@0 for the upper left corner.
+     Notice that x and y coordinates start at 0@0 for the upper left corner.
      The block is passed the x and y coordinates and pixelValue at each pixel.
      The code here provides a generic and slow implementation, and
      should be redefined in concrete subclasses, to avoid some processing
@@ -10208,9 +10265,9 @@
     xS := xStart.
     xE := xEnd.
     yStart to:yEnd do:[:yRun |
-	self valuesAtY:yRun from:xStart to:xEnd do:[:xRun :pixel |
-	    aBlock value:xRun value:yRun value:pixel
-	]
+        self valuesAtY:yRun from:xStart to:xEnd do:[:xRun :pixel |
+            aBlock value:xRun value:yRun value:pixel
+        ]
     ]
 
     "Modified: 7.6.1996 / 19:09:29 / cg"
@@ -10257,38 +10314,38 @@
     pixelRow := self pixelArraySpecies new:width.
 
     (x0 = 0 and:[w = self width]) ifTrue:[
-	"/ slightly faster
-	y := y0.
-	h timesRepeat:[
-	    self rowAt:y into:pixelRow.
-	    1 to:w do:[:runCol |
-		newPixel := pixelFunctionBlock
-				value:self
-				value:(pixelRow at:runCol)
-				value:(runCol-1)
-				value:y.
-		newPixelRow at:runCol put:newPixel.
-	    ].
-	    newImage rowAt:y putAll:newPixelRow.
-	    y := y + 1.
-	].
-	^ self.
+        "/ slightly faster
+        y := y0.
+        h timesRepeat:[
+            self rowAt:y into:pixelRow.
+            1 to:w do:[:runCol |
+                newPixel := pixelFunctionBlock
+                                value:self
+                                value:(pixelRow at:runCol)
+                                value:(runCol-1)
+                                value:y.
+                newPixelRow at:runCol put:newPixel.
+            ].
+            newImage rowAt:y putAll:newPixelRow.
+            y := y + 1.
+        ].
+        ^ self.
     ].
 
     y := y0.
     h timesRepeat:[
-	self rowAt:y into:pixelRow.
-	1 to:w do:[:runCol |
-	    newPixel := pixelFunctionBlock
-			    value:self
-			    value:(pixelRow at:runCol+x0)
-			    value:(runCol+x0-1)
-			    value:y.
-	    newPixelRow at:runCol put:newPixel.
-	].
-	pixelRow replaceFrom:x0+1 to:x0+1+w-1 with:newPixelRow startingAt:1.
-	newImage rowAt:y putAll:pixelRow.
-	y := y + 1.
+        self rowAt:y into:pixelRow.
+        1 to:w do:[:runCol |
+            newPixel := pixelFunctionBlock
+                            value:self
+                            value:(pixelRow at:runCol+x0)
+                            value:(runCol+x0-1)
+                            value:y.
+            newPixelRow at:runCol put:newPixel.
+        ].
+        pixelRow replaceFrom:x0+1 to:x0+1+w-1 with:newPixelRow startingAt:1.
+        newImage rowAt:y putAll:pixelRow.
+        y := y + 1.
     ].
 
     "Modified: 24.4.1997 / 16:18:31 / cg"
@@ -10299,9 +10356,9 @@
      enumerate pixelValues and evaluate the block for each."
 
     ^ self
-	applyPixelValuesTo:pixelFunctionBlock
-	in:(0@0 corner:width@height)
-	into:newImage
+        applyPixelValuesTo:pixelFunctionBlock
+        in:(0@0 corner:width@height)
+        into:newImage
 !
 
 blendWith:aColor
@@ -10311,7 +10368,7 @@
      CAVEAT: Need an argument, which specifies by how much it should be lighter."
 
      ^ self
-	copyWithColorMapProcessing:[:clr | clr blendWith:aColor]
+        copyWithColorMapProcessing:[:clr | clr blendWith:aColor]
 
     "
      (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') inspect
@@ -10333,20 +10390,20 @@
     |nColors "{ Class: SmallInteger }"|
 
     colorMap isNil ifTrue:[
-	self colorsFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :clr |
-	    self colorAtX:x y:y put:(aBlock value:clr)
-	].
-	^ self
+        self colorsFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :clr |
+            self colorAtX:x y:y put:(aBlock value:clr)
+        ].
+        ^ self
     ].
 
     nColors := colorMap size.
     1 to:nColors do:[:index |
-	|clr|
-
-	clr := colorMap at:index.
-	clr notNil ifTrue:[
-	    colorMap at:index put:(aBlock value:clr)
-	]
+        |clr|
+
+        clr := colorMap at:index.
+        clr notNil ifTrue:[
+            colorMap at:index put:(aBlock value:clr)
+        ]
     ]
 
     "Modified: 23.4.1996 / 11:13:55 / cg"
@@ -10363,7 +10420,7 @@
     |newImage|
 
     self colorMap isNil ifTrue:[
-	^ self withPixelFunctionApplied:[:orig :clr :x :y | aBlock  value:clr]
+        ^ self withPixelFunctionApplied:[:orig :clr :x :y | aBlock  value:clr]
 "/        self error:'no colormap in image'.
 "/        ^ nil
     ].
@@ -10380,7 +10437,7 @@
      leave red component only:
 
      (Image fromFile:'goodies/bitmaps/gifImages/claus.gif')
-	copyWithColorMapProcessing:[:clr | Color red:(clr red) green:0 blue:0]
+        copyWithColorMapProcessing:[:clr | Color red:(clr red) green:0 blue:0]
     "
 
     "
@@ -10398,32 +10455,32 @@
      make it reddish:
 
      (Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif')
-	copyWithColorMapProcessing:[:clr | Color red:((clr red * 2) min:100) green:clr green blue:clr blue]
+        copyWithColorMapProcessing:[:clr | Color red:((clr red * 2) min:100) green:clr green blue:clr blue]
     "
 
     "
      invert:
 
      (Image fromFile:'bitmaps/gifImages/claus.gif')
-	copyWithColorMapProcessing:[:clr | Color red:(100 - clr red) green:(100 - clr green) blue:(100 - clr green)]
+        copyWithColorMapProcessing:[:clr | Color red:(100 - clr red) green:(100 - clr green) blue:(100 - clr green)]
     "
 
     "
      lighter:
 
      (Image fromFile:'bitmaps/gifImages/claus.gif')
-	copyWithColorMapProcessing:[:clr | |r g b|
-						r := clr red.  g := clr green.  b := clr blue.
-						Color red:(r + (100-r//2))
-						      green:(g + (100-g//2))
-						      blue:(b + (100-b//2))]
+        copyWithColorMapProcessing:[:clr | |r g b|
+                                                r := clr red.  g := clr green.  b := clr blue.
+                                                Color red:(r + (100-r//2))
+                                                      green:(g + (100-g//2))
+                                                      blue:(b + (100-b//2))]
     "
 
     "
      darker:
 
      (Image fromFile:'bitmaps/gifImages/claus.gif')
-	copyWithColorMapProcessing:[:clr | Color red:(clr red//2) green:(clr green // 2) blue:(clr blue // 2)]
+        copyWithColorMapProcessing:[:clr | Color red:(clr red//2) green:(clr green // 2) blue:(clr blue // 2)]
     "
 
     "Modified: 24.4.1997 / 18:28:05 / cg"
@@ -10463,44 +10520,50 @@
      can be redefined in subclasses for more performance"
 
     |w  "{Class: SmallInteger }"
-     h  "{Class: SmallInteger }"
-     c2 r2 pixelArray|
+     h  "{Class: SmallInteger }" 
+     pixelMover|
 
     w := width - 1.
     h := height - 1.
 
-    pixelArray := self pixelArraySpecies new:width.
-
     degrees = 90 ifTrue:[
-	0 to:h do:[:row |
-	    self rowAt:row into:pixelArray startingAt:1.
-	    c2 := h-row.
-	    0 to:w do:[:col |
-		destinationImage pixelAtX:c2 y:col put:(pixelArray at:(col+1)).
-	    ]
-	].
-	^ self.
-    ].
-
-    degrees = 180 ifTrue:[
-	0 to:h do:[:row |
-	    self rowAt:row into:pixelArray startingAt:1.
-	    r2 := h - row.
-	    0 to:w do:[:col |
-		destinationImage pixelAtX:(w-col) y:r2 put:(pixelArray at:(col+1)).
-	    ]
-	].
-	^ self
-    ].
-
-    "/ degrees = 270
-    0 to:h do:[:row |
-	self rowAt:row into:pixelArray startingAt:1.
-	0 to:w do:[:col |
-	    destinationImage pixelAtX:row y:(w-col) put:(pixelArray at:(col+1)).
-	]
-    ]
-
+        pixelMover := [:col :row :pixel | destinationImage pixelAtX:(h-row) y:col put:pixel].    
+    ] ifFalse:[
+        degrees = 180 ifTrue:[
+            pixelMover := [:col :row :pixel | destinationImage pixelAtX:(w-col) y:(h-row) put:pixel].    
+        ] ifFalse:[
+            degrees = 270 ifTrue:[
+                pixelMover := [:col :row :pixel | destinationImage pixelAtX:row y:(w-col) put:pixel].    
+            ] ifFalse:[
+                ^ self
+            ].
+        ].
+    ].    
+    self valuesFromX:0 y:0 toX:w y:h do:pixelMover.
+    ^ self.
+
+    "
+     |i|
+
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     i inspect.
+     (i rotated:45) inspect.
+     (i rotated:90) inspect.
+     (i rotated:180) inspect.
+     (i rotated:270) inspect.
+    "
+    "
+     |i|
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     i := Depth24Image fromImage:i.
+     Time millisecondsToRun:[ 100 timesRepeat:[ i rotated:90 ] ]
+    "
+    "
+     |i|
+     i := Image fromScreen.
+     Time millisecondsToRun:[ 20 timesRepeat:[ i rotated:90 ] ]
+    "
+    
     "Created: 23.4.1997 / 14:36:45 / cg"
     "Modified: 24.4.1997 / 17:26:26 / cg"
 !
@@ -10516,13 +10579,13 @@
     pixelArray := self pixelArraySpecies new:width.
 
     0 to:h do:[:row |
-	self rowAt:row into:pixelArray.
-	pixelArray reverse.
-	self rowAt:row putAll:pixelArray.
+        self rowAt:row into:pixelArray.
+        pixelArray reverse.
+        self rowAt:row putAll:pixelArray.
     ].
 
     mask notNil ifTrue:[
-	mask flipHorizontal
+        mask flipHorizontal
     ].
 
     "/ flush device info
@@ -10555,14 +10618,14 @@
     indexHi := bytesPerRow * h + 1.
 
     0 to:(h // 2) do:[:row |
-	buffer replaceFrom:1 to:bytesPerRow with:bytes startingAt:indexLow.
-	bytes replaceFrom:indexLow to:(indexLow + bytesPerRow - 1) with:bytes startingAt:indexHi.
-	bytes replaceFrom:indexHi to:(indexHi + bytesPerRow - 1) with:buffer startingAt:1.
-	indexLow := indexLow + bytesPerRow.
-	indexHi := indexHi - bytesPerRow.
+        buffer replaceFrom:1 to:bytesPerRow with:bytes startingAt:indexLow.
+        bytes replaceFrom:indexLow to:(indexLow + bytesPerRow - 1) with:bytes startingAt:indexHi.
+        bytes replaceFrom:indexHi to:(indexHi + bytesPerRow - 1) with:buffer startingAt:1.
+        indexLow := indexLow + bytesPerRow.
+        indexHi := indexHi - bytesPerRow.
     ].
     mask notNil ifTrue:[
-	mask flipVertical
+        mask flipVertical
     ].
     "flush device info"
     self release
@@ -10580,7 +10643,7 @@
      It is definitely slower than the non antiAliasing/integral magnification methods."
 
     ^ (Depth24Image fromImage:self)
-	hardAntiAliasedMagnifiedBy:scalePoint
+        hardAntiAliasedMagnifiedBy:scalePoint
 
     "Modified: 2.6.1997 / 13:19:57 / cg"
     "Created: 2.6.1997 / 15:53:34 / cg"
@@ -10614,19 +10677,19 @@
     newBits := ByteArray uninitializedNew:(newBytesPerRow * newHeight).
 
     mask notNil ifTrue:[
-	newMask := (mask magnifiedBy:scalePoint)
+        newMask := (mask magnifiedBy:scalePoint)
     ].
 
     newImage := self species new.
     newImage
-	width:newWidth
-	height:newHeight
-	photometric:photometric
-	samplesPerPixel:samplesPerPixel
-	bitsPerSample:bitsPerSample
-	colorMap:colorMap copy
-	bits:newBits
-	mask:newMask.
+        width:newWidth
+        height:newHeight
+        photometric:photometric
+        samplesPerPixel:samplesPerPixel
+        bitsPerSample:bitsPerSample
+        colorMap:colorMap copy
+        bits:newBits
+        mask:newMask.
 
     "walk over destination image fetching pixels from source image"
 
@@ -10635,12 +10698,12 @@
     pixelArray := newImage pixelArraySpecies new:newWidth.
 
     0 to:h do:[:row |
-	srcRow := (row // mY).
-	0 to:w do:[:col |
-	    value := self pixelAtX:(col // mX) y:srcRow.
-	    pixelArray at:(col+1) put:value.
-	].
-	newImage rowAt:row putAll:pixelArray.
+        srcRow := (row // mY).
+        0 to:w do:[:col |
+            value := self pixelAtX:(col // mX) y:srcRow.
+            pixelArray at:(col+1) put:value.
+        ].
+        newImage rowAt:row putAll:pixelArray.
     ].
 
     ^ newImage
@@ -10649,7 +10712,7 @@
      |i|
      i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
      Time millisecondsToRun:[
-	 i := i hardMagnifiedBy:0.5@0.5
+         i := i hardMagnifiedBy:0.5@0.5
      ].
      i
     "
@@ -10697,36 +10760,36 @@
 
     maxX := minX := p1 x.
     (t := p2 x) > maxX ifTrue:[
-	maxX := t
+        maxX := t
     ] ifFalse:[
-	t < minX ifTrue:[minX := t].
+        t < minX ifTrue:[minX := t].
     ].
     (t := p3 x) > maxX ifTrue:[
-	maxX := t
+        maxX := t
     ] ifFalse:[
-	t < minX ifTrue:[minX := t].
+        t < minX ifTrue:[minX := t].
     ].
     (t := p4 x) > maxX ifTrue:[
-	maxX := t
+        maxX := t
     ] ifFalse:[
-	t < minX ifTrue:[minX := t].
+        t < minX ifTrue:[minX := t].
     ].
 
     maxY := minY := p1 y.
     (t := p2 y) > maxY ifTrue:[
-	maxY := t
+        maxY := t
     ] ifFalse:[
-	t < minY ifTrue:[minY := t].
+        t < minY ifTrue:[minY := t].
     ].
     (t := p3 y) > maxY ifTrue:[
-	maxY := t
+        maxY := t
     ] ifFalse:[
-	t < minY ifTrue:[minY := t].
+        t < minY ifTrue:[minY := t].
     ].
     (t := p4 y) > maxY ifTrue:[
-	maxY := t
+        maxY := t
     ] ifFalse:[
-	t < minY ifTrue:[minY := t].
+        t < minY ifTrue:[minY := t].
     ].
 
 
@@ -10745,36 +10808,36 @@
     newImage colorMap:colorMap copy.
     newImage maskedPixelsAre0:maskedPixelsAre0.
     mask notNil ifTrue:[
-	newImage mask:(mask rotated:degrees)
+        newImage mask:(mask rotated:degrees)
     ] ifFalse:[
-	self isMask ifFalse:[
-	    self depth ~~ 1 ifTrue:[
-		m := ImageMask width:width height:height.
-		m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
-		maskBits atAllPut:16rFF.
-		newImage mask:(m rotated:degrees)
-	    ]
-	]
+        self isMask ifFalse:[
+            self depth ~~ 1 ifTrue:[
+                m := ImageMask width:width height:height.
+                m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
+                maskBits atAllPut:16rFF.
+                newImage mask:(m rotated:degrees)
+            ]
+        ]
     ].
 
     myDepth := self depth.
     myDepth == 1 ifTrue:[
-	blackPixel := 0.
+        blackPixel := 0.
     ] ifFalse:[
-	maskedPixelsAre0 ifTrue:[
-	    blackPixel := 0.
-	] ifFalse:[
-	    blackPixel := self valueFromColor:Color black.
-	    blackPixel isNil ifTrue:[
-		blackPixel := self valueFromColor:Color white.
-		blackPixel isNil ifTrue:[
-		    blackPixel := 0.
-		]
-	    ]
-	].
-	self isMask ifTrue:[
-	    blackPixel := 0.
-	].
+        maskedPixelsAre0 ifTrue:[
+            blackPixel := 0.
+        ] ifFalse:[
+            blackPixel := self valueFromColor:Color black.
+            blackPixel isNil ifTrue:[
+                blackPixel := self valueFromColor:Color white.
+                blackPixel isNil ifTrue:[
+                    blackPixel := 0.
+                ]
+            ]
+        ].
+        self isMask ifTrue:[
+            blackPixel := 0.
+        ].
     ].
 
     newBits atAllPut:0.
@@ -10817,583 +10880,583 @@
      && __isFloat(halfH)
      && __isByteArray(newBits)
      && __isByteArrayLike(__INST(bytes))) {
-	__srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-	__dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
-	__nSrcBytes = __byteArraySize(__INST(bytes));
-	__nDstBytes = __byteArraySize(newBits);
-	__blackPixel = __intVal(blackPixel);
-
-	__radians = __floatVal(radians);
-	__radians = -__radians; /* sigh: clock-wise */
-	__sin = sin(__radians);
-	__cos = cos(__radians);
-	__minX = __floatVal(minX);
-	__minY = __floatVal(minY);
-	__halfW = __floatVal(halfW);
-	__halfH = __floatVal(halfH);
-
-	__dstRowPtr = __dstBytes;
-	__dstEndPtr = __dstBytes + __nDstBytes;
+        __srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+        __dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
+        __nSrcBytes = __byteArraySize(__INST(bytes));
+        __nDstBytes = __byteArraySize(newBits);
+        __blackPixel = __intVal(blackPixel);
+
+        __radians = __floatVal(radians);
+        __radians = -__radians; /* sigh: clock-wise */
+        __sin = sin(__radians);
+        __cos = cos(__radians);
+        __minX = __floatVal(minX);
+        __minY = __floatVal(minY);
+        __halfW = __floatVal(halfW);
+        __halfH = __floatVal(halfH);
+
+        __dstRowPtr = __dstBytes;
+        __dstEndPtr = __dstBytes + __nDstBytes;
 
 #       define EARLY_OUT
 #       define FAST_ADVANCE 5
 #       define FAST_ADVANCE2
 
-	switch (__depth) {
-	    case 8:
-		for (__dstY = 0; __dstY < __newHeight; __dstY++) {
-		    double __pY, __sinPY, __cosPY;
+        switch (__depth) {
+            case 8:
+                for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+                    double __pY, __sinPY, __cosPY;
 #ifdef EARLY_OUT
-		    int didFetchInRow = 0;
+                    int didFetchInRow = 0;
 #endif
-		    __pY = (double)(__dstY + __minY);
-
-		    __sinPY = __sin * __pY;
-		    __cosPY = __cos * __pY;
-
-		    __dstPtr = __dstRowPtr;
-		    __dstRowPtr += __dstBytesPerRow;
-
-		    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
-			double __pX, __nX;
-			unsigned __pix;
-
-			/* translate X in destination (center to 0/0) */
-			__pX = (double)(__dstX + __minX);
-			/* rotate X */
-			__nX = (__cos * __pX) - __sinPY;
-
-			/* translate X in source (origin to 0/0) */
-			__nX = __nX + __halfW + 0.5;
-
-			/* inside ? */
-			if (__nX < 0) {
+                    __pY = (double)(__dstY + __minY);
+
+                    __sinPY = __sin * __pY;
+                    __cosPY = __cos * __pY;
+
+                    __dstPtr = __dstRowPtr;
+                    __dstRowPtr += __dstBytesPerRow;
+
+                    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+                        double __pX, __nX;
+                        unsigned __pix;
+
+                        /* translate X in destination (center to 0/0) */
+                        __pX = (double)(__dstX + __minX);
+                        /* rotate X */
+                        __nX = (__cos * __pX) - __sinPY;
+
+                        /* translate X in source (origin to 0/0) */
+                        __nX = __nX + __halfW + 0.5;
+
+                        /* inside ? */
+                        if (__nX < 0) {
 #ifdef EARLY_OUT
-			    if (didFetchInRow) {
-				break;
-			    }
+                            if (didFetchInRow) {
+                                break;
+                            }
 #endif
 #ifdef FAST_ADVANCE
-			    if (__blackPixel == 0) {
-				do {
-				    /* try advance by FAST_ADVANCE pixels ... */
-				    __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
-				    if (__dstX >= __newWidth) {
-					break;
-				    }
-				    __pX = (double)(__dstX + __minX);
-				    __nX = (__cos * __pX) - __sinPY;
-				    __nX = __nX + __halfW + 0.5;
-				} while (__nX < 0);
-				__dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
-			    }
+                            if (__blackPixel == 0) {
+                                do {
+                                    /* try advance by FAST_ADVANCE pixels ... */
+                                    __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+                                    if (__dstX >= __newWidth) {
+                                        break;
+                                    }
+                                    __pX = (double)(__dstX + __minX);
+                                    __nX = (__cos * __pX) - __sinPY;
+                                    __nX = __nX + __halfW + 0.5;
+                                } while (__nX < 0);
+                                __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+                            }
 #endif
-			    __pix = __blackPixel;
-			} else {
-			    int __srcX;
-
-			    __srcX = (int)__nX;
-			    /* inside ? */
-			    if (__srcX >= __width) {
+                            __pix = __blackPixel;
+                        } else {
+                            int __srcX;
+
+                            __srcX = (int)__nX;
+                            /* inside ? */
+                            if (__srcX >= __width) {
 #ifdef EARLY_OUT
-				if (didFetchInRow) {
-				    break;
-				}
+                                if (didFetchInRow) {
+                                    break;
+                                }
 #endif
 #ifdef FAST_ADVANCE2
-				if (__blackPixel == 0) {
-				    do {
-					/* try advance by FAST_ADVANCE pixels ... */
-					__dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
-					if (__dstX >= __newWidth) {
-					    break;
-					}
-					__pX = (double)(__dstX + __minX);
-					__nX = (__cos * __pX) - __sinPY;
-					__nX = __nX + __halfW + 0.5;
-					__srcX = (int)__nX;
-				    } while (__srcX >= __width);
-				    __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
-				}
+                                if (__blackPixel == 0) {
+                                    do {
+                                        /* try advance by FAST_ADVANCE pixels ... */
+                                        __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+                                        if (__dstX >= __newWidth) {
+                                            break;
+                                        }
+                                        __pX = (double)(__dstX + __minX);
+                                        __nX = (__cos * __pX) - __sinPY;
+                                        __nX = __nX + __halfW + 0.5;
+                                        __srcX = (int)__nX;
+                                    } while (__srcX >= __width);
+                                    __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+                                }
 #endif
-				__pix = __blackPixel;
-			    } else {
-				double __nY;
-
-				/* rotate Y */
-				__nY = (__sin * __pX) + __cosPY;
-				/* translate Y in source (origin to 0/0) */
-				__nY = __nY + __halfH + 0.5;
-
-				/* inside ? */
-				if (__nY < 0) {
+                                __pix = __blackPixel;
+                            } else {
+                                double __nY;
+
+                                /* rotate Y */
+                                __nY = (__sin * __pX) + __cosPY;
+                                /* translate Y in source (origin to 0/0) */
+                                __nY = __nY + __halfH + 0.5;
+
+                                /* inside ? */
+                                if (__nY < 0) {
 #ifdef EARLY_OUT
-				    if (didFetchInRow) {
-					break;
-				    }
+                                    if (didFetchInRow) {
+                                        break;
+                                    }
 #endif
 #ifdef FAST_ADVANCE2
-				    if (__blackPixel == 0) {
-					do {
-					    /* try advance by FAST_ADVANCE pixels ... */
-					    __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
-					    if (__dstX >= __newWidth) {
-						break;
-					    }
-					    __pX = (double)(__dstX + __minX);
-					    __nY = (__sin * __pX) + __cosPY;
-					    __nY = __nY + __halfH + 0.5;
-					} while (__nY < 0);
-					__dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
-				    }
+                                    if (__blackPixel == 0) {
+                                        do {
+                                            /* try advance by FAST_ADVANCE pixels ... */
+                                            __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+                                            if (__dstX >= __newWidth) {
+                                                break;
+                                            }
+                                            __pX = (double)(__dstX + __minX);
+                                            __nY = (__sin * __pX) + __cosPY;
+                                            __nY = __nY + __halfH + 0.5;
+                                        } while (__nY < 0);
+                                        __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+                                    }
 #endif
-				    __pix = __blackPixel;
-				} else {
-				    int __srcY;
-
-				    __srcY = (int)__nY;
-				    /* inside ? */
-				    if (__srcY >= __height) {
+                                    __pix = __blackPixel;
+                                } else {
+                                    int __srcY;
+
+                                    __srcY = (int)__nY;
+                                    /* inside ? */
+                                    if (__srcY >= __height) {
 #ifdef EARLY_OUT
-					if (didFetchInRow) {
-					    break;
-					}
+                                        if (didFetchInRow) {
+                                            break;
+                                        }
 #endif
 #ifdef FAST_ADVANCE
-					if (__blackPixel == 0) {
-					    do {
-						/* try advance by FAST_ADVANCE pixels ... */
-						__dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
-						if (__dstX >= __newWidth) {
-						    break;
-						}
-						__pX = (double)(__dstX + __minX);
-						__nY = (__sin * __pX) + __cosPY;
-						__nY = __nY + __halfH + 0.5;
-						__srcY = (int)__nY;
-					    } while (__srcY >= __height);
-					    __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
-					}
+                                        if (__blackPixel == 0) {
+                                            do {
+                                                /* try advance by FAST_ADVANCE pixels ... */
+                                                __dstX += FAST_ADVANCE; __dstPtr += FAST_ADVANCE;
+                                                if (__dstX >= __newWidth) {
+                                                    break;
+                                                }
+                                                __pX = (double)(__dstX + __minX);
+                                                __nY = (__sin * __pX) + __cosPY;
+                                                __nY = __nY + __halfH + 0.5;
+                                                __srcY = (int)__nY;
+                                            } while (__srcY >= __height);
+                                            __dstX -= FAST_ADVANCE; __dstPtr -= FAST_ADVANCE;
+                                        }
 #endif
-					__pix = __blackPixel;
-				    } else {
-					/* fetch source pixel */
-
-					int idx;
+                                        __pix = __blackPixel;
+                                    } else {
+                                        /* fetch source pixel */
+
+                                        int idx;
 #ifdef EARLY_OUT
-					didFetchInRow = 1;
+                                        didFetchInRow = 1;
 #endif
-					idx = __srcY * __srcBytesPerRow + __srcX;
-					if ((unsigned)idx < __nSrcBytes) {
-					    __pix = __srcBytes[idx];
-					} else {
-					    __pix = __blackPixel;
-					}
-				    }
-				}
-			    }
-			}
-
-			if (__pix != 0) {
-			    *__dstPtr = __pix;
-			}
-			__dstPtr++;
-		    }
-		}
-		break;
-
-	    case 1:
-		for (__dstY = 0; __dstY < __newHeight; __dstY++) {
-		    double __pY, __sinPY, __cosPY;
+                                        idx = __srcY * __srcBytesPerRow + __srcX;
+                                        if ((unsigned)idx < __nSrcBytes) {
+                                            __pix = __srcBytes[idx];
+                                        } else {
+                                            __pix = __blackPixel;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        if (__pix != 0) {
+                            *__dstPtr = __pix;
+                        }
+                        __dstPtr++;
+                    }
+                }
+                break;
+
+            case 1:
+                for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+                    double __pY, __sinPY, __cosPY;
 #ifdef EARLY_OUT
-		    int didFetchInRow = 0;
+                    int didFetchInRow = 0;
 #endif
-		    __pY = (double)(__dstY + __minY);
-
-		    __sinPY = __sin * __pY;
-		    __cosPY = __cos * __pY;
-
-		    __dstPtr = __dstRowPtr;
-		    __dstMask = 0x80;
-		    __dstRowPtr += __dstBytesPerRow;
-
-		    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
-			double __pX, __nX;
-			int __pix;
-
-			/* translate X in destination (center to 0/0) */
-			__pX = (double)(__dstX + __minX);
-			/* rotate X */
-			__nX = (__cos * __pX) - __sinPY;
-
-			/* translate X in source (origin to 0/0) */
-			__nX = __nX + __halfW + 0.5;
-
-			/* inside ? */
-			if (__nX < 0) {
+                    __pY = (double)(__dstY + __minY);
+
+                    __sinPY = __sin * __pY;
+                    __cosPY = __cos * __pY;
+
+                    __dstPtr = __dstRowPtr;
+                    __dstMask = 0x80;
+                    __dstRowPtr += __dstBytesPerRow;
+
+                    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+                        double __pX, __nX;
+                        int __pix;
+
+                        /* translate X in destination (center to 0/0) */
+                        __pX = (double)(__dstX + __minX);
+                        /* rotate X */
+                        __nX = (__cos * __pX) - __sinPY;
+
+                        /* translate X in source (origin to 0/0) */
+                        __nX = __nX + __halfW + 0.5;
+
+                        /* inside ? */
+                        if (__nX < 0) {
 #ifdef EARLY_OUT
-			    if (didFetchInRow) {
-				break;
-			    }
+                            if (didFetchInRow) {
+                                break;
+                            }
 #endif
 #ifdef FAST_ADVANCE
-			    if (__blackPixel == 0) {
-				do {
-				    /* try advance by 8 pixels ... */
-				    __dstX += 8; __dstPtr ++;
-				    if (__dstX >= __newWidth) {
-					break;
-				    }
-				    __pX = (double)(__dstX + __minX);
-				    __nX = (__cos * __pX) - __sinPY;
-				    __nX = __nX + __halfW + 0.5;
-				} while (__nX < 0);
-				__dstX -= 8; __dstPtr--;
-			    }
+                            if (__blackPixel == 0) {
+                                do {
+                                    /* try advance by 8 pixels ... */
+                                    __dstX += 8; __dstPtr ++;
+                                    if (__dstX >= __newWidth) {
+                                        break;
+                                    }
+                                    __pX = (double)(__dstX + __minX);
+                                    __nX = (__cos * __pX) - __sinPY;
+                                    __nX = __nX + __halfW + 0.5;
+                                } while (__nX < 0);
+                                __dstX -= 8; __dstPtr--;
+                            }
 #endif
-			    __pix = __blackPixel;
-			} else {
-			    int __srcX;
-
-			    __srcX = (int)__nX;
-			    /* inside ? */
-			    if (__srcX >= __width) {
+                            __pix = __blackPixel;
+                        } else {
+                            int __srcX;
+
+                            __srcX = (int)__nX;
+                            /* inside ? */
+                            if (__srcX >= __width) {
 #ifdef EARLY_OUT
-				if (didFetchInRow) {
-				    break;
-				}
+                                if (didFetchInRow) {
+                                    break;
+                                }
 #endif
 #ifdef FAST_ADVANCE2
-				if (__blackPixel == 0) {
-				    do {
-					/* try advance by 8 pixels ... */
-					__dstX += 8; __dstPtr++;
-					if (__dstX >= __newWidth) {
-					    break;
-					}
-					__pX = (double)(__dstX + __minX);
-					__nX = (__cos * __pX) - __sinPY;
-					__nX = __nX + __halfW + 0.5;
-					__srcX = (int)__nX;
-				    } while (__srcX >= __width);
-				    __dstX -= 8; __dstPtr--;
-				}
+                                if (__blackPixel == 0) {
+                                    do {
+                                        /* try advance by 8 pixels ... */
+                                        __dstX += 8; __dstPtr++;
+                                        if (__dstX >= __newWidth) {
+                                            break;
+                                        }
+                                        __pX = (double)(__dstX + __minX);
+                                        __nX = (__cos * __pX) - __sinPY;
+                                        __nX = __nX + __halfW + 0.5;
+                                        __srcX = (int)__nX;
+                                    } while (__srcX >= __width);
+                                    __dstX -= 8; __dstPtr--;
+                                }
 #endif
-				__pix = __blackPixel;
-			    } else {
-				double __nY;
-
-				/* rotate Y */
-				__nY = (__sin * __pX) + __cosPY;
-				/* translate Y in source (origin to 0/0) */
-				__nY = __nY + __halfH + 0.5;
-
-				/* inside ? */
-				if (__nY < 0) {
+                                __pix = __blackPixel;
+                            } else {
+                                double __nY;
+
+                                /* rotate Y */
+                                __nY = (__sin * __pX) + __cosPY;
+                                /* translate Y in source (origin to 0/0) */
+                                __nY = __nY + __halfH + 0.5;
+
+                                /* inside ? */
+                                if (__nY < 0) {
 #ifdef EARLY_OUT
-				    if (didFetchInRow) {
-					break;
-				    }
+                                    if (didFetchInRow) {
+                                        break;
+                                    }
 #endif
 #ifdef FAST_ADVANCE2
-				    if (__blackPixel == 0) {
-					do {
-					    /* try advance by 8 pixels ... */
-					    __dstX += 8; __dstPtr++;
-					    if (__dstX >= __newWidth) {
-						break;
-					    }
-					    __pX = (double)(__dstX + __minX);
-					    __nY = (__sin * __pX) + __cosPY;
-					    __nY = __nY + __halfH + 0.5;
-					} while (__nY < 0);
-					__dstX -= 8; __dstPtr--;
-				    }
+                                    if (__blackPixel == 0) {
+                                        do {
+                                            /* try advance by 8 pixels ... */
+                                            __dstX += 8; __dstPtr++;
+                                            if (__dstX >= __newWidth) {
+                                                break;
+                                            }
+                                            __pX = (double)(__dstX + __minX);
+                                            __nY = (__sin * __pX) + __cosPY;
+                                            __nY = __nY + __halfH + 0.5;
+                                        } while (__nY < 0);
+                                        __dstX -= 8; __dstPtr--;
+                                    }
 #endif
-				    __pix = __blackPixel;
-				} else {
-				    int __srcY;
-
-				    __srcY = (int)__nY;
-				    /* inside ? */
-				    if (__srcY >= __height) {
+                                    __pix = __blackPixel;
+                                } else {
+                                    int __srcY;
+
+                                    __srcY = (int)__nY;
+                                    /* inside ? */
+                                    if (__srcY >= __height) {
 #ifdef EARLY_OUT
-					if (didFetchInRow) {
-					    break;
-					}
+                                        if (didFetchInRow) {
+                                            break;
+                                        }
 #endif
 #ifdef FAST_ADVANCE
-					if (__blackPixel == 0) {
-					    do {
-						/* try advance by 8 pixels ... */
-						__dstX += 8; __dstPtr++;
-						if (__dstX >= __newWidth) {
-						    break;
-						}
-						__pX = (double)(__dstX + __minX);
-						__nY = (__sin * __pX) + __cosPY;
-						__nY = __nY + __halfH + 0.5;
-						__srcY = (int)__nY;
-					    } while (__srcY >= __height);
-					    __dstX -= 8; __dstPtr--;
-					}
+                                        if (__blackPixel == 0) {
+                                            do {
+                                                /* try advance by 8 pixels ... */
+                                                __dstX += 8; __dstPtr++;
+                                                if (__dstX >= __newWidth) {
+                                                    break;
+                                                }
+                                                __pX = (double)(__dstX + __minX);
+                                                __nY = (__sin * __pX) + __cosPY;
+                                                __nY = __nY + __halfH + 0.5;
+                                                __srcY = (int)__nY;
+                                            } while (__srcY >= __height);
+                                            __dstX -= 8; __dstPtr--;
+                                        }
 #endif
-					__pix = __blackPixel;
-				    } else {
-					/* fetch source pixel */
-
-					int idx, pV;
+                                        __pix = __blackPixel;
+                                    } else {
+                                        /* fetch source pixel */
+
+                                        int idx, pV;
 #ifdef EARLY_OUT
-					didFetchInRow = 1;
+                                        didFetchInRow = 1;
 #endif
-					idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
-					if ((unsigned)idx < __nSrcBytes) {
-					    pV = __srcBytes[idx];
-					    __pix = (pV & (0x80 >> (__srcX & 7))) ? 1 : 0;
-					} else {
-					    __pix = __blackPixel;
-					}
-				    }
-				}
-			    }
-			}
-
-			/* store pixel */
-			if (__pix != 0) {
-			    *__dstPtr |= __dstMask;
-			}
-			__dstMask >>= 1;
-			if (__dstMask == 0) {
-			    __dstMask = 0x80;
-			    __dstPtr++;
-			}
-		    }
-		}
-		break;
-
-	    case 24:
-		for (__dstY = 0; __dstY < __newHeight; __dstY++) {
-		    double __pY, __sinPY, __cosPY;
+                                        idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
+                                        if ((unsigned)idx < __nSrcBytes) {
+                                            pV = __srcBytes[idx];
+                                            __pix = (pV & (0x80 >> (__srcX & 7))) ? 1 : 0;
+                                        } else {
+                                            __pix = __blackPixel;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* store pixel */
+                        if (__pix != 0) {
+                            *__dstPtr |= __dstMask;
+                        }
+                        __dstMask >>= 1;
+                        if (__dstMask == 0) {
+                            __dstMask = 0x80;
+                            __dstPtr++;
+                        }
+                    }
+                }
+                break;
+
+            case 24:
+                for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+                    double __pY, __sinPY, __cosPY;
 #ifdef EARLY_OUT
-		    int didFetchInRow = 0;
+                    int didFetchInRow = 0;
 #endif
-		    __pY = (double)(__dstY + __minY);
-
-		    __sinPY = __sin * __pY;
-		    __cosPY = __cos * __pY;
-
-		    __dstPtr = __dstRowPtr;
-		    __dstRowPtr += __dstBytesPerRow;
-
-		    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
-			double __pX, __nX;
-			unsigned __pix;
-
-			/* translate X in destination (center to 0/0) */
-			__pX = (double)(__dstX + __minX);
-			/* rotate X */
-			__nX = (__cos * __pX) - __sinPY;
-
-			/* translate X in source (origin to 0/0) */
-			__nX = __nX + __halfW + 0.5;
-
-			/* inside ? */
-			if (__nX < 0) {
+                    __pY = (double)(__dstY + __minY);
+
+                    __sinPY = __sin * __pY;
+                    __cosPY = __cos * __pY;
+
+                    __dstPtr = __dstRowPtr;
+                    __dstRowPtr += __dstBytesPerRow;
+
+                    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+                        double __pX, __nX;
+                        unsigned __pix;
+
+                        /* translate X in destination (center to 0/0) */
+                        __pX = (double)(__dstX + __minX);
+                        /* rotate X */
+                        __nX = (__cos * __pX) - __sinPY;
+
+                        /* translate X in source (origin to 0/0) */
+                        __nX = __nX + __halfW + 0.5;
+
+                        /* inside ? */
+                        if (__nX < 0) {
 #ifdef EARLY_OUT
-			    if (didFetchInRow) {
-				break;
-			    }
+                            if (didFetchInRow) {
+                                break;
+                            }
 #endif
-			    __pix = __blackPixel;
-			} else {
-			    int __srcX;
-
-			    __srcX = (int)__nX;
-			    /* inside ? */
-			    if (__srcX >= __width) {
+                            __pix = __blackPixel;
+                        } else {
+                            int __srcX;
+
+                            __srcX = (int)__nX;
+                            /* inside ? */
+                            if (__srcX >= __width) {
 #ifdef EARLY_OUT
-				if (didFetchInRow) {
-				    break;
-				}
+                                if (didFetchInRow) {
+                                    break;
+                                }
 #endif
-				__pix = __blackPixel;
-			    } else {
-				double __nY;
-
-				/* rotate Y */
-				__nY = (__sin * __pX) + __cosPY;
-				/* translate Y in source (origin to 0/0) */
-				__nY = __nY + __halfH + 0.5;
-
-				/* inside ? */
-				if (__nY < 0) {
+                                __pix = __blackPixel;
+                            } else {
+                                double __nY;
+
+                                /* rotate Y */
+                                __nY = (__sin * __pX) + __cosPY;
+                                /* translate Y in source (origin to 0/0) */
+                                __nY = __nY + __halfH + 0.5;
+
+                                /* inside ? */
+                                if (__nY < 0) {
 #ifdef EARLY_OUT
-				    if (didFetchInRow) {
-					break;
-				    }
+                                    if (didFetchInRow) {
+                                        break;
+                                    }
 #endif
-				    __pix = __blackPixel;
-				} else {
-				    int __srcY;
-
-				    __srcY = (int)__nY;
-				    /* inside ? */
-				    if (__srcY >= __height) {
+                                    __pix = __blackPixel;
+                                } else {
+                                    int __srcY;
+
+                                    __srcY = (int)__nY;
+                                    /* inside ? */
+                                    if (__srcY >= __height) {
 #ifdef EARLY_OUT
-					if (didFetchInRow) {
-					    break;
-					}
+                                        if (didFetchInRow) {
+                                            break;
+                                        }
 #endif
-					__pix = __blackPixel;
-				    } else {
-					/* fetch source pixel */
-
-					int idx;
+                                        __pix = __blackPixel;
+                                    } else {
+                                        /* fetch source pixel */
+
+                                        int idx;
 #ifdef EARLY_OUT
-					didFetchInRow = 1;
+                                        didFetchInRow = 1;
 #endif
-					idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
-					if ((unsigned)idx < __nSrcBytes) {
-					    __pix = __srcBytes[idx];
-					    __pix = (__pix<<8) | __srcBytes[idx+1];
-					    __pix = (__pix<<8) | __srcBytes[idx+2];
-					} else {
-					    __pix = __blackPixel;
-					}
-				    }
-				}
-			    }
-			}
-
-			/* store pixel */
-			if (__pix != 0) {
-			    __dstPtr[0] = (__pix >> 16 & 0xFF);
-			    __dstPtr[1] = (__pix >> 8) & 0xFF;
-			    __dstPtr[2] = __pix & 0xFF;
-			}
-			__dstPtr += 3;
-		    }
-		}
-		break;
-
-	    default:
-		for (__dstY = 0; __dstY < __newHeight; __dstY++) {
-		    double __pY, __sinPY, __cosPY;
+                                        idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
+                                        if ((unsigned)idx < __nSrcBytes) {
+                                            __pix = __srcBytes[idx];
+                                            __pix = (__pix<<8) | __srcBytes[idx+1];
+                                            __pix = (__pix<<8) | __srcBytes[idx+2];
+                                        } else {
+                                            __pix = __blackPixel;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        /* store pixel */
+                        if (__pix != 0) {
+                            __dstPtr[0] = (__pix >> 16 & 0xFF);
+                            __dstPtr[1] = (__pix >> 8) & 0xFF;
+                            __dstPtr[2] = __pix & 0xFF;
+                        }
+                        __dstPtr += 3;
+                    }
+                }
+                break;
+
+            default:
+                for (__dstY = 0; __dstY < __newHeight; __dstY++) {
+                    double __pY, __sinPY, __cosPY;
 #ifdef EARLY_OUT
-		    int didFetchInRow = 0;
+                    int didFetchInRow = 0;
 #endif
-		    __pY = (double)(__dstY + __minY);
-
-		    __sinPY = __sin * __pY;
-		    __cosPY = __cos * __pY;
-
-		    __dstPtr = __dstRowPtr;
-		    __dstMask = 0x80;
-		    __dstRowPtr += __dstBytesPerRow;
-
-		    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
-			double __pX, __nX;
-			OBJ __pix;
-
-			/* translate X in destination (center to 0/0) */
-			__pX = (double)(__dstX + __minX);
-			/* rotate X */
-			__nX = (__cos * __pX) - __sinPY;
-
-			/* translate X in source (origin to 0/0) */
-			__nX = __nX + __halfW + 0.5;
-
-			/* inside ? */
-			if (__nX < 0) {
+                    __pY = (double)(__dstY + __minY);
+
+                    __sinPY = __sin * __pY;
+                    __cosPY = __cos * __pY;
+
+                    __dstPtr = __dstRowPtr;
+                    __dstMask = 0x80;
+                    __dstRowPtr += __dstBytesPerRow;
+
+                    for (__dstX = 0; __dstX < __newWidth; __dstX++) {
+                        double __pX, __nX;
+                        OBJ __pix;
+
+                        /* translate X in destination (center to 0/0) */
+                        __pX = (double)(__dstX + __minX);
+                        /* rotate X */
+                        __nX = (__cos * __pX) - __sinPY;
+
+                        /* translate X in source (origin to 0/0) */
+                        __nX = __nX + __halfW + 0.5;
+
+                        /* inside ? */
+                        if (__nX < 0) {
 #ifdef EARLY_OUT
-			    if (didFetchInRow) {
-				break;
-			    }
+                            if (didFetchInRow) {
+                                break;
+                            }
 #endif
-			    __pix = blackPixel;
-			} else {
-			    int __srcX;
-
-			    __srcX = (int)__nX;
-			    /* inside ? */
-			    if (__srcX >= __width) {
+                            __pix = blackPixel;
+                        } else {
+                            int __srcX;
+
+                            __srcX = (int)__nX;
+                            /* inside ? */
+                            if (__srcX >= __width) {
 #ifdef EARLY_OUT
-				if (didFetchInRow) {
-				    break;
-				}
+                                if (didFetchInRow) {
+                                    break;
+                                }
 #endif
-				__pix = blackPixel;
-			    } else {
-				double __nY;
-
-				/* rotate Y */
-				__nY = (__sin * __pX) + __cosPY;
-				/* translate Y in source (origin to 0/0) */
-				__nY = __nY + __halfH + 0.5;
-
-				/* inside ? */
-				if (__nY < 0) {
+                                __pix = blackPixel;
+                            } else {
+                                double __nY;
+
+                                /* rotate Y */
+                                __nY = (__sin * __pX) + __cosPY;
+                                /* translate Y in source (origin to 0/0) */
+                                __nY = __nY + __halfH + 0.5;
+
+                                /* inside ? */
+                                if (__nY < 0) {
 #ifdef EARLY_OUT
-				    if (didFetchInRow) {
-					break;
-				    }
+                                    if (didFetchInRow) {
+                                        break;
+                                    }
 #endif
-				    __pix = blackPixel;
-				} else {
-				    int __srcY;
-
-				    __srcY = (int)__nY;
-				    /* inside ? */
-				    if (__srcY >= __height) {
+                                    __pix = blackPixel;
+                                } else {
+                                    int __srcY;
+
+                                    __srcY = (int)__nY;
+                                    /* inside ? */
+                                    if (__srcY >= __height) {
 #ifdef EARLY_OUT
-					if (didFetchInRow) {
-					    break;
-					}
+                                        if (didFetchInRow) {
+                                            break;
+                                        }
 #endif
-					__pix = blackPixel;
-				    } else {
-					/* fetch source pixel */
-
-					static struct inlineCache valAt = _ILC2;
+                                        __pix = blackPixel;
+                                    } else {
+                                        /* fetch source pixel */
+
+                                        static struct inlineCache valAt = _ILC2;
 #ifdef EARLY_OUT
-					didFetchInRow = 1;
+                                        didFetchInRow = 1;
 #endif
-					__pix = (*valAt.ilc_func)(self,
-							      @symbol(pixelAtX:y:),
-							      nil, &valAt,
-							      __MKSMALLINT(__srcX),
-							      __MKSMALLINT(__srcY));
-				    }
-				}
-			    }
-			}
-
-			/* store pixel */
-			{
-			    static struct inlineCache atPutVal = _ILC3;
-
-			    if (__pix != __MKSMALLINT(0)) {
-				(*atPutVal.ilc_func)(newImage,
-						      @symbol(pixelAtX:y:put:),
-						      nil, &atPutVal,
-						      __MKSMALLINT(__dstX),
-						      __MKSMALLINT(__dstY),
-						      __pix
-						     );
-			    }
-			}
-		    }
-		}
-		break;
-	}
-
-	bad = false;
+                                        __pix = (*valAt.ilc_func)(self,
+                                                              @symbol(pixelAtX:y:),
+                                                              nil, &valAt,
+                                                              __MKSMALLINT(__srcX),
+                                                              __MKSMALLINT(__srcY));
+                                    }
+                                }
+                            }
+                        }
+
+                        /* store pixel */
+                        {
+                            static struct inlineCache atPutVal = _ILC3;
+
+                            if (__pix != __MKSMALLINT(0)) {
+                                (*atPutVal.ilc_func)(newImage,
+                                                      @symbol(pixelAtX:y:put:),
+                                                      nil, &atPutVal,
+                                                      __MKSMALLINT(__dstX),
+                                                      __MKSMALLINT(__dstY),
+                                                      __pix
+                                                     );
+                            }
+                        }
+                    }
+                }
+                break;
+        }
+
+        bad = false;
     }
 %}.
 
     bad ifTrue:[
-	"/ should not happen
-	self primitiveFailed
+        "/ should not happen
+        self primitiveFailed
 
 "/        sinRot := radians negated sin.
 "/        cosRot := radians negated cos.
@@ -11460,9 +11523,9 @@
 
      i := Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'.
      Transcript showCR:(
-	Time millisecondsToRun:[
-	   i rotated:45.
-	]
+        Time millisecondsToRun:[
+           i rotated:45.
+        ]
      ).
     "
     "
@@ -11473,12 +11536,12 @@
      v openAndWait.
      rot := 0.
      [true] whileTrue:[
-	rI := i rotated:rot.
-	rI := rI onDevice:v device.
-	v clear.
-	v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
-	rot := rot + 5.
-	rI close.
+        rI := i rotated:rot.
+        rI := rI onDevice:v device.
+        v clear.
+        v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
+        rot := rot + 5.
+        rI close.
      ]
     "
     "
@@ -11489,12 +11552,12 @@
      v openAndWait.
      rot := 0.
      [true] whileTrue:[
-	rI := i rotated:rot.
-	rI := rI onDevice:v device.
-	v clear.
-	v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
-	rot := rot + 5.
-	rI close.
+        rI := i rotated:rot.
+        rI := rI onDevice:v device.
+        v clear.
+        v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
+        rot := rot + 5.
+        rI close.
      ]
     "
     "
@@ -11514,13 +11577,13 @@
      v openAndWait.
      rot := 0.
      [true] whileTrue:[
-	rI := i rotated:rot.
-	rI := rI onDevice:v device.
-	v clear.
-	v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
-	rot := rot + 5.
-	rI close.
-	Delay waitForSeconds:0.1.
+        rI := i rotated:rot.
+        rI := rI onDevice:v device.
+        v clear.
+        v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
+        rot := rot + 5.
+        rI close.
+        Delay waitForSeconds:0.1.
      ]
     "
     "
@@ -11540,13 +11603,13 @@
      v openAndWait.
      rot := 0.
      [true] whileTrue:[
-	rI := i rotated:rot.
-	rI := rI onDevice:v device.
-	v clear.
-	v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
-	rot := rot + 30.
-	rI close.
-	Delay waitForSeconds:0.3.
+        rI := i rotated:rot.
+        rI := rI onDevice:v device.
+        v clear.
+        v displayForm:rI x:(v width-rI width)//2 y:(v height-rI height)//2.
+        rot := rot + 30.
+        rI close.
+        Delay waitForSeconds:0.3.
      ]
     "
 
@@ -11595,7 +11658,7 @@
     ((mX = 1) and:[mY = 1]) ifTrue:[^ self].
 
     ((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[
-	^ self hardMagnifiedBy:scalePoint
+        ^ self hardMagnifiedBy:scalePoint
     ].
 
     bytes := self bits.
@@ -11613,60 +11676,60 @@
     newBits := ByteArray uninitializedNew:(newBytesPerRow * newHeight).
 
     mask notNil ifTrue:[
-	newMask := (mask magnifiedBy:scalePoint)
+        newMask := (mask magnifiedBy:scalePoint)
     ].
 
     newImage := self species new.
     newImage
-	width:newWidth
-	height:newHeight
-	photometric:photometric
-	samplesPerPixel:samplesPerPixel
-	bitsPerSample:bitsPerSample
-	colorMap:colorMap copy
-	bits:newBits
-	mask:newMask.
+        width:newWidth
+        height:newHeight
+        photometric:photometric
+        samplesPerPixel:samplesPerPixel
+        bitsPerSample:bitsPerSample
+        colorMap:colorMap copy
+        bits:newBits
+        mask:newMask.
 
     mX = 1 ifTrue:[
-	"expand rows only"
-	srcOffset := 1.
-	dstOffset := 1.
-
-	1 to:h do:[:row |
-	    1 to:magY do:[:i |
-		newBits replaceFrom:dstOffset
-			to:(dstOffset + oldBytesPerRow - 1)
-			with:bytes
-			startingAt:srcOffset.
-		dstOffset := dstOffset + newBytesPerRow
-	    ].
-	    srcOffset := srcOffset + oldBytesPerRow.
-	].
+        "expand rows only"
+        srcOffset := 1.
+        dstOffset := 1.
+
+        1 to:h do:[:row |
+            1 to:magY do:[:i |
+                newBits replaceFrom:dstOffset
+                        to:(dstOffset + oldBytesPerRow - 1)
+                        with:bytes
+                        startingAt:srcOffset.
+                dstOffset := dstOffset + newBytesPerRow
+            ].
+            srcOffset := srcOffset + oldBytesPerRow.
+        ].
     ] ifFalse:[
-	"expand cols"
-	(mX > 1) ifTrue:[
-	    dstOffset := 1.
-	    srcOffset := 1.
-	    1 to:h do:[:row |
-		self magnifyRowFrom:bytes
-		     offset:srcOffset
-		     into:newBits
-		     offset:dstOffset
-		     factor:mX.
-
-		first := dstOffset.
-		dstOffset := dstOffset + newBytesPerRow.
-		" and copy for row expansion "
-		2 to:magY do:[:i |
-		    newBits replaceFrom:dstOffset
-			    to:(dstOffset + newBytesPerRow - 1)
-			    with:newBits
-			    startingAt:first.
-		    dstOffset := dstOffset + newBytesPerRow
-		].
-		srcOffset := srcOffset + oldBytesPerRow.
-	    ].
-	]
+        "expand cols"
+        (mX > 1) ifTrue:[
+            dstOffset := 1.
+            srcOffset := 1.
+            1 to:h do:[:row |
+                self magnifyRowFrom:bytes
+                     offset:srcOffset
+                     into:newBits
+                     offset:dstOffset
+                     factor:mX.
+
+                first := dstOffset.
+                dstOffset := dstOffset + newBytesPerRow.
+                " and copy for row expansion "
+                2 to:magY do:[:i |
+                    newBits replaceFrom:dstOffset
+                            to:(dstOffset + newBytesPerRow - 1)
+                            with:newBits
+                            startingAt:first.
+                    dstOffset := dstOffset + newBytesPerRow
+                ].
+                srcOffset := srcOffset + oldBytesPerRow.
+            ].
+        ]
     ].
     ^ newImage
 
@@ -11725,7 +11788,7 @@
      CAVEAT: Need an argument, which specifies by how much it should be lighter."
 
      ^ self
-	copyWithColorMapProcessing:[:clr | clr mixed:amount with:aColor]
+        copyWithColorMapProcessing:[:clr | clr mixed:amount with:aColor]
 
     "
      (Smalltalk bitmapFromFileNamed:'gifImages/claus.gif' inPackage:'stx:goodies') inspect
@@ -11748,28 +11811,28 @@
     |newImage|
 
     colorMap isNil ifTrue:[
-	photometric == #blackIs0 ifTrue:[
-	    newImage := self copy.
-	    newImage photometric:#whiteIs0.
-	    ^ newImage
-	].
-	photometric == #whiteIs0 ifTrue:[
-	    newImage := self copy.
-	    newImage photometric:#blackIs0.
-	    ^ newImage
-	].
-	^ nil
+        photometric == #blackIs0 ifTrue:[
+            newImage := self copy.
+            newImage photometric:#whiteIs0.
+            ^ newImage
+        ].
+        photometric == #whiteIs0 ifTrue:[
+            newImage := self copy.
+            newImage photometric:#blackIs0.
+            ^ newImage
+        ].
+        ^ nil
     ].
 
      ^ self
-	copyWithColorMapProcessing:[:clr |
-		|newColor|
-
-		newColor := Color
-				redByte:(255 - clr redByte)
-				greenByte:(255 - clr greenByte)
-				blueByte:(255 - clr blueByte)
-	]
+        copyWithColorMapProcessing:[:clr |
+                |newColor|
+
+                newColor := Color
+                                redByte:(255 - clr redByte)
+                                greenByte:(255 - clr greenByte)
+                                blueByte:(255 - clr blueByte)
+        ]
 
     "
      (Image fromFile:'goodies/bitmaps/gifImages/claus.gif') inspect
@@ -11783,7 +11846,7 @@
 rotated:degrees
     "return a new image from the old one, by rotating the image
      degrees clockwise.
-     Notice, that the resulting image has a different extent.
+     Notice that the resulting image has a different extent.
      If rotation is heavily used, the workHorse methods
      (#easyRotateBitsInto:angle: and #hardRotateBitsInto:angle) may
      be redefined in concrete image subclasses."
@@ -11796,15 +11859,15 @@
     d := d truncated.
     d = 0 ifTrue:[^ self].
     ((d ~= 90) and:[(d ~= 270) and:[d ~= 180]]) ifTrue:[
-	^ self hardRotated:d
+        ^ self hardRotated:d
     ].
 
     d = 180 ifTrue:[
-	nW := width.
-	nH := height.
+        nW := width.
+        nH := height.
     ] ifFalse:[
-	nW := height.
-	nH := width.
+        nW := height.
+        nH := width.
     ].
 
     newImage := self species new.
@@ -11816,7 +11879,7 @@
     newImage bitsPerSample:bitsPerSample.
     newImage colorMap:colorMap copy.
     mask notNil ifTrue:[
-	newImage mask:(mask rotated:degrees)
+        newImage mask:(mask rotated:degrees)
     ].
 
     self easyRotateBitsInto:newImage angle:d.
@@ -11826,7 +11889,18 @@
     "
      |i|
 
-     i := Image fromFile:'goodies/bitmaps/gifImages/claus.gif'.
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     i inspect.
+     (i rotated:45) inspect.
+     (i rotated:90) inspect.
+     (i rotated:180) inspect.
+     (i rotated:270) inspect.
+    "
+    "
+     |i|
+
+     i := Image fromFile:'../../goodies/bitmaps/gifImages/claus.gif'.
+     i := Depth24Image fromImage:i.
      i inspect.
      (i rotated:45) inspect.
      (i rotated:90) inspect.
@@ -11898,36 +11972,36 @@
     newImage colorMap:colorMap copy.
     newImage maskedPixelsAre0:maskedPixelsAre0.
     mask notNil ifTrue:[
-	newImage mask:(mask threeDProjected:fraction1 and:fraction2)
+        newImage mask:(mask threeDProjected:fraction1 and:fraction2)
     ] ifFalse:[
-	self isMask ifFalse:[
-	    self depth ~~ 1 ifTrue:[
-		m := ImageMask width:width height:height.
-		m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
-		maskBits atAllPut:16rFF.
-		newImage mask:(m threeDProjected:fraction1 and:fraction2)
-	    ]
-	]
+        self isMask ifFalse:[
+            self depth ~~ 1 ifTrue:[
+                m := ImageMask width:width height:height.
+                m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
+                maskBits atAllPut:16rFF.
+                newImage mask:(m threeDProjected:fraction1 and:fraction2)
+            ]
+        ]
     ].
 
     myDepth := self depth.
     myDepth == 1 ifTrue:[
-	blackPixel := 0.
+        blackPixel := 0.
     ] ifFalse:[
-	maskedPixelsAre0 ifTrue:[
-	    blackPixel := 0.
-	] ifFalse:[
-	    blackPixel := self valueFromColor:Color black.
-	    blackPixel isNil ifTrue:[
-		blackPixel := self valueFromColor:Color white.
-		blackPixel isNil ifTrue:[
-		    blackPixel := 0.
-		]
-	    ]
-	].
-	self isMask ifTrue:[
-	    blackPixel := 0.
-	].
+        maskedPixelsAre0 ifTrue:[
+            blackPixel := 0.
+        ] ifFalse:[
+            blackPixel := self valueFromColor:Color black.
+            blackPixel isNil ifTrue:[
+                blackPixel := self valueFromColor:Color white.
+                blackPixel isNil ifTrue:[
+                    blackPixel := 0.
+                ]
+            ]
+        ].
+        self isMask ifTrue:[
+            blackPixel := 0.
+        ].
     ].
 
     newBits atAllPut:0.
@@ -11968,24 +12042,24 @@
     df := fr-fl.
 
     0 to:width-1 do:[:srcX |
-	fractX := srcX / width.
-	my := ml + (dm * fractX).
-	fy := fl + (df * fractX).
-	o1 := dx1 * fractX.
-	o2 := dx2 * fractX.
-
-	0 to:height-1 do:[:srcY |
-	    srcY < halfH ifTrue:[
-		dstY := o1 + (fy * (srcY / halfH)).
-	    ] ifFalse:[
-		dstY := my + (fy * ((srcY-halfH) / halfH)).
-	    ].
-	    pix := self pixelAtX:srcX y:srcY.
-	    dstY < 0
-		ifTrue:[dstY := 0]
-		ifFalse:[ dstY >= height ifTrue:[dstY := height-1]].
-	    newImage pixelAtX:srcX y:dstY truncated put:pix.
-	].
+        fractX := srcX / width.
+        my := ml + (dm * fractX).
+        fy := fl + (df * fractX).
+        o1 := dx1 * fractX.
+        o2 := dx2 * fractX.
+
+        0 to:height-1 do:[:srcY |
+            srcY < halfH ifTrue:[
+                dstY := o1 + (fy * (srcY / halfH)).
+            ] ifFalse:[
+                dstY := my + (fy * ((srcY-halfH) / halfH)).
+            ].
+            pix := self pixelAtX:srcX y:srcY.
+            dstY < 0
+                ifTrue:[dstY := 0]
+                ifFalse:[ dstY >= height ifTrue:[dstY := height-1]].
+            newImage pixelAtX:srcX y:dstY truncated put:pix.
+        ].
     ].
 
     ^ newImage
@@ -12009,7 +12083,7 @@
      newColors newColorArray newImage extMask extBits newPixelValue|
 
     numBits > 7 ifTrue:[
-	^ nil
+        ^ nil
     ].
     mask := (16rFF bitShift:numBits) bitAnd:16rFF.
     extMask := (1 bitShift:numBits).
@@ -12032,70 +12106,70 @@
     yMax := height - 1.
 
     newPixelValue :=
-	[:image :pixelValue |
-	    |r g b nR nG nB|
-
-	    r := image redBitsOf:pixelValue.
-	    g := image greenBitsOf:pixelValue.
-	    b := image blueBitsOf:pixelValue.
-	    nR := r bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
-	    nG := g bitAnd:mask. (nG bitAnd:extMask)~~0 ifTrue:[nG := nG bitOr:extBits].
-	    nB := b bitAnd:mask. (nB bitAnd:extMask)~~0 ifTrue:[nB := nB bitOr:extBits].
-	    image valueFromRedBits:nR greenBits:nG blueBits:nB.
-	].
+        [:image :pixelValue |
+            |r g b nR nG nB|
+
+            r := image redBitsOf:pixelValue.
+            g := image greenBitsOf:pixelValue.
+            b := image blueBitsOf:pixelValue.
+            nR := r bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
+            nG := g bitAnd:mask. (nG bitAnd:extMask)~~0 ifTrue:[nG := nG bitOr:extBits].
+            nB := b bitAnd:mask. (nB bitAnd:extMask)~~0 ifTrue:[nB := nB bitOr:extBits].
+            image valueFromRedBits:nR greenBits:nG blueBits:nB.
+        ].
 
 
     photometric == #palette ifFalse:[
-	"/ direct manipulation of the pixels
-	0 to:yMax do:[:y |
-	    0 to:xMax do:[:x |
-		pix := self pixelAtX:x y:y.
-		n_pix := newPixelValue value:self value:pix.
-		n_pix ~= pix ifTrue:[
-		    newImage pixelAtX:x y:y put:n_pix.
-		    anyChange := true.
-		]
-	    ]
-	].
-	anyChange ifFalse:[
-	    ^ nil
-	].
+        "/ direct manipulation of the pixels
+        0 to:yMax do:[:y |
+            0 to:xMax do:[:x |
+                pix := self pixelAtX:x y:y.
+                n_pix := newPixelValue value:self value:pix.
+                n_pix ~= pix ifTrue:[
+                    newImage pixelAtX:x y:y put:n_pix.
+                    anyChange := true.
+                ]
+            ]
+        ].
+        anyChange ifFalse:[
+            ^ nil
+        ].
     ] ifTrue:[
-	"/ manipulate the colormap
-	0 to:yMax do:[:y |
-	    0 to:xMax do:[:x |
-		pix := self pixelAtX:x y:y.
-		(n_pix := map at:pix+1) isNil ifTrue:[
-		    clr := self colorAtX:x y:y.
-
-		    r := clr redByte.
-		    g := clr greenByte.
-		    b := clr blueByte.
-		    nR := r bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
-		    nG := g bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
-		    nB := b bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
-		    n_clr := Color redByte:nR greenByte:nG blueByte:nB.
-		    (newColors includes:n_clr) ifFalse:[
-			newColors add:n_clr.
-			newColorArray add:n_clr.
-			revMap add:pix.
-			map at:pix+1 put:(n_pix := revMap size - 1).
-		    ] ifTrue:[
-			"/ mhmh - multiple pixels mapped to the same color
-			n_pix := (newColorArray indexOf:n_clr) - 1.
-			map at:pix+1 put:n_pix.
-		    ]
-		].
-		newImage pixelAtX:x y:y put:n_pix.
-	    ]
-	].
-	revMap size == self colorMap size ifTrue:[
-	    revMap = (0 to:revMap size-1) ifTrue:[
-		^ nil
-	    ]
-	].
-
-	newImage colorMap:(MappedPalette withColors:newColorArray).
+        "/ manipulate the colormap
+        0 to:yMax do:[:y |
+            0 to:xMax do:[:x |
+                pix := self pixelAtX:x y:y.
+                (n_pix := map at:pix+1) isNil ifTrue:[
+                    clr := self colorAtX:x y:y.
+
+                    r := clr redByte.
+                    g := clr greenByte.
+                    b := clr blueByte.
+                    nR := r bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
+                    nG := g bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
+                    nB := b bitAnd:mask. (nR bitAnd:extMask)~~0 ifTrue:[nR := nR bitOr:extBits].
+                    n_clr := Color redByte:nR greenByte:nG blueByte:nB.
+                    (newColors includes:n_clr) ifFalse:[
+                        newColors add:n_clr.
+                        newColorArray add:n_clr.
+                        revMap add:pix.
+                        map at:pix+1 put:(n_pix := revMap size - 1).
+                    ] ifTrue:[
+                        "/ mhmh - multiple pixels mapped to the same color
+                        n_pix := (newColorArray indexOf:n_clr) - 1.
+                        map at:pix+1 put:n_pix.
+                    ]
+                ].
+                newImage pixelAtX:x y:y put:n_pix.
+            ]
+        ].
+        revMap size == self colorMap size ifTrue:[
+            revMap = (0 to:revMap size-1) ifTrue:[
+                ^ nil
+            ]
+        ].
+
+        newImage colorMap:(MappedPalette withColors:newColorArray).
     ].
 
     ^ newImage
@@ -12108,7 +12182,7 @@
      (#withPixelFunctionAppliedToPixels:) or redefine this method in
      a concrete subclass.
      (read `Beyond photography, by Gerard J. Holzmann;
-	   ISBM 0-13-074410-7)
+           ISBM 0-13-074410-7)
      See blurred / oilPointed as examples ...)"
 
     |w  "{Class: SmallInteger }"
@@ -12131,13 +12205,13 @@
     h := height - 1.
 
     0 to:h do:[:y |
-	0 to:w do:[:x |
-	    newImage colorAtX:x y:y put:(pixelFunctionBlock
-						value:self
-						value:(self colorAtX:x y:y)
-						value:x
-						value:y)
-	]
+        0 to:w do:[:x |
+            newImage colorAtX:x y:y put:(pixelFunctionBlock
+                                                value:self
+                                                value:(self colorAtX:x y:y)
+                                                value:x
+                                                value:y)
+        ]
     ].
     ^ newImage
 
@@ -12150,13 +12224,13 @@
 
      black := Color black.
      (i withPixelFunctionApplied:[:oldImage :oldColor :x :y |
-			((x between:100 and:200)
-			and:[y between:100 and:200]) ifTrue:[
-			    oldColor
-			] ifFalse:[
-			    black.
-			]
-		     ]) inspect.
+                        ((x between:100 and:200)
+                        and:[y between:100 and:200]) ifTrue:[
+                            oldColor
+                        ] ifFalse:[
+                            black.
+                        ]
+                     ]) inspect.
     "
     "brighten a frame:
 
@@ -12168,15 +12242,15 @@
      w := i width.
      h := i height.
      (i withPixelFunctionApplied:[:oldImage :oldColor :x :y |
-			((x between:0 and:10)
-			or:[(y between:0 and:10)
-			or:[(x between:w-10 and:w)
-			or:[y between:h-10 and:h]]]) ifTrue:[
-			    oldColor lightened nearestIn:i colorMap
-			] ifFalse:[
-			    oldColor.
-			]
-		     ]) inspect.
+                        ((x between:0 and:10)
+                        or:[(y between:0 and:10)
+                        or:[(x between:w-10 and:w)
+                        or:[y between:h-10 and:h]]]) ifTrue:[
+                            oldColor lightened nearestIn:i colorMap
+                        ] ifFalse:[
+                            oldColor.
+                        ]
+                     ]) inspect.
     "
 
     "Modified: 24.4.1997 / 18:36:59 / cg"
@@ -12186,12 +12260,12 @@
     "return a new image from the old one, by applying a pixel processor
      on the pixel values.
      (read `Beyond photography, by Gerard J. Holzmann;
-	   ISBM 0-13-074410-7)
+           ISBM 0-13-074410-7)
      See blurred / oilPointed as examples ...)"
 
     ^ self
-	withPixelFunctionAppliedToPixels:pixelFunctionBlock
-	in:(0@0 corner:width@height)
+        withPixelFunctionAppliedToPixels:pixelFunctionBlock
+        in:(0@0 corner:width@height)
 
     "oil painting effect:
 
@@ -12202,27 +12276,27 @@
      w := i width - 1.
      h := i height - 1.
      (i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
-			|b p max xMin xMax yMin yMax|
-
-			b := Bag identityNew:10.
-			xMin := x-3 max:0.
-			xMax := x+3 min:w.
-			yMin := y-3 max:0.
-			yMax := y+3 min:h.
-			xMin to:xMax do:[:tx|
-			  yMin to:yMax do:[:ty|
-			    b add:(oldImage pixelAtX:tx y:ty)
-			  ]
-			].
-			max := 0.
-			b contents keysAndValuesDo:[:pixel :n |
-			    n > max ifTrue:[
-				p := pixel.
-				max := n
-			    ]
-			].
-			p
-		     ]) inspect.
+                        |b p max xMin xMax yMin yMax|
+
+                        b := Bag identityNew:10.
+                        xMin := x-3 max:0.
+                        xMax := x+3 min:w.
+                        yMin := y-3 max:0.
+                        yMax := y+3 min:h.
+                        xMin to:xMax do:[:tx|
+                          yMin to:yMax do:[:ty|
+                            b add:(oldImage pixelAtX:tx y:ty)
+                          ]
+                        ].
+                        max := 0.
+                        b contents keysAndValuesDo:[:pixel :n |
+                            n > max ifTrue:[
+                                p := pixel.
+                                max := n
+                            ]
+                        ].
+                        p
+                     ]) inspect.
     "
 
     "fisheye effect:
@@ -12238,25 +12312,25 @@
      R := w2.
      white := i valueFromColor:Color white.
      (i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
-			|p r a nR nP nX nY|
-
-			p := (x-w2)@(y-h2).
-			r := p r.
-			a := p theta.
-			nR := r * r / R.
-			nP := Point r:nR theta:a.
-			nX := ((nP x+w2) rounded max:0) min:w.
-			nY := ((nP y+h2) rounded max:0) min:h.
-			(nX > w or:[nX < 0]) ifTrue:[
-			    white
-			] ifFalse:[
-			    (nY > h or:[nY < 0]) ifTrue:[
-				white
-			    ] ifFalse:[
-				oldImage pixelAtX:nX y:nY
-			    ]
-			]
-		     ]) inspect.
+                        |p r a nR nP nX nY|
+
+                        p := (x-w2)@(y-h2).
+                        r := p r.
+                        a := p theta.
+                        nR := r * r / R.
+                        nP := Point r:nR theta:a.
+                        nX := ((nP x+w2) rounded max:0) min:w.
+                        nY := ((nP y+h2) rounded max:0) min:h.
+                        (nX > w or:[nX < 0]) ifTrue:[
+                            white
+                        ] ifFalse:[
+                            (nY > h or:[nY < 0]) ifTrue:[
+                                white
+                            ] ifFalse:[
+                                oldImage pixelAtX:nX y:nY
+                            ]
+                        ]
+                     ]) inspect.
     "
     "fisheye effect:
 
@@ -12271,25 +12345,25 @@
      R := w2.
      white := i valueFromColor:Color white.
      (i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
-			|p r a nR nP nX nY|
-
-			p := (x-w2)@(y-h2).
-			r := p r.
-			a := p theta.
-			nR := r * r / R.
-			nP := Point r:nR theta:a.
-			nX := (nP x+w2) rounded.
-			nY := (nP y+h2) rounded.
-			(nX > w or:[nX < 0]) ifTrue:[
-			    white
-			] ifFalse:[
-			    (nY > h or:[nY < 0]) ifTrue:[
-				white
-			    ] ifFalse:[
-				oldImage pixelAtX:nX y:nY
-			    ]
-			]
-		     ]) inspect.
+                        |p r a nR nP nX nY|
+
+                        p := (x-w2)@(y-h2).
+                        r := p r.
+                        a := p theta.
+                        nR := r * r / R.
+                        nP := Point r:nR theta:a.
+                        nX := (nP x+w2) rounded.
+                        nY := (nP y+h2) rounded.
+                        (nX > w or:[nX < 0]) ifTrue:[
+                            white
+                        ] ifFalse:[
+                            (nY > h or:[nY < 0]) ifTrue:[
+                                white
+                            ] ifFalse:[
+                                oldImage pixelAtX:nX y:nY
+                            ]
+                        ]
+                     ]) inspect.
     "
 
     "Created: 24.4.1997 / 18:37:17 / cg"
@@ -12300,7 +12374,7 @@
     "return a new image from the old one, by applying a pixel processor
      on the pixel values.
      (read `Beyond photography, by Gerard J. Holzmann;
-	   ISBM 0-13-074410-7)
+           ISBM 0-13-074410-7)
      See blurred / oilPointed as examples ...)"
 
     |newImage "newBits newBytesPerRow"|
@@ -12329,27 +12403,27 @@
      w := i width - 1.
      h := i height - 1.
      (i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
-			|b p max xMin xMax yMin yMax|
-
-			b := Bag identityNew:10.
-			xMin := x-3 max:0.
-			xMax := x+3 min:w.
-			yMin := y-3 max:0.
-			yMax := y+3 min:h.
-			xMin to:xMax do:[:tx|
-			  yMin to:yMax do:[:ty|
-			    b add:(oldImage pixelAtX:tx y:ty)
-			  ]
-			].
-			max := 0.
-			b contents keysAndValuesDo:[:pixel :n |
-			    n > max ifTrue:[
-				p := pixel.
-				max := n
-			    ]
-			].
-			p
-		     ]) inspect.
+                        |b p max xMin xMax yMin yMax|
+
+                        b := Bag identityNew:10.
+                        xMin := x-3 max:0.
+                        xMax := x+3 min:w.
+                        yMin := y-3 max:0.
+                        yMax := y+3 min:h.
+                        xMin to:xMax do:[:tx|
+                          yMin to:yMax do:[:ty|
+                            b add:(oldImage pixelAtX:tx y:ty)
+                          ]
+                        ].
+                        max := 0.
+                        b contents keysAndValuesDo:[:pixel :n |
+                            n > max ifTrue:[
+                                p := pixel.
+                                max := n
+                            ]
+                        ].
+                        p
+                     ]) inspect.
     "
 
     "fisheye effect:
@@ -12365,25 +12439,25 @@
      R := w2.
      white := i valueFromColor:Color white.
      (i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
-			|p r a nR nP nX nY|
-
-			p := (x-w2)@(y-h2).
-			r := p r.
-			a := p theta.
-			nR := r * r / R.
-			nP := Point r:nR theta:a.
-			nX := ((nP x+w2) rounded max:0) min:w.
-			nY := ((nP y+h2) rounded max:0) min:h.
-			(nX > w or:[nX < 0]) ifTrue:[
-			    white
-			] ifFalse:[
-			    (nY > h or:[nY < 0]) ifTrue:[
-				white
-			    ] ifFalse:[
-				oldImage pixelAtX:nX y:nY
-			    ]
-			]
-		     ]) inspect.
+                        |p r a nR nP nX nY|
+
+                        p := (x-w2)@(y-h2).
+                        r := p r.
+                        a := p theta.
+                        nR := r * r / R.
+                        nP := Point r:nR theta:a.
+                        nX := ((nP x+w2) rounded max:0) min:w.
+                        nY := ((nP y+h2) rounded max:0) min:h.
+                        (nX > w or:[nX < 0]) ifTrue:[
+                            white
+                        ] ifFalse:[
+                            (nY > h or:[nY < 0]) ifTrue:[
+                                white
+                            ] ifFalse:[
+                                oldImage pixelAtX:nX y:nY
+                            ]
+                        ]
+                     ]) inspect.
     "
     "fisheye effect:
 
@@ -12398,25 +12472,25 @@
      R := w2.
      white := i valueFromColor:Color white.
      (i withPixelFunctionAppliedToPixels:[:oldImage :oldPixel :x :y |
-			|p r a nR nP nX nY|
-
-			p := (x-w2)@(y-h2).
-			r := p r.
-			a := p theta.
-			nR := r * r / R.
-			nP := Point r:nR theta:a.
-			nX := (nP x+w2) rounded.
-			nY := (nP y+h2) rounded.
-			(nX > w or:[nX < 0]) ifTrue:[
-			    white
-			] ifFalse:[
-			    (nY > h or:[nY < 0]) ifTrue:[
-				white
-			    ] ifFalse:[
-				oldImage pixelAtX:nX y:nY
-			    ]
-			]
-		     ]) inspect.
+                        |p r a nR nP nX nY|
+
+                        p := (x-w2)@(y-h2).
+                        r := p r.
+                        a := p theta.
+                        nR := r * r / R.
+                        nP := Point r:nR theta:a.
+                        nX := (nP x+w2) rounded.
+                        nY := (nP y+h2) rounded.
+                        (nX > w or:[nX < 0]) ifTrue:[
+                            white
+                        ] ifFalse:[
+                            (nY > h or:[nY < 0]) ifTrue:[
+                                white
+                            ] ifFalse:[
+                                oldImage pixelAtX:nX y:nY
+                            ]
+                        ]
+                     ]) inspect.
     "
 
     "Created: 24.4.1997 / 18:37:17 / cg"
@@ -12445,21 +12519,21 @@
     "release device resources; destroy any device-resources"
 
     deviceForm notNil ifTrue:[
-	deviceForm destroy.
-	deviceForm := nil.
+        deviceForm destroy.
+        deviceForm := nil.
     ].
     monoDeviceForm notNil ifTrue:[
-	monoDeviceForm destroy.
-	monoDeviceForm := nil.
+        monoDeviceForm destroy.
+        monoDeviceForm := nil.
     ].
     fullColorDeviceForm notNil ifTrue:[
-	fullColorDeviceForm destroy.
-	fullColorDeviceForm := nil.
+        fullColorDeviceForm destroy.
+        fullColorDeviceForm := nil.
     ].
 
     device := nil.
     mask notNil ifTrue:[
-	mask close.
+        mask close.
     ].
     Lobby unregister:self.
 
@@ -12475,7 +12549,7 @@
     monoDeviceForm := nil.
     fullColorDeviceForm := nil.
     mask notNil ifTrue:[
-	mask release.
+        mask release.
     ].
     Lobby unregister:self.
     super release.
@@ -12545,34 +12619,34 @@
     ((photometric == anImage photometric)
      and:[self bitsPerPixel == anImage bitsPerPixel
      and:[colorMap = anImage colorMap]]) ifTrue:[
-	"/ can loop over values
-	anImage valuesFromX:srcX  y:srcY
-			toX:srcX+w-1 y:srcY+h-1
-			 do:[:x :y :pixelValue |
-	    self pixelAtX:x-dX y:y-dY put:pixelValue.
-	]
+        "/ can loop over values
+        anImage valuesFromX:srcX  y:srcY
+                        toX:srcX+w-1 y:srcY+h-1
+                         do:[:x :y :pixelValue |
+            self pixelAtX:x-dX y:y-dY put:pixelValue.
+        ]
     ] ifFalse:[
-	"/ must loop over colors - horribly slow
-	anImage colorsFromX:srcX  y:srcY
-			toX:srcX+w-1 y:srcY+h-1
-			 do:[:x :y :clr |
-	    self colorAtX:x-dX y:y-dY put:clr.
-	]
+        "/ must loop over colors - horribly slow
+        anImage colorsFromX:srcX  y:srcY
+                        toX:srcX+w-1 y:srcY+h-1
+                         do:[:x :y :clr |
+            self colorAtX:x-dX y:y-dY put:clr.
+        ]
     ].
 
     (mask isNil and:[anImage mask notNil]) ifTrue:[
-	"/ I have no mask; copied image has
-	self createMask.
+        "/ I have no mask; copied image has
+        self createMask.
     ].
 
     mask notNil ifTrue:[
-	anImage mask notNil ifTrue:[
-	    "/ both have a mask
-	    mask copyFrom:anImage mask x:srcX y:srcY toX:dstX y:dstY width:w height:h
-	] ifFalse:[
-	    "/ I have a mask - copied image has not
-	    mask fillRectangleX:dstX y:dstY width:w height:h withValue:1
-	]
+        anImage mask notNil ifTrue:[
+            "/ both have a mask
+            mask copyFrom:anImage mask x:srcX y:srcY toX:dstX y:dstY width:w height:h
+        ] ifFalse:[
+            "/ I have a mask - copied image has not
+            mask fillRectangleX:dstX y:dstY width:w height:h withValue:1
+        ]
 "/    ] ifFalse:[
 "/        anImage mask notNil ifTrue:[
 "/            "/ I have no mask; copied image has (already handled)
@@ -12614,11 +12688,11 @@
        for other cases, rewriting the inner loops as inline C-code."
 
     maskedCopy ifTrue:[
-	self
-	    copyMaskedFrom:anImage x:srcX y:srcY toX:dstX y:dstY width:w height:h
+        self
+            copyMaskedFrom:anImage x:srcX y:srcY toX:dstX y:dstY width:w height:h
     ] ifFalse:[
-	self
-	    copyFrom:anImage x:srcX y:srcY toX:dstX y:dstY width:w height:h
+        self
+            copyFrom:anImage x:srcX y:srcY toX:dstX y:dstY width:w height:h
     ].
 
     "
@@ -12658,23 +12732,23 @@
     ((photometric == anImage photometric)
      and:[self bitsPerPixel == anImage bitsPerPixel
      and:[colorMap = anImage colorMap]]) ifTrue:[
-	"/ can loop over values
-	anImage valuesFromX:srcX  y:srcY
-			toX:srcX+w-1 y:srcY+h-1
-			 do:[:x :y :pixelValue |
-	    (anImage maskAtX:x y:y) ~~ 0 ifTrue:[
-		self pixelAtX:x-dX y:y-dY put:pixelValue.
-	    ]
-	]
+        "/ can loop over values
+        anImage valuesFromX:srcX  y:srcY
+                        toX:srcX+w-1 y:srcY+h-1
+                         do:[:x :y :pixelValue |
+            (anImage maskAtX:x y:y) ~~ 0 ifTrue:[
+                self pixelAtX:x-dX y:y-dY put:pixelValue.
+            ]
+        ]
     ] ifFalse:[
-	"/ must loop over colors - horribly slow
-	anImage colorsFromX:srcX  y:srcY
-			toX:srcX+w-1 y:srcY+h-1
-			 do:[:x :y :clr |
-	    (anImage maskAtX:x y:y) ~~ 0 ifTrue:[
-		self colorAtX:x-dX y:y-dY put:clr.
-	    ]
-	]
+        "/ must loop over colors - horribly slow
+        anImage colorsFromX:srcX  y:srcY
+                        toX:srcX+w-1 y:srcY+h-1
+                         do:[:x :y :clr |
+            (anImage maskAtX:x y:y) ~~ 0 ifTrue:[
+                self colorAtX:x-dX y:y-dY put:clr.
+            ]
+        ]
     ].
 !
 
@@ -12705,9 +12779,9 @@
     bytes := ByteArray new:(bpr * height).
     idx := 1.
     0 to:height-1 do:[:y |
-	0 to:width-1 do:[:x |
-	    self pixelAtX:x y:y put:(pixelFunction value:x value:y).
-	]
+        0 to:width-1 do:[:x |
+            self pixelAtX:x y:y put:(pixelFunction value:x value:y).
+        ]
     ].
 !
 
@@ -12756,9 +12830,9 @@
     tY := yInterval start.
 
     pixelFunction :=
-	[:x :y |
-	    aTwoArgFunction value:(x * sX + tX) value:(y * sY + tY)
-	]
+        [:x :y |
+            aTwoArgFunction value:(x * sX + tX) value:(y * sY + tY)
+        ]
 
     "
      |i|
@@ -12779,17 +12853,17 @@
 
     needSemi := false.
     aStream nextPutAll:('(%1 width:%2 height:%3'
-			    bindWith:self class name
-			    with:width
-			    with:height).
+                            bindWith:self class name
+                            with:width
+                            with:height).
 
     "/ avoiding some unneeded stuff here makes object files with many images a bit smaller.
     "/ no need for the photometric, if it's the default anyway
     photometric ~= self class defaultPhotometric ifTrue:[
-	(colorMap isNil or:[photometric ~~ #palette]) ifTrue:[
-	    aStream nextPutAll:' photometric:('. photometric storeOn:aStream. aStream nextPut:$).
+        (colorMap isNil or:[photometric ~~ #palette]) ifTrue:[
+            aStream nextPutAll:' photometric:('. photometric storeOn:aStream. aStream nextPut:$).
             needSemi := false.
-	].
+        ].
     ].
     aStream nextPut:$).
 
@@ -12797,24 +12871,24 @@
     needBPS := true.
 
     self depth == 1
-	ifTrue:[ needBPS := false ]
-	ifFalse:[
-	    ((photometric == #palette)
-		and:[ (bitsPerSample size == 1)
-		and:[ ((bitsPerSample at:1) == self depth)
-		and:[ samplesPerPixel == 1 ]]])
-	    ifTrue:[
-		needBPS := false.
-	    ].
-	].
+        ifTrue:[ needBPS := false ]
+        ifFalse:[
+            ((photometric == #palette)
+                and:[ (bitsPerSample size == 1)
+                and:[ ((bitsPerSample at:1) == self depth)
+                and:[ samplesPerPixel == 1 ]]])
+            ifTrue:[
+                needBPS := false.
+            ].
+        ].
 
     needBPS ifTrue:[
-	needSemi ifTrue:[aStream nextPutAll:';'].
-	aStream nextPutAll:' bitsPerSample:('. bitsPerSample storeOn:aStream. aStream nextPutAll:')'.
-	samplesPerPixel ~= bitsPerSample size ifTrue:[
-	    aStream nextPutAll:'; samplesPerPixel:('. samplesPerPixel storeOn:aStream. aStream nextPutAll:')'.
-	].
-	needSemi := true.
+        needSemi ifTrue:[aStream nextPutAll:';'].
+        aStream nextPutAll:' bitsPerSample:('. bitsPerSample storeOn:aStream. aStream nextPutAll:')'.
+        samplesPerPixel ~= bitsPerSample size ifTrue:[
+            aStream nextPutAll:'; samplesPerPixel:('. samplesPerPixel storeOn:aStream. aStream nextPutAll:')'.
+        ].
+        needSemi := true.
     ].
 
     "/ assert that all bits are there...
@@ -12826,25 +12900,25 @@
     aStream nextPutAll:')'.
 
     colorMap notNil ifTrue:[
-	self depth <= 8 ifTrue:[
-	    "/ cut off unused colors ...
-	    usedValues := self usedValues.
-	    colors := colorMap copyFrom:1 to:((usedValues max+1) min:colorMap size).
-
-	    colorMapArray := OrderedCollection new.
-	    colors do:[:clr| colorMapArray add:(clr redByte); add:(clr greenByte); add:(clr blueByte)].
-	    aStream cr; spaces:12; nextPutAll:'colorMapFromArray:'.
-	    colorMapArray asByteArray storeOn:aStream.
-	] ifFalse:[
-	    aStream ct; spaces:12; nextPutAll:'colorMap:('.
-	    colorMap storeOn:aStream.
-	    aStream nextPutAll:')'
-	]
+        self depth <= 8 ifTrue:[
+            "/ cut off unused colors ...
+            usedValues := self usedValues.
+            colors := colorMap copyFrom:1 to:((usedValues max+1) min:colorMap size).
+
+            colorMapArray := OrderedCollection new.
+            colors do:[:clr| colorMapArray add:(clr redByte); add:(clr greenByte); add:(clr blueByte)].
+            aStream cr; spaces:12; nextPutAll:'colorMapFromArray:'.
+            colorMapArray asByteArray storeOn:aStream.
+        ] ifFalse:[
+            aStream ct; spaces:12; nextPutAll:'colorMap:('.
+            colorMap storeOn:aStream.
+            aStream nextPutAll:')'
+        ]
     ].
     mask notNil ifTrue:[
-	aStream cr; spaces:12; nextPutAll:'mask:('.
-	mask storeOn:aStream.
-	aStream nextPutAll:')'.
+        aStream cr; spaces:12; nextPutAll:'mask:('.
+        mask storeOn:aStream.
+        aStream nextPutAll:')'.
     ].
     aStream nextPutAll:'; yourself'
 
@@ -12871,64 +12945,64 @@
     maxBitsPerPixel := 0.
 
     aDevice supportedImageFormats do:[:entry |
-	|deviceImageDepth        "{ Class: SmallInteger }"
-	 deviceImageBitsPerPixel "{ Class: SmallInteger }" |
-
-	deviceImageDepth := entry at:#depth.
-	deviceImageBitsPerPixel := entry at:#bitsPerPixel.
-
-	"/ for now, ignore all depth's which are neither 1 nor the
-	"/ devices depth.
-	"/ (actually, many devices can handle other pixMap formats,
-	"/ but I dont know (yet) how to pass the correct color info
-
-	((deviceImageDepth == 1) or:[deviceImageDepth == aDevice depth]) ifTrue:[
-
-	    deviceImageBitsPerPixel > maxBitsPerPixel ifTrue:[
-		maxInfo := entry.
+        |deviceImageDepth        "{ Class: SmallInteger }"
+         deviceImageBitsPerPixel "{ Class: SmallInteger }" |
+
+        deviceImageDepth := entry at:#depth.
+        deviceImageBitsPerPixel := entry at:#bitsPerPixel.
+
+        "/ for now, ignore all depth's which are neither 1 nor the
+        "/ devices depth.
+        "/ (actually, many devices can handle other pixMap formats,
+        "/ but I dont know (yet) how to pass the correct color info
+
+        ((deviceImageDepth == 1) or:[deviceImageDepth == aDevice depth]) ifTrue:[
+
+            deviceImageBitsPerPixel > maxBitsPerPixel ifTrue:[
+                maxInfo := entry.
     "/            maxBitsPerPixel := deviceImageBitsPerPixel.
     "/            maxDepth := deviceImageDepth.
-	    ].
-
-	    deviceImageDepth >= myDepth ifTrue:[
-		deviceImageDepth == myDepth ifTrue:[
-		    "/ take the better one ...
-		    (bestDeviceDepth isNil
-		     or:[(bestDeviceBitsPerPixel ~~ bestDeviceDepth)
-			and:[deviceImageDepth == deviceImageBitsPerPixel]]) ifTrue:[
-			bestInfo := entry.
-			bestDeviceDepth := deviceImageDepth.
-			bestDeviceBitsPerPixel := deviceImageBitsPerPixel.
-		    ]
-		] ifFalse:[
-		    "/ take the next-larger depth
-		    (bestDeviceDepth isNil
-		     or:[deviceImageBitsPerPixel < bestDeviceBitsPerPixel]) ifTrue:[
-			bestInfo := entry.
-			bestDeviceDepth := deviceImageDepth.
-			bestDeviceBitsPerPixel := deviceImageBitsPerPixel.
-		    ]
-		]
-	    ].
-	].
+            ].
+
+            deviceImageDepth >= myDepth ifTrue:[
+                deviceImageDepth == myDepth ifTrue:[
+                    "/ take the better one ...
+                    (bestDeviceDepth isNil
+                     or:[(bestDeviceBitsPerPixel ~~ bestDeviceDepth)
+                        and:[deviceImageDepth == deviceImageBitsPerPixel]]) ifTrue:[
+                        bestInfo := entry.
+                        bestDeviceDepth := deviceImageDepth.
+                        bestDeviceBitsPerPixel := deviceImageBitsPerPixel.
+                    ]
+                ] ifFalse:[
+                    "/ take the next-larger depth
+                    (bestDeviceDepth isNil
+                     or:[deviceImageBitsPerPixel < bestDeviceBitsPerPixel]) ifTrue:[
+                        bestInfo := entry.
+                        bestDeviceDepth := deviceImageDepth.
+                        bestDeviceBitsPerPixel := deviceImageBitsPerPixel.
+                    ]
+                ]
+            ].
+        ].
     ].
 
     bestDeviceDepth isNil ifTrue:[
-	maxBitsPerPixel == 0 ifTrue:[
-	    "/
-	    "/ oops - nothing appropriate
-	    "/
-	    maxInfo notNil ifTrue:[
-		^ maxInfo
-	    ].
-	    bestDeviceDepth := bestDeviceBitsPerPixel := aDevice depth.
-	    bestInfo := IdentityDictionary new.
-	    bestInfo at:#depth put:bestDeviceDepth.
-	    bestInfo at:#bitsPerPixel put:bestDeviceBitsPerPixel.
-	    bestInfo at:#padding put:32.
-	] ifFalse:[
-	    bestInfo := maxInfo.
-	]
+        maxBitsPerPixel == 0 ifTrue:[
+            "/
+            "/ oops - nothing appropriate
+            "/
+            maxInfo notNil ifTrue:[
+                ^ maxInfo
+            ].
+            bestDeviceDepth := bestDeviceBitsPerPixel := aDevice depth.
+            bestInfo := IdentityDictionary new.
+            bestInfo at:#depth put:bestDeviceDepth.
+            bestInfo at:#bitsPerPixel put:bestDeviceBitsPerPixel.
+            bestInfo at:#padding put:32.
+        ] ifFalse:[
+            bestInfo := maxInfo.
+        ]
     ].
     ^ bestInfo
 
@@ -12953,44 +13027,44 @@
     |usedColors|
 
     samplesPerPixel == 3 ifTrue:[
-	photometric := photometricOrNil ? #rgb
+        photometric := photometricOrNil ? #rgb
     ] ifFalse:[
-	photometricOrNil isNil ifTrue:[
-	    photometric := anImage photometric.
-	] ifFalse:[
-	    photometric := photometricOrNil.
-	].
-	photometric == #palette ifTrue:[
-	    self setColorMap:(anImage colorMap copy).
-	    "
-	     must generate/compress the colormap, if source image has higher depth
-	     than myself.
-	    "
-	    (colorMap isNil
-	    or:[anImage bitsPerPixel > self bitsPerPixel]) ifTrue:[
-		"
-		 get used colors are extracted into our colorMap
-		 (the at-put below will set the pixelValue according the
-		 new colorIndex
-		"
-		self setColorMap:(anImage usedColors asArray).
-		colorMap size > (1 bitShift:self bitsPerPixel) ifTrue:[
-		    'Image [warning]: possibly too many colors in image' errorPrintCR
-		]
-	    ]
-	] ifFalse:[
-	    (photometric == #blackIs0
-	    or:[ photometric == #whiteIs0 ]) ifTrue:[
-	    ] ifFalse:[
-		usedColors := anImage usedColors asArray.
-		usedColors size > (1 bitShift:self bitsPerPixel) ifTrue:[
-		    'Image [warning]: possibly too many colors in image' errorPrintCR.
-		    usedColors := usedColors copyTo:(1 bitShift:self bitsPerPixel).
-		].
-		self setColorMap:usedColors.
-		photometric := #palette
-	    ]
-	]
+        photometricOrNil isNil ifTrue:[
+            photometric := anImage photometric.
+        ] ifFalse:[
+            photometric := photometricOrNil.
+        ].
+        photometric == #palette ifTrue:[
+            self setColorMap:(anImage colorMap copy).
+            "
+             must generate/compress the colormap, if source image has higher depth
+             than myself.
+            "
+            (colorMap isNil
+            or:[anImage bitsPerPixel > self bitsPerPixel]) ifTrue:[
+                "
+                 get used colors are extracted into our colorMap
+                 (the at-put below will set the pixelValue according the
+                 new colorIndex
+                "
+                self setColorMap:(anImage usedColors asArray).
+                colorMap size > (1 bitShift:self bitsPerPixel) ifTrue:[
+                    'Image [warning]: possibly too many colors in image' errorPrintCR
+                ]
+            ]
+        ] ifFalse:[
+            (photometric == #blackIs0
+            or:[ photometric == #whiteIs0 ]) ifTrue:[
+            ] ifFalse:[
+                usedColors := anImage usedColors asArray.
+                usedColors size > (1 bitShift:self bitsPerPixel) ifTrue:[
+                    'Image [warning]: possibly too many colors in image' errorPrintCR.
+                    usedColors := usedColors copyTo:(1 bitShift:self bitsPerPixel).
+                ].
+                self setColorMap:usedColors.
+                photometric := #palette
+            ]
+        ]
     ].
 
     "Created: 20.9.1995 / 00:58:42 / claus"
@@ -13008,51 +13082,51 @@
 
     r := range.
     r == 256 ifTrue:[
-	r := 255
+        r := 255
     ].
 
     photometric == #palette ifTrue:[
-	n := colorMap size.
-	greyMap := ByteArray new:n.
-
-	1 to:n do:[:i |
-	    (clr := colorMap at:i) isNil ifTrue:[
-		"/ an unused color
-		val := 0.
-	    ] ifFalse:[
-		val := (r * clr brightness) rounded
-	    ].
-	    greyMap at:i put:val
-	].
+        n := colorMap size.
+        greyMap := ByteArray new:n.
+
+        1 to:n do:[:i |
+            (clr := colorMap at:i) isNil ifTrue:[
+                "/ an unused color
+                val := 0.
+            ] ifFalse:[
+                val := (r * clr brightness) rounded
+            ].
+            greyMap at:i put:val
+        ].
     ] ifFalse:[
-	d := self bitsPerPixel.
-	n := 1 bitShift:d.
-	n >= 4096 ifTrue:[
-	    self error:'size not supported - too large'.
-	    ^ nil
-	].
-	greyMap := ByteArray new:n.
-
-
-	photometric == #rgb ifTrue:[
-	    1 to:n do:[:i |
-		greyMap at:i put:(r * (self colorFromValue:i-1) brightness) rounded
-	    ].
-	] ifFalse:[
-	    1 to:n do:[:i |
-		greyMap at:i put:(r / (n-1) * (i-1)) rounded
-	    ].
-	    photometric == #blackIs0 ifTrue:[
-		"/ we are done
-	    ] ifFalse:[
-		photometric == #whiteIs0 ifTrue:[
-		    greyMap reverse
-		] ifFalse:[
-		    self error:'invalid format'.
-		    ^ nil
-		]
-	    ]
-	].
+        d := self bitsPerPixel.
+        n := 1 bitShift:d.
+        n >= 4096 ifTrue:[
+            self error:'size not supported - too large'.
+            ^ nil
+        ].
+        greyMap := ByteArray new:n.
+
+
+        photometric == #rgb ifTrue:[
+            1 to:n do:[:i |
+                greyMap at:i put:(r * (self colorFromValue:i-1) brightness) rounded
+            ].
+        ] ifFalse:[
+            1 to:n do:[:i |
+                greyMap at:i put:(r / (n-1) * (i-1)) rounded
+            ].
+            photometric == #blackIs0 ifTrue:[
+                "/ we are done
+            ] ifFalse:[
+                photometric == #whiteIs0 ifTrue:[
+                    greyMap reverse
+                ] ifFalse:[
+                    self error:'invalid format'.
+                    ^ nil
+                ]
+            ]
+        ].
     ].
 
     ^ greyMap
@@ -13082,47 +13156,47 @@
     d := self bitsPerPixel.
     n := 1 bitShift:d.
     n >= 4096 ifTrue:[
-	self error:'size not supported - too large'.
-	^ nil
+        self error:'size not supported - too large'.
+        ^ nil
     ].
 
     greyArray := Array new:n.
 
     photometric == #palette ifTrue:[
-	n2 := colorMap size.
-	1 to:n2 do:[:i |
-	    (clr := colorMap at:i) isNil ifTrue:[
-		"/ an unused color
-		val := 0.
-	    ] ifFalse:[
-		val := range * clr brightness
-	    ].
-	    greyArray at:i put:val
-	].
-	n2 < n ifTrue:[
-	    greyArray from:n2+1 to:n put:0
-	]
+        n2 := colorMap size.
+        1 to:n2 do:[:i |
+            (clr := colorMap at:i) isNil ifTrue:[
+                "/ an unused color
+                val := 0.
+            ] ifFalse:[
+                val := range * clr brightness
+            ].
+            greyArray at:i put:val
+        ].
+        n2 < n ifTrue:[
+            greyArray from:n2+1 to:n put:0
+        ]
     ] ifFalse:[
-	photometric == #rgb ifTrue:[
-	    1 to:n do:[:i |
-		greyArray at:i put:(range * (self colorFromValue:(i-1)) brightness)
-	    ]
-	] ifFalse:[
-	    r := range asFloat.
-	    1 to:n do:[:i |
-		greyArray at:i put:(r / (n-1) * (i-1))
-	    ].
-	    photometric == #blackIs0 ifTrue:[
-		"/ we are done
-	    ] ifFalse:[
-		photometric == #whiteIs0 ifTrue:[
-		    greyArray reverse
-		] ifFalse:[
-		    self error:'invalid format'.
-		    ^ nil
-		]
-	    ]
-	]
+        photometric == #rgb ifTrue:[
+            1 to:n do:[:i |
+                greyArray at:i put:(range * (self colorFromValue:(i-1)) brightness)
+            ]
+        ] ifFalse:[
+            r := range asFloat.
+            1 to:n do:[:i |
+                greyArray at:i put:(r / (n-1) * (i-1))
+            ].
+            photometric == #blackIs0 ifTrue:[
+                "/ we are done
+            ] ifFalse:[
+                photometric == #whiteIs0 ifTrue:[
+                    greyArray reverse
+                ] ifFalse:[
+                    self error:'invalid format'.
+                    ^ nil
+                ]
+            ]
+        ]
     ].
     ^ greyArray
 
@@ -13139,7 +13213,7 @@
 !
 
 magnifyRowFrom:srcBytes offset:srcStart
-	  into:dstBytes offset:dstStart factor:mX
+          into:dstBytes offset:dstStart factor:mX
 
     "magnify a single pixel row - can only magnify by integer factors,
      can only magnify 1,2,4,8 and 24 bit-per-pixel images. But this is done fast."
@@ -13161,19 +13235,19 @@
     f initGC.
 
     (aDevice blackpixel ~~ 0) ifTrue:[
-	"/ have to invert bits
-	f function:#copyInverted
+        "/ have to invert bits
+        f function:#copyInverted
     ].
     aDevice
-	drawBits:bits
-	depth:depth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id)
-	x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:bits
+        depth:depth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id)
+        x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "Created: 10.6.1996 / 20:10:31 / cg"
@@ -13185,7 +13259,7 @@
 
 "/    monoBits invert.
     ^ (Form width:width height:height fromArray:monoBits onDevice:aDevice)
-	colorMap:(Array with:Color black with:Color white).
+        colorMap:(Array with:Color black with:Color white).
 
     "Created: 10.6.1996 / 20:18:09 / cg"
     "Modified: 17.4.1997 / 01:07:38 / cg"
@@ -13205,15 +13279,15 @@
     f initGC.
 
     aDevice
-	drawBits:bits
-	depth:depth
-	padding:8
-	width:width height:height
-	x:0 y:0
-	into:(f id)
-	x:0 y:0
-	width:width height:height
-	with:(f gcId).
+        drawBits:bits
+        depth:depth
+        padding:8
+        width:width height:height
+        x:0 y:0
+        into:(f id)
+        x:0 y:0
+        width:width height:height
+        with:(f gcId).
     ^ f
 
     "Created: 10.6.1996 / 17:56:08 / cg"
@@ -13223,9 +13297,9 @@
 repairPhotometric
     "/ kludge: repair a 'should not happen' situation...
     photometric isNil ifTrue:[
-	(self depth == 24 and:[ bitsPerSample size == 3 ]) ifTrue:[
-	    photometric := #rgb
-	].
+        (self depth == 24 and:[ bitsPerSample size == 3 ]) ifTrue:[
+            photometric := #rgb
+        ].
     ].
 ! !
 
@@ -13241,13 +13315,13 @@
     |redBits greenBits blueBits alphaBits|
 
     samplesPerPixel >= 4 ifTrue:[
-	redBits := bitsPerSample at:1.
-	greenBits := bitsPerSample at:2.
-	blueBits := bitsPerSample at:3.
-	alphaBits := bitsPerSample at:4.
-
-	^ (pixel bitShift:(redBits + greenBits + blueBits) negated)
-	   bitAnd:(1 bitShift:alphaBits)-1
+        redBits := bitsPerSample at:1.
+        greenBits := bitsPerSample at:2.
+        blueBits := bitsPerSample at:3.
+        alphaBits := bitsPerSample at:4.
+
+        ^ (pixel bitShift:(redBits + greenBits + blueBits) negated)
+           bitAnd:(1 bitShift:alphaBits)-1
     ].
 
     self subclassResponsibility
@@ -13262,8 +13336,8 @@
     |alphaBits|
 
     samplesPerPixel >= 4 ifTrue:[
-	alphaBits := bitsPerSample at:4.
-	^ (1 bitShift:alphaBits)-1
+        alphaBits := bitsPerSample at:4.
+        ^ (1 bitShift:alphaBits)-1
     ].
 
     self subclassResponsibility
@@ -13275,11 +13349,11 @@
     |redBits greenBits blueBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	redBits := bitsPerSample at:1.
-	greenBits := bitsPerSample at:2.
-	blueBits := bitsPerSample at:3.
-
-	^ (greenBits + blueBits + redBits) negated
+        redBits := bitsPerSample at:1.
+        greenBits := bitsPerSample at:2.
+        blueBits := bitsPerSample at:3.
+
+        ^ (greenBits + blueBits + redBits) negated
     ].
 
     self subclassResponsibility
@@ -13295,7 +13369,7 @@
     "return the average color of the image.
      This usually only makes sense for textures and patterns
      (i.e. to compute shadow & light colors for viewBackgrounds).
-     Notice, that for the above purpose, it is usually ok to process
+     Notice that for the above purpose, it is usually ok to process
      a subImage - i.e. use Image>>averageColorIn: on a smaller rectangle"
 
     ^ self averageColorIn:(0@0 corner:(width-1)@(height-1))
@@ -13322,26 +13396,26 @@
 
     n := (x1 - x0 + 1) * (y1 - y0 + 1).
     mask isNil ifTrue:[
-	self colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :colorAtXY |
-	    sumRed := sumRed + colorAtXY red.
-	    sumGreen := sumGreen + colorAtXY green.
-	    sumBlue := sumBlue + colorAtXY blue.
-	].
+        self colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :colorAtXY |
+            sumRed := sumRed + colorAtXY red.
+            sumGreen := sumGreen + colorAtXY green.
+            sumBlue := sumBlue + colorAtXY blue.
+        ].
     ] ifFalse:[
-	"/ masked pixels are not counted.
-	self colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :colorAtXY |
-	    (mask pixelAtX:x y:y) == 0 ifTrue:[
-		n := n - 1.
-	    ] ifFalse:[
-		sumRed := sumRed + colorAtXY red.
-		sumGreen := sumGreen + colorAtXY green.
-		sumBlue := sumBlue + colorAtXY blue.
-	    ].
-	].
+        "/ masked pixels are not counted.
+        self colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :colorAtXY |
+            (mask pixelAtX:x y:y) == 0 ifTrue:[
+                n := n - 1.
+            ] ifFalse:[
+                sumRed := sumRed + colorAtXY red.
+                sumGreen := sumGreen + colorAtXY green.
+                sumBlue := sumBlue + colorAtXY blue.
+            ].
+        ].
     ].
     n == 0 ifTrue:[
-	"/ all masked
-	^ Color black
+        "/ all masked
+        ^ Color black
     ].
     ^ Color red:(sumRed / n) green:(sumGreen / n) blue:(sumBlue / n)
 !
@@ -13363,11 +13437,11 @@
      return the black component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 4 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmyk)
-
-	bitsPerSample = #(8 8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * (pixel bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmyk)
+
+        bitsPerSample = #(8 8 8 8) ifTrue:[
+            ^ 100.0 / 255 * (pixel bitAnd:16rFF)
+        ]
     ].
 
     self subclassResponsibility
@@ -13384,8 +13458,8 @@
     |blueBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	blueBits := bitsPerSample at:3.
-	^ pixel bitAnd:(1 bitShift:blueBits)-1
+        blueBits := bitsPerSample at:3.
+        ^ pixel bitAnd:(1 bitShift:blueBits)-1
     ].
 
     self subclassResponsibility
@@ -13403,14 +13477,14 @@
      s         "{ Class: SmallInteger }"|
 
     samplesPerPixel >= 3 ifTrue:[
-	"/ assume that the red bits are the leftMost bits
-
-	blueBits := bitsPerSample at:3.
-	blueBits == 0 ifTrue:[^ 0].
-
-	s := (1 bitShift:blueBits) - 1.
-
-	^ 100.0 / s * (pixel bitAnd:(1 bitShift:blueBits)-1)
+        "/ assume that the red bits are the leftMost bits
+
+        blueBits := bitsPerSample at:3.
+        blueBits == 0 ifTrue:[^ 0].
+
+        s := (1 bitShift:blueBits) - 1.
+
+        ^ 100.0 / s * (pixel bitAnd:(1 bitShift:blueBits)-1)
     ].
 
     self subclassResponsibility
@@ -13425,8 +13499,8 @@
     |blueBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	blueBits := bitsPerSample at:3.
-	^ (1 bitShift:blueBits)-1
+        blueBits := bitsPerSample at:3.
+        ^ (1 bitShift:blueBits)-1
     ].
 
     self subclassResponsibility
@@ -13436,7 +13510,7 @@
     "return the shift amount used with translation from pixelValues to blueBits"
 
     samplesPerPixel >= 3 ifTrue:[
-	^ 0
+        ^ 0
     ].
 
     self subclassResponsibility
@@ -13454,7 +13528,7 @@
     "return the (average) brightness of the image as number in 0..1.
      This usually only makes sense for textures and patterns
      (i.e. to compute shadow & light colors for viewBackgrounds).
-     Notice, that for the above purpose, only a subimage is inspected here"
+     Notice that for the above purpose, only a subimage is inspected here"
 
     ^ (self averageColorIn:(0@0 corner:7@7)) brightness
 
@@ -13469,7 +13543,7 @@
     bitsPerRow := width * (self bitsPerPixel).
     bytesPerRow := bitsPerRow // 8.
     ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
-	bytesPerRow := bytesPerRow + 1
+        bytesPerRow := bytesPerRow + 1
     ].
     ^ bytesPerRow
 !
@@ -13479,7 +13553,7 @@
      if scanlines are to be padded to padding-bits."
 
     ^ self class
-	bytesPerRowForWidth:width depth:(self bitsPerPixel) padding:padding
+        bytesPerRowForWidth:width depth:(self bitsPerPixel) padding:padding
 !
 
 center
@@ -13501,79 +13575,79 @@
 
     p := photometric.
     p isNil ifTrue:[
-	colorMap notNil ifTrue:[
-	    p := #palette
-	] ifFalse:[
-	    "/ 'Image [warning]: no photometric - assume greyscale' infoPrintCR
-	    p := #blackIs0
-	]
+        colorMap notNil ifTrue:[
+            p := #palette
+        ] ifFalse:[
+            "/ 'Image [warning]: no photometric - assume greyscale' infoPrintCR
+            p := #blackIs0
+        ]
     ].
 
     p == #blackIs0 ifTrue:[
-	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	^ Color gray:(pixelValue * (100 / maxPixel)).
+        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+        ^ Color gray:(pixelValue * (100 / maxPixel)).
     ].
 
     p == #whiteIs0 ifTrue:[
-	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	^ Color gray:100 - (pixelValue * (100 / maxPixel)).
+        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+        ^ Color gray:100 - (pixelValue * (100 / maxPixel)).
     ].
 
     p == #palette ifTrue:[
-	pixelValue >= colorMap size ifTrue:[
-	    ^ Color black
-	].
-	clr := colorMap at:(pixelValue + 1).
-	clr isNil ifTrue:[
-	    ^ Color black.
-	].
-	^ clr.
+        pixelValue >= colorMap size ifTrue:[
+            ^ Color black
+        ].
+        clr := colorMap at:(pixelValue + 1).
+        clr isNil ifTrue:[
+            ^ Color black.
+        ].
+        ^ clr.
     ].
 
     p == #rgb ifTrue:[
-	r := self redBitsOf:pixelValue.
-	g := self greenBitsOf:pixelValue.
-	b := self blueBitsOf:pixelValue.
-	"/ scale...
-	numRedBits := bitsPerSample at:1.
-	numGreenBits := bitsPerSample at:2.
-	numBlueBits := bitsPerSample at:3.
-	(r == 0) ifFalse:[ r := (100 / ((1 bitShift:numRedBits)-1) * r)].
-	(g == 0) ifFalse:[ g := (100 / ((1 bitShift:numGreenBits)-1) * g)].
-	(b == 0) ifFalse:[ b := (100 / ((1 bitShift:numBlueBits)-1) * b)].
-	^ Color redPercent:r greenPercent:g bluePercent:b
+        r := self redBitsOf:pixelValue.
+        g := self greenBitsOf:pixelValue.
+        b := self blueBitsOf:pixelValue.
+        "/ scale...
+        numRedBits := bitsPerSample at:1.
+        numGreenBits := bitsPerSample at:2.
+        numBlueBits := bitsPerSample at:3.
+        (r == 0) ifFalse:[ r := (100 / ((1 bitShift:numRedBits)-1) * r)].
+        (g == 0) ifFalse:[ g := (100 / ((1 bitShift:numGreenBits)-1) * g)].
+        (b == 0) ifFalse:[ b := (100 / ((1 bitShift:numBlueBits)-1) * b)].
+        ^ Color redPercent:r greenPercent:g bluePercent:b
     ].
 
     ((p == #rgba) or:[p == #argb]) ifTrue:[
-	r := self redBitsOf:pixelValue.
-	g := self greenBitsOf:pixelValue.
-	b := self blueBitsOf:pixelValue.
-	a := self alphaBitsOf:pixelValue.
-	"/ scale...
-	numRedBits := bitsPerSample at:1.
-	numGreenBits := bitsPerSample at:2.
-	numBlueBits := bitsPerSample at:3.
-	numAlphaBits := bitsPerSample at:4.
-	(r == 0) ifFalse:[ r := (100 / ((1 bitShift:numRedBits)-1) * r)].
-	(g == 0) ifFalse:[ g := (100 / ((1 bitShift:numGreenBits)-1) * g)].
-	(b == 0) ifFalse:[ b := (100 / ((1 bitShift:numBlueBits)-1) * b)].
-	(a == 0) ifFalse:[ a := (100 / ((1 bitShift:numAlphaBits)-1) * a)].
-	^ Color redPercent:r greenPercent:g bluePercent:b alphaPercent:a
+        r := self redBitsOf:pixelValue.
+        g := self greenBitsOf:pixelValue.
+        b := self blueBitsOf:pixelValue.
+        a := self alphaBitsOf:pixelValue.
+        "/ scale...
+        numRedBits := bitsPerSample at:1.
+        numGreenBits := bitsPerSample at:2.
+        numBlueBits := bitsPerSample at:3.
+        numAlphaBits := bitsPerSample at:4.
+        (r == 0) ifFalse:[ r := (100 / ((1 bitShift:numRedBits)-1) * r)].
+        (g == 0) ifFalse:[ g := (100 / ((1 bitShift:numGreenBits)-1) * g)].
+        (b == 0) ifFalse:[ b := (100 / ((1 bitShift:numBlueBits)-1) * b)].
+        (a == 0) ifFalse:[ a := (100 / ((1 bitShift:numAlphaBits)-1) * a)].
+        ^ Color redPercent:r greenPercent:g bluePercent:b alphaPercent:a
     ].
 
     p == #cmyk ifTrue:[
-	c := self cyanComponentOfCMYK:pixelValue.
-	m := self magentaComponentOfCMYK:pixelValue.
-	y := self yellowComponentOfCMYK:pixelValue.
-	k := self blackComponentOfCMYK:pixelValue.
-	^ Color cyan:c magenta:m yellow:y black:k.
+        c := self cyanComponentOfCMYK:pixelValue.
+        m := self magentaComponentOfCMYK:pixelValue.
+        y := self yellowComponentOfCMYK:pixelValue.
+        k := self blackComponentOfCMYK:pixelValue.
+        ^ Color cyan:c magenta:m yellow:y black:k.
     ].
 
     p == #cmy ifTrue:[
-	c := self cyanComponentOfCMY:pixelValue.
-	m := self magentaComponentOfCMY:pixelValue.
-	y := self yellowComponentOfCMY:pixelValue.
-	^ Color cyan:c magenta:m yellow:y.
+        c := self cyanComponentOfCMY:pixelValue.
+        m := self magentaComponentOfCMY:pixelValue.
+        y := self yellowComponentOfCMY:pixelValue.
+        ^ Color cyan:c magenta:m yellow:y.
     ].
 
     self error:'invalid (unsupported) photometric'
@@ -13587,11 +13661,11 @@
      return the cyan component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 3 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmy)
-
-	bitsPerSample = #(8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * ((pixel bitShift:-16) bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmy)
+
+        bitsPerSample = #(8 8 8) ifTrue:[
+            ^ 100.0 / 255 * ((pixel bitShift:-16) bitAnd:16rFF)
+        ]
     ].
 
     self subclassResponsibility
@@ -13603,11 +13677,11 @@
      return the cyan component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 4 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmyk)
-
-	bitsPerSample = #(8 8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * ((pixel bitShift:-24) bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmyk)
+
+        bitsPerSample = #(8 8 8 8) ifTrue:[
+            ^ 100.0 / 255 * ((pixel bitShift:-24) bitAnd:16rFF)
+        ]
     ].
 
     self subclassResponsibility
@@ -13624,10 +13698,10 @@
     |blueBits greenBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	greenBits := bitsPerSample at:2.
-	blueBits := bitsPerSample at:3.
-
-	^ (pixel bitShift:blueBits negated) bitAnd:(1 bitShift:greenBits)-1
+        greenBits := bitsPerSample at:2.
+        blueBits := bitsPerSample at:3.
+
+        ^ (pixel bitShift:blueBits negated) bitAnd:(1 bitShift:greenBits)-1
     ].
 
     self subclassResponsibility
@@ -13646,15 +13720,15 @@
      s         "{ Class: SmallInteger }"|
 
     samplesPerPixel >= 3 ifTrue:[
-	"/ assume that the red bits are the leftMost bits
-
-	greenBits := bitsPerSample at:2.
-	greenBits == 0 ifTrue:[^ 0].
-	blueBits := bitsPerSample at:3.
-
-	s := (1 bitShift:greenBits) - 1.
-
-	^ 100.0 / s * ((pixel bitShift:blueBits negated) bitAnd:(1 bitShift:greenBits)-1)
+        "/ assume that the red bits are the leftMost bits
+
+        greenBits := bitsPerSample at:2.
+        greenBits == 0 ifTrue:[^ 0].
+        blueBits := bitsPerSample at:3.
+
+        s := (1 bitShift:greenBits) - 1.
+
+        ^ 100.0 / s * ((pixel bitShift:blueBits negated) bitAnd:(1 bitShift:greenBits)-1)
     ].
 
     self subclassResponsibility
@@ -13669,8 +13743,8 @@
     |greenBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	greenBits := bitsPerSample at:2.
-	^ (1 bitShift:greenBits)-1
+        greenBits := bitsPerSample at:2.
+        ^ (1 bitShift:greenBits)-1
     ].
 
     self subclassResponsibility
@@ -13682,8 +13756,8 @@
     |greenBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	greenBits := bitsPerSample at:3.
-	^ greenBits negated
+        greenBits := bitsPerSample at:3.
+        ^ greenBits negated
     ].
 
     self subclassResponsibility
@@ -13739,11 +13813,11 @@
      return the magenta component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 3 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmy)
-
-	bitsPerSample = #(8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * ((pixel bitShift:-8) bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmy)
+
+        bitsPerSample = #(8 8 8) ifTrue:[
+            ^ 100.0 / 255 * ((pixel bitShift:-8) bitAnd:16rFF)
+        ]
     ].
 
     self subclassResponsibility
@@ -13755,11 +13829,11 @@
      return the magenta component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 4 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmyk)
-
-	bitsPerSample = #(8 8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * ((pixel bitShift:-16) bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmyk)
+
+        bitsPerSample = #(8 8 8 8) ifTrue:[
+            ^ 100.0 / 255 * ((pixel bitShift:-16) bitAnd:16rFF)
+        ]
     ].
 
     self subclassResponsibility
@@ -13787,20 +13861,20 @@
      colorArray|
 
     photometric == #palette ifTrue:[
-	^ colorMap asArray
+        ^ colorMap asArray
     ].
 
     d := self depth.
     d > 12 ifTrue:[
-	self error:'deep palette images not supported'.
-	^ nil.
+        self error:'deep palette images not supported'.
+        ^ nil.
     ].
 
     nEntries := 1 bitShift:d.
 
     colorArray := Array new:nEntries.
     1 to:nEntries do:[:idx |
-	colorArray at:idx put:(self colorFromValue:(idx-1)).
+        colorArray at:idx put:(self colorFromValue:(idx-1)).
     ].
 
     ^ colorArray
@@ -13819,7 +13893,7 @@
 
 realUsedValues
     "return a collection of color values used in the receiver.
-     Notice, that the interpretation of the pixels depends on the photometric
+     Notice that the interpretation of the pixels depends on the photometric
      of the image.
      This is a general and therefore slow implementation; subclasses
      may want to redefine this method for more performance.
@@ -13830,10 +13904,10 @@
 
     set := IdentitySet new.
     self valuesFromX:0 y:0 toX:(self width-1) y:(self height-1) do:[:x :y :pixel |
-	pixel ~~ last ifTrue:[
-	    set add:pixel.
-	    last := pixel.
-	]
+        pixel ~~ last ifTrue:[
+            set add:pixel.
+            last := pixel.
+        ]
     ].
     ^ set
 
@@ -13855,12 +13929,12 @@
     |redBits greenBits blueBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	redBits := bitsPerSample at:1.
-	greenBits := bitsPerSample at:2.
-	blueBits := bitsPerSample at:3.
-
-	^ (pixel bitShift:(greenBits + blueBits) negated)
-	   bitAnd:(1 bitShift:redBits)-1
+        redBits := bitsPerSample at:1.
+        greenBits := bitsPerSample at:2.
+        blueBits := bitsPerSample at:3.
+
+        ^ (pixel bitShift:(greenBits + blueBits) negated)
+           bitAnd:(1 bitShift:redBits)-1
     ].
 
     self subclassResponsibility
@@ -13880,19 +13954,19 @@
      s         "{ Class: SmallInteger }"|
 
     samplesPerPixel >= 3 ifTrue:[
-	"/ assume that the red bits are the leftMost bits
-
-	redBits := bitsPerSample at:1.
-	redBits == 0 ifTrue:[^ 0].
-
-	greenBits := bitsPerSample at:2.
-	blueBits := bitsPerSample at:3.
-
-	s := (1 bitShift:redBits) - 1.
-
-	^ 100.0 / s *
-	  ((pixel bitShift:(greenBits + blueBits) negated)
-	   bitAnd:(1 bitShift:redBits)-1)
+        "/ assume that the red bits are the leftMost bits
+
+        redBits := bitsPerSample at:1.
+        redBits == 0 ifTrue:[^ 0].
+
+        greenBits := bitsPerSample at:2.
+        blueBits := bitsPerSample at:3.
+
+        s := (1 bitShift:redBits) - 1.
+
+        ^ 100.0 / s *
+          ((pixel bitShift:(greenBits + blueBits) negated)
+           bitAnd:(1 bitShift:redBits)-1)
     ].
 
     self subclassResponsibility
@@ -13907,8 +13981,8 @@
     |redBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	redBits := bitsPerSample at:1.
-	^ (1 bitShift:redBits)-1
+        redBits := bitsPerSample at:1.
+        ^ (1 bitShift:redBits)-1
     ].
 
     self subclassResponsibility
@@ -13923,10 +13997,10 @@
     |greenBits blueBits|
 
     samplesPerPixel >= 3 ifTrue:[
-	greenBits := bitsPerSample at:2.
-	blueBits := bitsPerSample at:3.
-
-	^ (greenBits + blueBits) negated
+        greenBits := bitsPerSample at:2.
+        blueBits := bitsPerSample at:3.
+
+        ^ (greenBits + blueBits) negated
     ].
 
     self subclassResponsibility
@@ -13942,61 +14016,61 @@
 
     p := photometric.
     p isNil ifTrue:[
-	colorMap notNil ifTrue:[
-	    p := #palette
-	] ifFalse:[
+        colorMap notNil ifTrue:[
+            p := #palette
+        ] ifFalse:[
 "/            'Image [warning]: no photometric - assume greyscale' infoPrintCR
-	    p := #blackIs0
-	]
+            p := #blackIs0
+        ]
     ].
 
     p == #blackIs0 ifTrue:[
-	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	b := pixelValue * 255 // maxPixel.
-	^ (((b bitShift:8) bitOr:b) bitShift:8) bitOr:b
+        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+        b := pixelValue * 255 // maxPixel.
+        ^ (((b bitShift:8) bitOr:b) bitShift:8) bitOr:b
     ].
 
     p == #whiteIs0 ifTrue:[
-	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	b := 255 - (pixelValue * 255 // maxPixel).
-	^ (((b bitShift:8) bitOr:b) bitShift:8) bitOr:b
+        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+        b := 255 - (pixelValue * 255 // maxPixel).
+        ^ (((b bitShift:8) bitOr:b) bitShift:8) bitOr:b
     ].
 
     p == #palette ifTrue:[
-	pixelValue >= colorMap size ifTrue:[
-	    ^ 0 "/ black
-	].
-	clr := colorMap at:(pixelValue + 1).
-	clr isNil ifTrue:[
-	    ^ 0 "/ black
-	].
-	^ clr rgbValue.
+        pixelValue >= colorMap size ifTrue:[
+            ^ 0 "/ black
+        ].
+        clr := colorMap at:(pixelValue + 1).
+        clr isNil ifTrue:[
+            ^ 0 "/ black
+        ].
+        ^ clr rgbValue.
     ].
 
     p == #rgb ifTrue:[
-	r := self redBitsOf:pixelValue.
-	g := self greenBitsOf:pixelValue.
-	b := self blueBitsOf:pixelValue.
-	"/ must scale to byte value...
-	r := r bitShift:(8 - (bitsPerSample at:1)).
-	g := g bitShift:(8 - (bitsPerSample at:2)).
-	b := b bitShift:(8 - (bitsPerSample at:3)).
-	^ (((r bitShift:8) bitOr:g) bitShift:8) bitOr:b
+        r := self redBitsOf:pixelValue.
+        g := self greenBitsOf:pixelValue.
+        b := self blueBitsOf:pixelValue.
+        "/ must scale to byte value...
+        r := r bitShift:(8 - (bitsPerSample at:1)).
+        g := g bitShift:(8 - (bitsPerSample at:2)).
+        b := b bitShift:(8 - (bitsPerSample at:3)).
+        ^ (((r bitShift:8) bitOr:g) bitShift:8) bitOr:b
     ].
 
     p == #cmyk ifTrue:[
-	c := self cyanComponentOfCMYK:pixelValue.
-	m := self magentaComponentOfCMYK:pixelValue.
-	y := self yellowComponentOfCMYK:pixelValue.
-	k := self blackComponentOfCMYK:pixelValue.
-	^ (Color cyan:c magenta:m yellow:y black:k) rgbValue.
+        c := self cyanComponentOfCMYK:pixelValue.
+        m := self magentaComponentOfCMYK:pixelValue.
+        y := self yellowComponentOfCMYK:pixelValue.
+        k := self blackComponentOfCMYK:pixelValue.
+        ^ (Color cyan:c magenta:m yellow:y black:k) rgbValue.
     ].
 
     p == #cmy ifTrue:[
-	c := self cyanComponentOfCMY:pixelValue.
-	m := self magentaComponentOfCMY:pixelValue.
-	y := self yellowComponentOfCMY:pixelValue.
-	^ (Color cyan:c magenta:m yellow:y) rgbValue.
+        c := self cyanComponentOfCMY:pixelValue.
+        m := self magentaComponentOfCMY:pixelValue.
+        y := self yellowComponentOfCMY:pixelValue.
+        ^ (Color cyan:c magenta:m yellow:y) rgbValue.
     ].
 
     self error:'invalid (unsupported) photometric'
@@ -14011,7 +14085,7 @@
 
     colors := self usedColorsMax:4096.
     colors isNil ifTrue:[
-	self error:'too many colors in image'.
+        self error:'too many colors in image'.
     ].
     ^ colors
 
@@ -14033,39 +14107,39 @@
     |usedValues max colors|
 
     photometric == #rgb ifTrue:[
-	usedValues := IdentitySet new.
-	self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
-	  do:[:x :y :pixel |
-	    usedValues add:pixel.
-	    usedValues size > nMax ifTrue:[
-		"/ too many to be returned here (think of the mass of
-		"/ data to be returned by a 24bit image ... ;-)
-		^ nil
-	    ]
-	].
-	"/ code below is slightly faster ...
-	"/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
-	colors := usedValues collect:[:pixel | |r g b|
-					r := self redBitsOf:pixel.
-					g := self greenBitsOf:pixel.
-					b := self blueBitsOf:pixel.
-					"/ must scale to byte value...
-					r := r bitShift:(8 - (bitsPerSample at:1)).
-					g := g bitShift:(8 - (bitsPerSample at:2)).
-					b := b bitShift:(8 - (bitsPerSample at:3)).
-					Color redByte:r greenByte:g blueByte:b
-				     ].
-	^ colors.
+        usedValues := IdentitySet new.
+        self valuesFromX:0 y:0 toX:(width-1) y:(height-1)
+          do:[:x :y :pixel |
+            usedValues add:pixel.
+            usedValues size > nMax ifTrue:[
+                "/ too many to be returned here (think of the mass of
+                "/ data to be returned by a 24bit image ... ;-)
+                ^ nil
+            ]
+        ].
+        "/ code below is slightly faster ...
+        "/ colors := usedValues collect:[:pixel | self colorFromValue:pixel].
+        colors := usedValues collect:[:pixel | |r g b|
+                                        r := self redBitsOf:pixel.
+                                        g := self greenBitsOf:pixel.
+                                        b := self blueBitsOf:pixel.
+                                        "/ must scale to byte value...
+                                        r := r bitShift:(8 - (bitsPerSample at:1)).
+                                        g := g bitShift:(8 - (bitsPerSample at:2)).
+                                        b := b bitShift:(8 - (bitsPerSample at:3)).
+                                        Color redByte:r greenByte:g blueByte:b
+                                     ].
+        ^ colors.
     ].
 
     usedValues := self usedValues asArray.
     photometric == #palette ifTrue:[
-	colors := usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])] as:Set.
+        colors := usedValues collect:[:val | (colorMap at:val+1 ifAbsent:[Color black])] as:Set.
     ] ifFalse:[
-	"/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
-
-	max := (1 bitShift:self depth) - 1.
-	colors :=  usedValues collect:[:val | (Color gray:(100 * val / max ))] as:Set.
+        "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
+
+        max := (1 bitShift:self depth) - 1.
+        colors :=  usedValues collect:[:val | (Color gray:(100 * val / max ))] as:Set.
     ].
     ^ colors
 
@@ -14080,7 +14154,7 @@
 
 usedValues
     "return a collection of color values used in the receiver.
-     Notice, that the interpretation of the pixels depends on the photometric
+     Notice that the interpretation of the pixels depends on the photometric
      of the image.
      This is a general and therefore slow implementation; subclasses
      may want to redefine this method for more performance."
@@ -14102,71 +14176,71 @@
     |pixel maxPixel redBits greenBits blueBits alphaBits r g b a|
 
     color colorId notNil ifTrue:[
-	color == Color noColor ifTrue:[
-	    ^ nil "/ mask
-	].
-	color device isNil ifTrue:[
-	    ^ color colorId
-	]
+        color == Color noColor ifTrue:[
+            ^ nil "/ mask
+        ].
+        color device isNil ifTrue:[
+            ^ color colorId
+        ]
     ].
 
     photometric == #whiteIs0 ifTrue:[
-	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	^ maxPixel - (color brightness * maxPixel) rounded.
+        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+        ^ maxPixel - (color brightness * maxPixel) rounded.
     ].
 
     photometric == #blackIs0 ifTrue:[
-	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	^ (color brightness * maxPixel) rounded.
+        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+        ^ (color brightness * maxPixel) rounded.
     ].
 
     photometric == #palette ifTrue:[
-	colorMap isNil ifTrue:[
-	    "/ same as blackIs0
-	    maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-	    ^ (color brightness * maxPixel) rounded.
-	].
-
-	pixel := colorMap indexOf:color.
-	pixel == 0 ifTrue:[
-	    "
-	     the color is not in the images colormap
-	    "
-	    ^ nil
-	].
-	^ pixel - 1
+        colorMap isNil ifTrue:[
+            "/ same as blackIs0
+            maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+            ^ (color brightness * maxPixel) rounded.
+        ].
+
+        pixel := colorMap indexOf:color.
+        pixel == 0 ifTrue:[
+            "
+             the color is not in the images colormap
+            "
+            ^ nil
+        ].
+        ^ pixel - 1
     ].
 
     photometric == #rgb ifTrue:[
-	samplesPerPixel >= 3 ifTrue:[
-	    redBits := bitsPerSample at:1.
-	    greenBits := bitsPerSample at:2.
-	    blueBits := bitsPerSample at:3.
-
-	    "/ map r/g/b to 0..255
-	    r := (color red / 100.0 * ((1 bitShift:redBits)-1)) rounded.
-	    g := (color green / 100.0 * ((1 bitShift:greenBits)-1)) rounded.
-	    b := (color blue / 100.0 * ((1 bitShift:blueBits)-1)) rounded.
-	    pixel := (((r bitShift:greenBits) + g) bitShift:blueBits) + b.
-	    ^ pixel
-	]
+        samplesPerPixel >= 3 ifTrue:[
+            redBits := bitsPerSample at:1.
+            greenBits := bitsPerSample at:2.
+            blueBits := bitsPerSample at:3.
+
+            "/ map r/g/b to 0..255
+            r := (color red / 100.0 * ((1 bitShift:redBits)-1)) rounded.
+            g := (color green / 100.0 * ((1 bitShift:greenBits)-1)) rounded.
+            b := (color blue / 100.0 * ((1 bitShift:blueBits)-1)) rounded.
+            pixel := (((r bitShift:greenBits) + g) bitShift:blueBits) + b.
+            ^ pixel
+        ]
     ].
 
     photometric == #rgba ifTrue:[
-	samplesPerPixel >= 4 ifTrue:[
-	    redBits := bitsPerSample at:1.
-	    greenBits := bitsPerSample at:2.
-	    blueBits := bitsPerSample at:3.
-	    alphaBits := bitsPerSample at:4.
-
-	    "/ map r/g/b/a to 0..255
-	    r := (color red / 100.0 * ((1 bitShift:redBits)-1)) rounded.
-	    g := (color green / 100.0 * ((1 bitShift:greenBits)-1)) rounded.
-	    b := (color blue / 100.0 * ((1 bitShift:blueBits)-1)) rounded.
-	    a := (color alpha * ((1 bitShift:alphaBits)-1)) rounded.
-	    pixel := (((((a bitShift:redBits) + r) bitShift:greenBits) + g) bitShift:blueBits) + b.
-	    ^ pixel
-	]
+        samplesPerPixel >= 4 ifTrue:[
+            redBits := bitsPerSample at:1.
+            greenBits := bitsPerSample at:2.
+            blueBits := bitsPerSample at:3.
+            alphaBits := bitsPerSample at:4.
+
+            "/ map r/g/b/a to 0..255
+            r := (color red / 100.0 * ((1 bitShift:redBits)-1)) rounded.
+            g := (color green / 100.0 * ((1 bitShift:greenBits)-1)) rounded.
+            b := (color blue / 100.0 * ((1 bitShift:blueBits)-1)) rounded.
+            a := (color alpha * ((1 bitShift:alphaBits)-1)) rounded.
+            pixel := (((((a bitShift:redBits) + r) bitShift:greenBits) + g) bitShift:blueBits) + b.
+            ^ pixel
+        ]
     ].
     ImageErrorSignal raiseErrorString:'format not supported'.
     ^ nil
@@ -14213,26 +14287,26 @@
 "/    ].
 
     photometric == #rgb ifTrue:[
-	samplesPerPixel >= 3 ifTrue:[
-	    "/ r,g,b  b at low end
-	    redBits := bitsPerSample at:1.
-	    greenBits := bitsPerSample at:2.
-	    blueBits := bitsPerSample at:3.
-	    pixel := (((r bitShift:greenBits) + g) bitShift:blueBits) + b.
-	    ^ pixel
-	]
+        samplesPerPixel >= 3 ifTrue:[
+            "/ r,g,b  b at low end
+            redBits := bitsPerSample at:1.
+            greenBits := bitsPerSample at:2.
+            blueBits := bitsPerSample at:3.
+            pixel := (((r bitShift:greenBits) + g) bitShift:blueBits) + b.
+            ^ pixel
+        ]
     ].
 
     photometric == #rgba ifTrue:[
-	samplesPerPixel >= 4 ifTrue:[
-	    "/ a,r,g,b  b at low end
-	    redBits := bitsPerSample at:1.
-	    greenBits := bitsPerSample at:2.
-	    blueBits := bitsPerSample at:3.
-	    alphaBits := bitsPerSample at:4.
-	    pixel := (((((a bitShift:redBits) + r) bitShift:greenBits) + g) bitShift:blueBits) + b.
-	    ^ pixel
-	]
+        samplesPerPixel >= 4 ifTrue:[
+            "/ a,r,g,b  b at low end
+            redBits := bitsPerSample at:1.
+            greenBits := bitsPerSample at:2.
+            blueBits := bitsPerSample at:3.
+            alphaBits := bitsPerSample at:4.
+            pixel := (((((a bitShift:redBits) + r) bitShift:greenBits) + g) bitShift:blueBits) + b.
+            ^ pixel
+        ]
     ].
     ImageErrorSignal raiseErrorString:'format not supported'.
     ^ nil
@@ -14248,13 +14322,13 @@
     |pixel numGreenBits numBlueBits|
 
     photometric == #rgb ifTrue:[
-	samplesPerPixel >= 3 ifTrue:[
-	    numGreenBits := bitsPerSample at:2.
-	    numBlueBits := bitsPerSample at:3.
-
-	    pixel := (((redBits bitShift:numGreenBits) + greenBits) bitShift:numBlueBits) + blueBits.
-	    ^ pixel
-	]
+        samplesPerPixel >= 3 ifTrue:[
+            numGreenBits := bitsPerSample at:2.
+            numBlueBits := bitsPerSample at:3.
+
+            pixel := (((redBits bitShift:numGreenBits) + greenBits) bitShift:numBlueBits) + blueBits.
+            ^ pixel
+        ]
     ].
 
     ImageErrorSignal raiseErrorString:'format not supported'.
@@ -14279,11 +14353,11 @@
      return the yellow component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 3 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmy)
-
-	bitsPerSample = #(8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * (pixel bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmy)
+
+        bitsPerSample = #(8 8 8) ifTrue:[
+            ^ 100.0 / 255 * (pixel bitAnd:16rFF)
+        ]
     ].
 
 
@@ -14296,11 +14370,11 @@
      return the yellow component scaled to a percentage (0 .. 100) of a pixelValue."
 
     samplesPerPixel == 4 ifTrue:[
-	"/ assume that the cyan bits are the leftMost bits (cmyk)
-
-	bitsPerSample = #(8 8 8 8) ifTrue:[
-	    ^ 100.0 / 255 * ((pixel bitShift:-8) bitAnd:16rFF)
-	]
+        "/ assume that the cyan bits are the leftMost bits (cmyk)
+
+        bitsPerSample = #(8 8 8 8) ifTrue:[
+            ^ 100.0 / 255 * ((pixel bitShift:-8) bitAnd:16rFF)
+        ]
     ].
 
     self subclassResponsibility
@@ -14345,12 +14419,12 @@
     suffix := aFileName asFilename suffix.
     readerClass := MIMETypes imageReaderForSuffix:suffix.
     readerClass isNil ifTrue:[
-	"/
-	"/ no known extension - could ask user for the format here.
-	"/ currently default to tiff format.
-	"/
-	readerClass := self class defaultImageFileWriter.
-	'Image [warning]: unknown extension - cannot figure out format - using default (',readerClass name,')' errorPrintCR.
+        "/
+        "/ no known extension - could ask user for the format here.
+        "/ currently default to tiff format.
+        "/
+        readerClass := self class defaultImageFileWriter.
+        'Image [warning]: unknown extension - cannot figure out format - using default (',readerClass name,')' errorPrintCR.
     ].
     ^ self saveOn:aFileName quality:qualityPercentOrNil using:readerClass
 
@@ -14394,9 +14468,9 @@
 
      anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      Image cannotRepresentImageSignal handle:[:ex |
-	self warn:'cannot save the image in this format'
+        self warn:'cannot save the image in this format'
      ] do:[
-	anImage saveOn:'myImage.xbm' using:XBMReader.
+        anImage saveOn:'myImage.xbm' using:XBMReader.
      ]
     "
 
@@ -14446,9 +14520,9 @@
 
      anImage := Image fromFile:'goodies/bitmaps/gifImages/garfield.gif'.
      Image cannotRepresentImageSignal handle:[:ex |
-	self warn:'cannot save the image in this format'
+        self warn:'cannot save the image in this format'
      ] do:[
-	anImage saveOn:'myImage.xbm' using:XBMReader.
+        anImage saveOn:'myImage.xbm' using:XBMReader.
      ]
     "
 
@@ -14517,63 +14591,63 @@
     device := aDrawable graphicsDevice.
 
     (aDrawable isForm and:[aDrawable depth == 1]) ifTrue:[
-	"/ a monochrome bitmap ?
-	visType := #StaticGray.
-	ddepth := 1.
+        "/ a monochrome bitmap ?
+        visType := #StaticGray.
+        ddepth := 1.
     ] ifFalse:[
-	(aDrawable isForm) ifFalse:[
-	    "
-	     get some attributes of the display device
-	    "
-	    visType := device visualType.
-	    ddepth := device depth.
-	] ifTrue:[
-	    visType := aDrawable photometric.
-	    ddepth := aDrawable depth.
-	].
+        (aDrawable isForm) ifFalse:[
+            "
+             get some attributes of the display device
+            "
+            visType := device visualType.
+            ddepth := device depth.
+        ] ifTrue:[
+            visType := aDrawable photometric.
+            ddepth := aDrawable depth.
+        ].
     ].
 
     "/ kludge for 15bit XFree server
     ddepth == 15 ifTrue:[
-	ddepth := 16
+        ddepth := 16
     ].
 
     aDrawable isForm ifTrue:[
-	photometric := aDrawable photometric.
-	samplesPerPixel := ddepth == 24 ifTrue:3 ifFalse:1.
-	bitsPerSample := ddepth == 24 ifTrue:#[8 8 8 ] ifFalse:[ByteArray with:bpp].
+        photometric := aDrawable photometric.
+        samplesPerPixel := ddepth == 24 ifTrue:3 ifFalse:1.
+        bitsPerSample := ddepth == 24 ifTrue:#[8 8 8 ] ifFalse:[ByteArray with:bpp].
     ] ifFalse:[
-	(visType == #StaticGray) ifTrue:[
-	    (device blackpixel == 0) ifTrue:[
-		photometric := #blackIs0
-	    ] ifFalse:[
-		photometric := #whiteIs0
-	    ].
-	    samplesPerPixel := 1.
-	    bpp := "bitsPerPixel :=" ddepth.
-	    bitsPerSample := ByteArray with:bpp.
-	] ifFalse:[
-	    ((visType == #PseudoColor) or:[(visType == #StaticColor) or:[visType == #GrayScale]]) ifTrue:[
-		photometric := #palette.
-		samplesPerPixel := 1.
-		bpp := "bitsPerPixel :=" ddepth.
-		bitsPerSample := ByteArray with:bpp.
-	    ] ifFalse:[
-		((visType == #TrueColor) or:[visType == #DirectColor]) ifTrue:[
-		    photometric := #rgb.
-		    samplesPerPixel := 3.
+        (visType == #StaticGray) ifTrue:[
+            (device blackpixel == 0) ifTrue:[
+                photometric := #blackIs0
+            ] ifFalse:[
+                photometric := #whiteIs0
+            ].
+            samplesPerPixel := 1.
+            bpp := "bitsPerPixel :=" ddepth.
+            bitsPerSample := ByteArray with:bpp.
+        ] ifFalse:[
+            ((visType == #PseudoColor) or:[(visType == #StaticColor) or:[visType == #GrayScale]]) ifTrue:[
+                photometric := #palette.
+                samplesPerPixel := 1.
+                bpp := "bitsPerPixel :=" ddepth.
+                bitsPerSample := ByteArray with:bpp.
+            ] ifFalse:[
+                ((visType == #TrueColor) or:[visType == #DirectColor]) ifTrue:[
+                    photometric := #rgb.
+                    samplesPerPixel := 3.
     "/                bpp := "bitsPerPixel :=" depth.
     "/                bitsPerSample := ByteArray with:device bitsRed
     "/                                       with:device bitsGreen
     "/                                       with:device bitsBlue
-		    bpp := "bitsPerPixel :=" 24.
-		    bitsPerSample := #(8 8 8).
-		] ifFalse:[
-		    self error:'screen visual not supported'.
-		    ^ nil
-		]
-	    ]
-	].
+                    bpp := "bitsPerPixel :=" 24.
+                    bitsPerSample := #(8 8 8).
+                ] ifFalse:[
+                    self error:'screen visual not supported'.
+                    ^ nil
+                ]
+            ]
+        ].
     ].
 
     "
@@ -14591,13 +14665,13 @@
     "
     spaceBitsPerPixel := bpp.
     (bpp > 8) ifTrue:[
-	spaceBitsPerPixel := 16.
-	(bpp > 16) ifTrue:[
-	    spaceBitsPerPixel := 32.
-	    (bpp > 32) ifTrue:[
-		spaceBitsPerPixel := bpp.
-	    ]
-	]
+        spaceBitsPerPixel := 16.
+        (bpp > 16) ifTrue:[
+            spaceBitsPerPixel := 32.
+            (bpp > 32) ifTrue:[
+                spaceBitsPerPixel := bpp.
+            ]
+        ]
     ].
 
     bytesPerLine := (w * spaceBitsPerPixel + 31) // 32 * 4.
@@ -14608,19 +14682,19 @@
      get the pixels
     "
     aDrawable isForm ifTrue:[
-	(aDrawable id isNil and:[aDrawable bits notNil]) ifTrue:[
-	    info := Dictionary new
-			at:#bitsPerPixel put:(aDrawable depth);
-			at:#byteOrder put:#msbFirst;
-			at:#bitOrder put:#msbFirst;
-			at:#bytesPerLine put:(aDrawable width * aDrawable depth + 7)//8;
-			yourself.
-	    inData := aDrawable bits.
-	] ifFalse:[
-	    info := device getBitsFromPixmapId:aDrawable id x:x y:y width:w height:h into:inData.
-	]
+        (aDrawable id isNil and:[aDrawable bits notNil]) ifTrue:[
+            info := Dictionary new
+                        at:#bitsPerPixel put:(aDrawable depth);
+                        at:#byteOrder put:#msbFirst;
+                        at:#bitOrder put:#msbFirst;
+                        at:#bytesPerLine put:(aDrawable width * aDrawable depth + 7)//8;
+                        yourself.
+            inData := aDrawable bits.
+        ] ifFalse:[
+            info := device getBitsFromPixmapId:aDrawable id x:x y:y width:w height:h into:inData.
+        ]
     ] ifFalse:[
-	info := device getBitsFromViewId:aDrawable id x:x y:y width:w height:h into:inData.
+        info := device getBitsFromViewId:aDrawable id x:x y:y width:w height:h into:inData.
     ].
 
     bitsPerPixelIn := info at:#bitsPerPixel.
@@ -14633,15 +14707,15 @@
     "/ mhmh - that's not needed
 
     bitsPerPixelIn < 8 ifTrue:[
-	bitOrder := info at:#bitOrder.
-	bitOrder ~~ #msbFirst ifTrue:[
-	    inData
-		expandPixels:8
-		width:(inData size)
-		height:1
-		into:inData
-		mapping:(ImageReader reverseBits "TODO: reverseBitsForDepth:bitsPerPixelIn").
-	].
+        bitOrder := info at:#bitOrder.
+        bitOrder ~~ #msbFirst ifTrue:[
+            inData
+                expandPixels:8
+                width:(inData size)
+                height:1
+                into:inData
+                mapping:(ImageReader reverseBits "TODO: reverseBitsForDepth:bitsPerPixelIn").
+        ].
     ].
 
     "
@@ -14657,108 +14731,108 @@
 
     ((bytesPerLine ~~ bytesPerLineIn)
     or:[bitsPerPixelIn ~~ bpp]) ifTrue:[
-	tmpData := inData.
-	inData := ByteArray uninitializedNew:(bytesPerLine * height).
-
-	srcRow := 1.
-	dstRow := 1.
-
-	bitsPerPixelIn ~~ bpp ifTrue:[
-	    "/ for now, only 32 -> 24 is supported
-
-	    maskR == 0 ifTrue:[
-		bitsR := device bitsRed.
-		bitsG := device bitsGreen.
-		bitsB := device bitsBlue.
-		maskR := (1 bitShift:bitsR) - 1.
-		maskG := (1 bitShift:bitsG) - 1.
-		maskB := (1 bitShift:bitsB) - 1.
-		shR := device shiftRed negated.
-		shG := device shiftGreen negated.
-		shB := device shiftBlue negated.
-	    ] ifFalse:[
-		shR := (maskR lowBit - 1) negated.
-		bitsR := maskR highBit - maskR lowBit + 1.
-		maskR := maskR bitShift:shR.
-		shG := (maskG lowBit - 1) negated.
-		bitsG := maskG highBit - maskG lowBit + 1.
-		maskG := maskG bitShift:shG.
-		shB := (maskB lowBit - 1) negated.
-		bitsB := maskB highBit - maskB lowBit + 1.
-		maskB := maskB bitShift:shB.
-	    ].
-	    shR2 := (8 - bitsR).
-	    shG2 := (8 - bitsG).
-	    shB2 := (8 - bitsB).
-
-	    ((bitsPerPixelIn == 32) and:[bpp == 24]) ifTrue:[
-		"/ 'reformatting 32->24...' printNL.
-		1 to:h do:[:hi |
-		    srcIndex := srcRow.
-		    dstIndex := dstRow.
-
-		    1 to:w do:[:wi |
-			lword := tmpData unsignedInt32At:srcIndex MSB:isMSB.
-			r := (lword bitShift:shR) bitAnd:maskR.
-			g := (lword bitShift:shG) bitAnd:maskG.
-			b := (lword bitShift:shB) bitAnd:maskB.
-
-			inData at:dstIndex   put:r.
-			inData at:dstIndex+1 put:g.
-			inData at:dstIndex+2 put:b.
-			srcIndex := srcIndex + 4.
-			dstIndex := dstIndex + 3.
-		    ].
-		    dstRow := dstRow + bytesPerLine.
-		    srcRow := srcRow + bytesPerLineIn
-		]
-	    ] ifFalse:[
-		((bitsPerPixelIn == 16) and:[bpp == 24]) ifTrue:[
-		    "/ 'reformatting 16->24...' printNL.
-		    1 to:h do:[:hi |
-			srcIndex := srcRow.
-			dstIndex := dstRow.
-
-			1 to:w do:[:wi |
-			    word := tmpData unsignedInt16At:srcIndex MSB:isMSB.
-			    r := (word bitShift:shR) bitAnd:maskR.
-			    g := (word bitShift:shG) bitAnd:maskG.
-			    b := (word bitShift:shB) bitAnd:maskB.
-
-			    inData at:dstIndex   put:(r bitShift:shR2).
-			    inData at:dstIndex+1 put:(g bitShift:shG2).
-			    inData at:dstIndex+2 put:(b bitShift:shB2).
-
-			    srcIndex := srcIndex + 2.
-			    dstIndex := dstIndex + 3.
-			].
-			dstRow := dstRow + bytesPerLine.
-			srcRow := srcRow + bytesPerLineIn
-		    ]
-		] ifFalse:[
-		    ('Image [warning]: unsupported depth combination: ' , bitsPerPixelIn printString , ' -> ' ,
-							bpp printString) errorPrintCR.
-		    self shouldImplement.
-		    ^ nil
-		]
-	    ].
-	] ifFalse:[
-	    "/
-	    "/ repad in the buffer
-	    "/
-	    1 to:h do:[:hi |
-		inData replaceFrom:dstRow to:(dstRow + bytesPerLine - 1)
-			      with:tmpData startingAt:srcRow.
-		dstRow := dstRow + bytesPerLine.
-		srcRow := srcRow + bytesPerLineIn
-	    ]
-	]
+        tmpData := inData.
+        inData := ByteArray uninitializedNew:(bytesPerLine * height).
+
+        srcRow := 1.
+        dstRow := 1.
+
+        bitsPerPixelIn ~~ bpp ifTrue:[
+            "/ for now, only 32 -> 24 is supported
+
+            maskR == 0 ifTrue:[
+                bitsR := device bitsRed.
+                bitsG := device bitsGreen.
+                bitsB := device bitsBlue.
+                maskR := (1 bitShift:bitsR) - 1.
+                maskG := (1 bitShift:bitsG) - 1.
+                maskB := (1 bitShift:bitsB) - 1.
+                shR := device shiftRed negated.
+                shG := device shiftGreen negated.
+                shB := device shiftBlue negated.
+            ] ifFalse:[
+                shR := (maskR lowBit - 1) negated.
+                bitsR := maskR highBit - maskR lowBit + 1.
+                maskR := maskR bitShift:shR.
+                shG := (maskG lowBit - 1) negated.
+                bitsG := maskG highBit - maskG lowBit + 1.
+                maskG := maskG bitShift:shG.
+                shB := (maskB lowBit - 1) negated.
+                bitsB := maskB highBit - maskB lowBit + 1.
+                maskB := maskB bitShift:shB.
+            ].
+            shR2 := (8 - bitsR).
+            shG2 := (8 - bitsG).
+            shB2 := (8 - bitsB).
+
+            ((bitsPerPixelIn == 32) and:[bpp == 24]) ifTrue:[
+                "/ 'reformatting 32->24...' printNL.
+                1 to:h do:[:hi |
+                    srcIndex := srcRow.
+                    dstIndex := dstRow.
+
+                    1 to:w do:[:wi |
+                        lword := tmpData unsignedInt32At:srcIndex MSB:isMSB.
+                        r := (lword bitShift:shR) bitAnd:maskR.
+                        g := (lword bitShift:shG) bitAnd:maskG.
+                        b := (lword bitShift:shB) bitAnd:maskB.
+
+                        inData at:dstIndex   put:r.
+                        inData at:dstIndex+1 put:g.
+                        inData at:dstIndex+2 put:b.
+                        srcIndex := srcIndex + 4.
+                        dstIndex := dstIndex + 3.
+                    ].
+                    dstRow := dstRow + bytesPerLine.
+                    srcRow := srcRow + bytesPerLineIn
+                ]
+            ] ifFalse:[
+                ((bitsPerPixelIn == 16) and:[bpp == 24]) ifTrue:[
+                    "/ 'reformatting 16->24...' printNL.
+                    1 to:h do:[:hi |
+                        srcIndex := srcRow.
+                        dstIndex := dstRow.
+
+                        1 to:w do:[:wi |
+                            word := tmpData unsignedInt16At:srcIndex MSB:isMSB.
+                            r := (word bitShift:shR) bitAnd:maskR.
+                            g := (word bitShift:shG) bitAnd:maskG.
+                            b := (word bitShift:shB) bitAnd:maskB.
+
+                            inData at:dstIndex   put:(r bitShift:shR2).
+                            inData at:dstIndex+1 put:(g bitShift:shG2).
+                            inData at:dstIndex+2 put:(b bitShift:shB2).
+
+                            srcIndex := srcIndex + 2.
+                            dstIndex := dstIndex + 3.
+                        ].
+                        dstRow := dstRow + bytesPerLine.
+                        srcRow := srcRow + bytesPerLineIn
+                    ]
+                ] ifFalse:[
+                    ('Image [warning]: unsupported depth combination: ' , bitsPerPixelIn printString , ' -> ' ,
+                                                        bpp printString) errorPrintCR.
+                    self shouldImplement.
+                    ^ nil
+                ]
+            ].
+        ] ifFalse:[
+            "/
+            "/ repad in the buffer
+            "/
+            1 to:h do:[:hi |
+                inData replaceFrom:dstRow to:(dstRow + bytesPerLine - 1)
+                              with:tmpData startingAt:srcRow.
+                dstRow := dstRow + bytesPerLine.
+                srcRow := srcRow + bytesPerLineIn
+            ]
+        ]
     ] ifFalse:[
-	(bytesPerLine * height) ~~ inData size ifTrue:[
-	    tmpData := inData.
-	    inData := ByteArray uninitializedNew:(bytesPerLine * height).
-	    inData replaceFrom:1 to:bytesPerLine * height with:tmpData startingAt:1
-	]
+        (bytesPerLine * height) ~~ inData size ifTrue:[
+            tmpData := inData.
+            inData := ByteArray uninitializedNew:(bytesPerLine * height).
+            inData replaceFrom:1 to:bytesPerLine * height with:tmpData startingAt:1
+        ]
     ].
     self bits:inData.
 
@@ -14766,26 +14840,26 @@
     "/  if not #palette we are done, the pixel values are the rgb/grey values
     "/
     photometric == #palette ifTrue:[
-	"/
-	"/ what we now have are the color numbers - still need the r/g/b values.
-	"/ find out, which colors are in the picture
-	"/
-	usedPixels := inData usedValues.
-	mapSize := usedPixels max + 1.
-
-	"get the palette"
-	map := Array new:mapSize.
-	usedPixels do:[:colorIndex |
-	    |i|
-
-	    i := colorIndex + 1.
-	    device
-		getRGBFrom:colorIndex
-		into:[:r :g :b |
-		    map at:i put:(Color red:r green:g blue:b)
-		]
-	].
-	self setColorMap:map.
+        "/
+        "/ what we now have are the color numbers - still need the r/g/b values.
+        "/ find out, which colors are in the picture
+        "/
+        usedPixels := inData usedValues.
+        mapSize := usedPixels max + 1.
+
+        "get the palette"
+        map := Array new:mapSize.
+        usedPixels do:[:colorIndex |
+            |i|
+
+            i := colorIndex + 1.
+            device
+                getRGBFrom:colorIndex
+                into:[:r :g :b |
+                    map at:i put:(Color red:r green:g blue:b)
+                ]
+        ].
+        self setColorMap:map.
     ].
 
     "Modified: / 9.1.1998 / 21:32:36 / stefan"
@@ -14795,13 +14869,13 @@
 fromScreen:aRectangle
     "read an image from the display screen.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     ^ self
-	fromScreen:aRectangle
-	on:Screen current
-	grab:true
+        fromScreen:aRectangle
+        on:Screen current
+        grab:true
 
     "Modified: 26.3.1997 / 10:43:34 / cg"
 !
@@ -14813,13 +14887,13 @@
      (especially True- and DirectColor may be wrong).
      Late note: 24bit rgb now also works.
      WARNING: this temporarily grabs the display
-	      it may not work from within a buttonMotion
-	      (use #fromScreen:on:grab: with a false grabArg then)."
+              it may not work from within a buttonMotion
+              (use #fromScreen:on:grab: with a false grabArg then)."
 
     ^ self
-	fromScreen:aRectangle
-	on:aDevice
-	grab:true
+        fromScreen:aRectangle
+        on:aDevice
+        grab:true
 
     "
      Image fromScreen:((0 @ 0) corner:(100 @ 100)) on:Display
@@ -14839,8 +14913,8 @@
      (especially True- and DirectColor may be wrong).
      Late note: 24bit rgb now also works.
      WARNING: with doGrab true, this temporarily grabs the display
-	      and it may not work from within a buttonMotion
-	      (use with a false grabArg then)."
+              and it may not work from within a buttonMotion
+              (use with a false grabArg then)."
 
     |curs rootView prevGrab|
 
@@ -14859,22 +14933,22 @@
     "
     rootView := aDevice rootView.
     doGrab ifTrue:[
-	prevGrab := aDevice activePointerGrab.
-	aDevice grabPointerInView:rootView withCursor:curs.
+        prevGrab := aDevice activePointerGrab.
+        aDevice grabPointerInView:rootView withCursor:curs.
     ].
 
     "
      get the pixels
     "
     [
-	self from:rootView in:aRectangle.
+        self from:rootView in:aRectangle.
     ] ensure:[
-	doGrab ifTrue:[
-	    aDevice ungrabPointer.
-	    prevGrab notNil ifTrue:[
-		 aDevice grabPointerInView:prevGrab.
-	    ]
-	]
+        doGrab ifTrue:[
+            aDevice ungrabPointer.
+            prevGrab notNil ifTrue:[
+                 aDevice grabPointerInView:prevGrab.
+            ]
+        ]
     ]
 
     "
@@ -14898,49 +14972,49 @@
 
     "/ kludge for 15bit XFree server
     depth == 15 ifTrue:[
-	depth := 16
+        depth := 16
     ].
 
     (visType == #StaticGray) ifTrue:[
-	(aDevice blackpixel == 0) ifTrue:[
-	    photometric := #blackIs0
-	] ifFalse:[
-	    photometric := #whiteIs0
-	].
-	samplesPerPixel := 1.
-	bitsPerPixel := depth.
-	bitsPerSample := ByteArray with:bitsPerPixel.
-	"
-	 were done, the pixel values are the grey values
-	"
-	^ self
+        (aDevice blackpixel == 0) ifTrue:[
+            photometric := #blackIs0
+        ] ifFalse:[
+            photometric := #whiteIs0
+        ].
+        samplesPerPixel := 1.
+        bitsPerPixel := depth.
+        bitsPerSample := ByteArray with:bitsPerPixel.
+        "
+         were done, the pixel values are the grey values
+        "
+        ^ self
     ].
 
     ((visType == #TrueColor) or:[visType == #DirectColor]) ifTrue:[
-	photometric := #rgb.
-	samplesPerPixel := 3.
-
-	"/ for now - only support 24bit TrueColor
-	depth ~~ 24 ifTrue:[
-	    'IMAGE: unsupported display depth' errorPrintCR.
-	].
+        photometric := #rgb.
+        samplesPerPixel := 3.
+
+        "/ for now - only support 24bit TrueColor
+        depth ~~ 24 ifTrue:[
+            'IMAGE: unsupported display depth' errorPrintCR.
+        ].
 "/                bitsPerPixel := depth.
 "/                bitsPerSample := ByteArray with:aDevice bitsRed
 "/                                       with:aDevice bitsGreen
 "/                                       with:aDevice bitsBlue
-	bitsPerPixel := 24.
-	bitsPerSample := #[8 8 8].
-	"
-	 were done, the pixel values are the rgb values
-	"
-	^ self
+        bitsPerPixel := 24.
+        bitsPerSample := #[8 8 8].
+        "
+         were done, the pixel values are the rgb values
+        "
+        ^ self
     ].
 
     ((visType ~~ #PseudoColor)
     and:[(visType ~~ #StaticColor)
     and:[visType ~~ #GrayScale]]) ifTrue:[
-	self error:'screen visual not supported'.
-	^ nil
+        self error:'screen visual not supported'.
+        ^ nil
     ].
 
     photometric := #palette.
--- a/ImageReader.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/ImageReader.st	Fri Sep 02 17:42:18 2016 +0100
@@ -1231,6 +1231,31 @@
     "Modified: 23.4.1997 / 18:54:05 / cg"
 !
 
+swap:nBytes bytesFromRGBA_to_BGRA_in:data startingAt:startIndex
+    "swap bytes from RGBA into BGRA order.
+     The argument is a pixel data buffer (byteArray)"
+
+    self swap:(nBytes//4) pixelsFromRGB_to_BGR_in:data startingAt:startIndex bytesPerPixel:4
+
+    "
+     |bytes|
+
+     bytes := #[ 0 1 2 3 4 5 6 7 8 9 ].
+     self swap:6 bytesFromRGB_to_BGR_in:bytes startingAt:1.
+     bytes.
+    "
+    "
+     |bytes|
+
+     bytes := ByteArray new:1000000.
+     bytes replaceFrom:1 with:#[ 0 1 2 3 4 5 6 7 8 9 10 11 12].
+     Time millisecondsToRun:[
+        self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
+     ].
+     bytes copyTo:10.
+    "
+!
+
 swap:nBytes bytesFromRGB_to_BGR_in:data
     "swap bytes from RGB into BGR order.
      The argument is a pixel data buffer (byteArray)"
--- a/SimpleView.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/SimpleView.st	Fri Sep 02 17:42:18 2016 +0100
@@ -7736,7 +7736,6 @@
     ].
 
     "/ font := self defaultFont.  -- already done in #initialize
-    gc createFontOnDevice.
 
     "Modified: 28.5.1996 / 21:13:58 / cg"
 !
--- a/WinWorkstation.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/WinWorkstation.st	Fri Sep 02 17:42:18 2016 +0100
@@ -15994,7 +15994,7 @@
 	} else {
 	    do {
 		__threadErrno = 0;
-		__rslt = (BOOL)((INT) __STX_API_CALL1( "GetSaveFileName", (VOIDFUNC)GetSaveFileName, (void *)(&ofn)));
+		__rslt = (BOOL)((INT) __STX_API_CALL1( "GetSaveFileName", (voidFUNC)GetSaveFileName, (void *)(&ofn)));
 	    } while ((__rslt < 0) && (__threadErrno == EINTR));
 	}
     } else {
@@ -16003,7 +16003,7 @@
 	} else {
 	    do {
 		__threadErrno = 0;
-		__rslt = (BOOL)((INT) __STX_API_CALL1( "GetOpenFileName", (VOIDFUNC)GetOpenFileName, (void *)(&ofn)));
+		__rslt = (BOOL)((INT) __STX_API_CALL1( "GetOpenFileName", (voidFUNC)GetOpenFileName, (void *)(&ofn)));
 	    } while ((__rslt < 0) && (__threadErrno == EINTR));
 	}
     }
@@ -16155,7 +16155,7 @@
     answer = PrintDlg(&pdsetup);
 # else
     answer = __STX_API_CALL1( "PrintDlg",
-					(VOIDFUNC)PrintDlg,
+					(voidFUNC)PrintDlg,
 					(void *)&pdsetup );
 # endif
     if (! answer) {
@@ -16288,7 +16288,7 @@
 	    __threadErrno = 0;
 	    __answer = (INT) __STX_API_CALL4(
 					"MessageBox",
-					(VOIDFUNC)MessageBox,
+					(voidFUNC)MessageBox,
 					(void *)hWndOwner,
 					(void *)__text,
 					(void *)__title,
--- a/WindowSensor.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/WindowSensor.st	Fri Sep 02 17:42:18 2016 +0100
@@ -2920,12 +2920,16 @@
      view (i.e. is there an event for any of my views);
      otherwise, the information is regarding to that specific view."
 
+    |device|
+
     "/ look in my queues
     (self hasEvent:type for:aView) ifTrue:[^ true].
 
     aView notNil ifTrue:[
-        "/ ask the device if it has something pending
-        ^ aView graphicsDevice eventPending:dType for:aView id
+        (device := aView graphicsDevice) notNil ifTrue:[
+            "/ ask the device if it has something pending
+            ^ device eventPending:dType for:aView id
+        ].
     ].
     ^ false
 
--- a/XWorkstation.st	Mon Aug 01 23:30:02 2016 +0100
+++ b/XWorkstation.st	Fri Sep 02 17:42:18 2016 +0100
@@ -128,16 +128,16 @@
 extern OBJ __GLOBAL_GET_BY_NAME(char *);
 
 # define __HANDLE_VAL(type, externalAddress) \
-        ((type)__externalAddressVal(externalAddress))
+	((type)__externalAddressVal(externalAddress))
 
 # define __HANDLE_NEW(ptr, __cls)                    \
-        ({                                           \
-            OBJ handle = __MKEXTERNALADDRESS(ptr);   \
-            OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
-            __InstPtr(handle)->o_class = clsObj;     \
-            __STORE(handle, clsObj);                 \
-            handle;                                  \
-        })
+	({                                           \
+	    OBJ handle = __MKEXTERNALADDRESS(ptr);   \
+	    OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
+	    __InstPtr(handle)->o_class = clsObj;     \
+	    __STORE(handle, clsObj);                 \
+	    handle;                                  \
+	})
 
 /*
  * this define suppresses XAllocColor/XFreeColor on
@@ -297,16 +297,16 @@
  */
 #define __ENTER_XLIB(whichTimeout)   \
     { \
-        __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
-        __blockingPrimitiveTimeoutArg__ = self; \
-        __blockingPrimitiveTimeout__ = whichTimeout; \
+	__blockingPrimitiveTimoutHandler__ = (voidFUNC)__XTimeoutErrorHandler; \
+	__blockingPrimitiveTimeoutArg__ = self; \
+	__blockingPrimitiveTimeout__ = whichTimeout; \
     } {
 
 #define LEAVE_XLIB()   \
     { \
-        __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)0; \
-        __blockingPrimitiveTimeoutArg__ = nil; \
-        __blockingPrimitiveTimeout__ = 0; \
+	__blockingPrimitiveTimoutHandler__ = (voidFUNC)0; \
+	__blockingPrimitiveTimeoutArg__ = nil; \
+	__blockingPrimitiveTimeout__ = 0; \
     } }
 
 #define ENTER_XLIB()   __ENTER_XLIB(__intVal(__INST(xlibTimeout)) * 1000)
@@ -411,18 +411,18 @@
 # endif
 static void
 dummyToForceLoading() {
-        XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
-        XCloseDisplay(0);
-        XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
-        XSetWindowColormap(0, 0, 0);
-        XQueryColors(0,0,0,0);
+	XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
+	XCloseDisplay(0);
+	XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
+	XSetWindowColormap(0, 0, 0);
+	XQueryColors(0,0,0,0);
 # ifdef SHM
-        XShmAttach(0, 0);
-        XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
-        XShmDetach(0, 0);
-        XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
-        shmctl(0,0,0);
-        fgetc(0);
+	XShmAttach(0, 0);
+	XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
+	XShmDetach(0, 0);
+	XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
+	shmctl(0,0,0);
+	fgetc(0);
 # endif  // SHM
 }
 #endif // !ELF
@@ -569,42 +569,42 @@
     lastErrorMsg[127] = '\0';
 
     if (lastErrorMsg[0] == '\0') {
-        sprintf(lastErrorMsg, "code: %d", event->error_code);
+	sprintf(lastErrorMsg, "code: %d", event->error_code);
     }
     lastRequestCode = event->request_code;
     lastMinorCode = event->minor_code;
     lastResource = event->resourceid;
     if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
-        /*
-         * this is a BadWindow error for X_DestroyWindow.
-         * ignore it here, since it results from the GC freeing windows
-         * in non bottom-up window order.
-         */
-        return 0;
+	/*
+	 * this is a BadWindow error for X_DestroyWindow.
+	 * ignore it here, since it results from the GC freeing windows
+	 * in non bottom-up window order.
+	 */
+	return 0;
     }
 
     if (@global(DeviceWorkstation:ErrorPrinting) == true) {
-        char *requestName = "?";
-
-        if (event->request_code < (sizeof(requestNames)/sizeof(char *))) {
-            requestName = requestNames[event->request_code];
-        }
-        console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) \"%s\", min=%d (0x%x), resource=%"_lx_"\n",
-                        event->request_code, event->request_code, requestName,
-                        event->minor_code, event->minor_code, (INT)(event->resourceid));
-        console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
-                        event->error_code, lastErrorMsg);
+	char *requestName = "?";
+
+	if (event->request_code < (sizeof(requestNames)/sizeof(char *))) {
+	    requestName = requestNames[event->request_code];
+	}
+	console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) \"%s\", min=%d (0x%x), resource=%"_lx_"\n",
+			event->request_code, event->request_code, requestName,
+			event->minor_code, event->minor_code, (INT)(event->resourceid));
+	console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
+			event->error_code, lastErrorMsg);
     }
 #if 0
     // cg: should no longer be needed - librun no longer sends an errorInterrupt while running on C-stack
 #ifdef XFT
     if ((strncmp(lastErrorMsg, "RenderBadPicture", 16) == 0)) {
-        /*
-         * this is a RenderBadPicture error from XFT drawing.
-         * ignore it for now, as this is due to an incomplete implementation
-         */
-        console_fprintf(stderr, "XWorkstation [info]: x-error ignored\n");
-        return 0;
+	/*
+	 * this is a RenderBadPicture error from XFT drawing.
+	 * ignore it for now, as this is due to an incomplete implementation
+	 */
+	console_fprintf(stderr, "XWorkstation [info]: x-error ignored\n");
+	return 0;
     }
 #endif
 #endif
@@ -624,10 +624,10 @@
 __XIOErrorHandler__(Display *dpy)
 {
     if (@global(DeviceWorkstation:ErrorPrinting) == true) {
-        console_fprintf(stderr, "XWorkstation [error]: I/O error\n");
+	console_fprintf(stderr, "XWorkstation [error]: I/O error\n");
     }
     __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
-                                                  __MKEXTERNALADDRESS(dpy));
+						  __MKEXTERNALADDRESS(dpy));
 
 #if 0
     /*
@@ -658,12 +658,12 @@
 __XTimeoutErrorHandler(OBJ displayDeviceInst)
 {
     if ((displayDeviceInst == @global(MainDisplay))
-        || (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
-        console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
-        return;
+	|| (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
+	console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
+	return;
     }
     if (@global(DeviceWorkstation:ErrorPrinting) == true) {
-        console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst);
+	console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst);
     }
     __OINST(displayDeviceInst, hasConnectionBroken) = true;
 
@@ -675,14 +675,14 @@
      * if we return from the error interrupt ...
      */
     if (__OINST(displayDeviceInst, displayId) != nil) {
-        __internalError("unhandled X11 display timeout error");
-
-        /*
-         * the current process failed to do an X11 request.
-         * Terminate it!
-         */
-        __terminateProcess(0);      /* soft terminate */
-        __terminateProcess(1);      /* hard terminate */
+	__internalError("unhandled X11 display timeout error");
+
+	/*
+	 * the current process failed to do an X11 request.
+	 * Terminate it!
+	 */
+	__terminateProcess(0);      /* soft terminate */
+	__terminateProcess(1);      /* hard terminate */
     }
 }
 #endif // __INCREMENTAL_COMPILE__
@@ -712,7 +712,7 @@
     from DeviceWorkstation.
     Notice, that in Smalltalk/X you are not technically limited to one display;
     in theory (and in our practice), you can create Views on many displays
-    simultanously. However, the default setup is for one display only.
+    simultaneously. However, the default setup is for one display only.
     To support multiple displays, you will have to start another event dispatcher
     process for the other display(s) and create the other views with a slightly
     different protocol (ApplicationModel openOnDevice:) or by temporarily answering
@@ -2038,19 +2038,19 @@
     Pixmap newBitmap;
 
     if (__bothSmallInteger(w, h) && ISCONNECTED) {
-        Display *dpy = myDpy;
-
-
-        ENTER_XLIB();
-        newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
-                                       __intVal(w), __intVal(h), 1);
-        LEAVE_XLIB();
+	Display *dpy = myDpy;
+
+
+	ENTER_XLIB();
+	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
+				       __intVal(w), __intVal(h), 1);
+	LEAVE_XLIB();
 #ifdef COUNT_RESOURCES
-        if (newBitmap)
-            __cnt_bitmap++;
-#endif
-
-        RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
+	if (newBitmap)
+	    __cnt_bitmap++;
+#endif
+
+	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
     }
 %}.
     self primitiveFailedOrClosedConnection.
@@ -2713,86 +2713,86 @@
     int bytesPerRow;
 
     if (! ISCONNECTED) {
-        RETURN (nil);
+	RETURN (nil);
     }
 
     dpy = myDpy;
     if (firstCall) {
-        for (index=0; index < 256; index++) {
-            int t = 0;
-
-            if (index & 128) t |=   1;
-            if (index &  64) t |=   2;
-            if (index &  32) t |=   4;
-            if (index &  16) t |=   8;
-            if (index &   8) t |=  16;
-            if (index &   4) t |=  32;
-            if (index &   2) t |=  64;
-            if (index &   1) t |= 128;
-
-            reverseBitTable[index] = t;
-        }
-        firstCall = 0;
+	for (index=0; index < 256; index++) {
+	    int t = 0;
+
+	    if (index & 128) t |=   1;
+	    if (index &  64) t |=   2;
+	    if (index &  32) t |=   4;
+	    if (index &  16) t |=   8;
+	    if (index &   8) t |=  16;
+	    if (index &   4) t |=  32;
+	    if (index &   2) t |=  64;
+	    if (index &   1) t |= 128;
+
+	    reverseBitTable[index] = t;
+	}
+	firstCall = 0;
     }
 
     if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
-        newBitmap = (Pixmap)0;
-        b_width = __intVal(w);
-        b_height = __intVal(h);
-        bytesPerRow = (b_width + 7) / 8;
-        nBytes = b_height * bytesPerRow;
-        if (nBytes < sizeof(fastBits)) {
-            cp = b_bits = fastBits;
-            allocatedBits = 0;
-        } else {
-            cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
-            if (! cp) goto fail;
-        }
-
-        if (__isArrayLike(anArray)) {
-            index = 1;
-            op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
-            for (row = b_height; row; row--) {
-                for (col = bytesPerRow; col; col--) {
-                    num = *op++;
-                    if (__isSmallInteger(num)) {
-                        bits = __intVal(num);
-                    } else {
-                        bits = __longIntVal(num);
-                        if (bits == 0) {
-                            goto fail;
-                        }
-                    }
-                    *cp++ = reverseBitTable[bits & 0xFF];
-                }
-            }
-        } else {
-            if (__isByteArrayLike(anArray)) {
-                pBits = __ByteArrayInstPtr(anArray)->ba_element;
-                for (col = b_height*bytesPerRow; col; col--) {
-                    *cp++ = reverseBitTable[*pBits++];
-                }
-            } else {
-                goto fail;
-            }
-        }
-
-
-        ENTER_XLIB();
-        newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
-                                               (char *)b_bits,
-                                               b_width, b_height);
-        LEAVE_XLIB();
+	newBitmap = (Pixmap)0;
+	b_width = __intVal(w);
+	b_height = __intVal(h);
+	bytesPerRow = (b_width + 7) / 8;
+	nBytes = b_height * bytesPerRow;
+	if (nBytes < sizeof(fastBits)) {
+	    cp = b_bits = fastBits;
+	    allocatedBits = 0;
+	} else {
+	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
+	    if (! cp) goto fail;
+	}
+
+	if (__isArrayLike(anArray)) {
+	    index = 1;
+	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
+	    for (row = b_height; row; row--) {
+		for (col = bytesPerRow; col; col--) {
+		    num = *op++;
+		    if (__isSmallInteger(num)) {
+			bits = __intVal(num);
+		    } else {
+			bits = __longIntVal(num);
+			if (bits == 0) {
+			    goto fail;
+			}
+		    }
+		    *cp++ = reverseBitTable[bits & 0xFF];
+		}
+	    }
+	} else {
+	    if (__isByteArrayLike(anArray)) {
+		pBits = __ByteArrayInstPtr(anArray)->ba_element;
+		for (col = b_height*bytesPerRow; col; col--) {
+		    *cp++ = reverseBitTable[*pBits++];
+		}
+	    } else {
+		goto fail;
+	    }
+	}
+
+
+	ENTER_XLIB();
+	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
+					       (char *)b_bits,
+					       b_width, b_height);
+	LEAVE_XLIB();
 #ifdef COUNT_RESOURCES
-        if (newBitmap)
-            __cnt_bitmap++;
+	if (newBitmap)
+	    __cnt_bitmap++;
 #endif
 
 
 fail: ;
-        if (allocatedBits)
-            free(allocatedBits);
-        RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
+	if (allocatedBits)
+	    free(allocatedBits);
+	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
     }
 %}.
     ^ nil
@@ -3496,128 +3496,128 @@
 
     (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
 
-        "/ DND can drop files, file, dir, links, dirLink and text
-        "/ check for this.
-
-        dropObjects isCollection ifFalse:[
-            dropColl := Array with:dropObjects
-        ] ifTrue:[
-            dropColl := dropObjects
-        ].
-        anyFile := anyDir := anyText := anyOther := false.
-        dropColl do:[:aDropObject |
-            aDropObject isFileObject ifTrue:[
-                aDropObject theObject isDirectory ifTrue:[
-                    anyDir := true
-                ] ifFalse:[
-                    anyFile := true
-                ]
-            ] ifFalse:[
-                aDropObject isTextObject ifTrue:[
-                    anyText := true
-                ] ifFalse:[
-                    anyOther := true
-                ]
-            ]
-        ].
-
-        anyOther ifTrue:[
-            "/ DND does not support this ...
-            Logger info:'DND can only drop files or text'.
-            ^ false
-        ].
-        anyText ifTrue:[
-            (anyFile or:[anyDir]) ifTrue:[
-                "/ DND does not support mixed types
-                Logger info:'DND cannot drop both files and text'.
-                ^ false
-            ]
-        ].
-
-        dropCollSize := dropColl size.
-        anyFile ifTrue:[
-            dropType := #DndFiles.
-            dropCollSize == 1 ifTrue:[
-                dropType := #DndFile
-            ]
-        ] ifFalse:[
-            anyDir ifTrue:[
-                dropType := #DndFiles.
-                dropCollSize == 1 ifTrue:[
-                    dropType := #DndDir
-                ]
-            ] ifFalse:[
-                anyText ifTrue:[
-                    dropCollSize == 1 ifTrue:[
-                        dropType := #DndText
-                    ] ifFalse:[
-                        "/ can only drop a single text object
-                        Logger info:'DND can only drop a single text'.
-                        ^ false
-                    ]
-                ] ifFalse:[
-                    "/ mhmh ...
-                    Logger info:'DND cannot drop this'.
-                    ^ false
-                ]
-            ]
-        ].
-
-        dropTypeCode := self dndDropTypes indexOf:dropType.
-        dropTypeCode == 0 ifTrue:[
-            Logger info:'DND cannot drop this'.
-            ^ false
-        ].
-        dropTypeCode := dropTypeCode - 1.
-
-
-        "/ place the selection inTo the DndSelection property
-        "/ of the rootView ...
-        "/ ... need a single string, with 0-terminated parts.
-
-        strings := OrderedCollection new.
-        sz := 0.
-        dropColl do:[:anObject |
-            |s o|
-
-            o := anObject theObject.
-            anObject isFileObject ifTrue:[
-                o := o pathName
-            ].
-            s := o asString.
-            strings add:s.
-            sz := sz + (s size) + 1.
-        ].
-        val := String new:sz.
-        idx := 1.
-        strings do:[:aString |
-            |sz|
-
-            sz := aString size.
-            val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
-            idx := idx + sz.
-            val at:idx put:(Character value:0).
-            idx := idx + 1
-        ].
-
-        self
-            setProperty:(self atomIDOf:#DndSelection)
-            type:(self atomIDOf:#STRING)
-            value:val
-            for:rootId.
-
-        ^ self
-            sendClientEvent:msgType
-            format:32
-            to:destinationId
-            propagate:true
-            eventMask:nil
-            window:destinationId
-            data1:dropTypeCode
-            data2:0
-            data3:destinationId
-            data4:nil
-            data5:nil.
+	"/ DND can drop files, file, dir, links, dirLink and text
+	"/ check for this.
+
+	dropObjects isCollection ifFalse:[
+	    dropColl := Array with:dropObjects
+	] ifTrue:[
+	    dropColl := dropObjects
+	].
+	anyFile := anyDir := anyText := anyOther := false.
+	dropColl do:[:aDropObject |
+	    aDropObject isFileObject ifTrue:[
+		aDropObject theObject isDirectory ifTrue:[
+		    anyDir := true
+		] ifFalse:[
+		    anyFile := true
+		]
+	    ] ifFalse:[
+		aDropObject isTextObject ifTrue:[
+		    anyText := true
+		] ifFalse:[
+		    anyOther := true
+		]
+	    ]
+	].
+
+	anyOther ifTrue:[
+	    "/ DND does not support this ...
+	    Logger info:'DND can only drop files or text'.
+	    ^ false
+	].
+	anyText ifTrue:[
+	    (anyFile or:[anyDir]) ifTrue:[
+		"/ DND does not support mixed types
+		Logger info:'DND cannot drop both files and text'.
+		^ false
+	    ]
+	].
+
+	dropCollSize := dropColl size.
+	anyFile ifTrue:[
+	    dropType := #DndFiles.
+	    dropCollSize == 1 ifTrue:[
+		dropType := #DndFile
+	    ]
+	] ifFalse:[
+	    anyDir ifTrue:[
+		dropType := #DndFiles.
+		dropCollSize == 1 ifTrue:[
+		    dropType := #DndDir
+		]
+	    ] ifFalse:[
+		anyText ifTrue:[
+		    dropCollSize == 1 ifTrue:[
+			dropType := #DndText
+		    ] ifFalse:[
+			"/ can only drop a single text object
+			Logger info:'DND can only drop a single text'.
+			^ false
+		    ]
+		] ifFalse:[
+		    "/ mhmh ...
+		    Logger info:'DND cannot drop this'.
+		    ^ false
+		]
+	    ]
+	].
+
+	dropTypeCode := self dndDropTypes indexOf:dropType.
+	dropTypeCode == 0 ifTrue:[
+	    Logger info:'DND cannot drop this'.
+	    ^ false
+	].
+	dropTypeCode := dropTypeCode - 1.
+
+
+	"/ place the selection inTo the DndSelection property
+	"/ of the rootView ...
+	"/ ... need a single string, with 0-terminated parts.
+
+	strings := OrderedCollection new.
+	sz := 0.
+	dropColl do:[:anObject |
+	    |s o|
+
+	    o := anObject theObject.
+	    anObject isFileObject ifTrue:[
+		o := o pathName
+	    ].
+	    s := o asString.
+	    strings add:s.
+	    sz := sz + (s size) + 1.
+	].
+	val := String new:sz.
+	idx := 1.
+	strings do:[:aString |
+	    |sz|
+
+	    sz := aString size.
+	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
+	    idx := idx + sz.
+	    val at:idx put:(Character value:0).
+	    idx := idx + 1
+	].
+
+	self
+	    setProperty:(self atomIDOf:#DndSelection)
+	    type:(self atomIDOf:#STRING)
+	    value:val
+	    for:rootId.
+
+	^ self
+	    sendClientEvent:msgType
+	    format:32
+	    to:destinationId
+	    propagate:true
+	    eventMask:nil
+	    window:destinationId
+	    data1:dropTypeCode
+	    data2:0
+	    data3:destinationId
+	    data4:nil
+	    data5:nil.
     ].
 
     ^ false
@@ -3674,11 +3674,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3688,19 +3688,19 @@
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(width, height)) {
-        w = __intVal(width);
-        h = __intVal(height);
-        /*
-         * need this check here: some servers simply dump core with bad args
-         */
-        if ((w >= 0) && (h >= 0)) {
-            ENTER_XLIB();
-            XClearArea(myDpy,
-                           __DrawableVal(aDrawableId),
-                           __intVal(x), __intVal(y), w, h, 0);
-            LEAVE_XLIB();
-        }
-        RETURN ( self );
+	w = __intVal(width);
+	h = __intVal(height);
+	/*
+	 * need this check here: some servers simply dump core with bad args
+	 */
+	if ((w >= 0) && (h >= 0)) {
+	    ENTER_XLIB();
+	    XClearArea(myDpy,
+			   __DrawableVal(aDrawableId),
+			   __intVal(x), __intVal(y), w, h, 0);
+	    LEAVE_XLIB();
+	}
+	RETURN ( self );
     }
 %}.
     "badGC, badDrawable or coordinates not integer"
@@ -5326,9 +5326,9 @@
     dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
 
     property := self
-        getProperty:(self atomIDOf:#DndSelection)
-        from:rootId
-        delete:false.
+	getProperty:(self atomIDOf:#DndSelection)
+	from:rootId
+	delete:false.
 
     propertyType := property key.
     dropValue := property value.
@@ -5342,69 +5342,69 @@
     "/ in the default dropMessage handling of SimpleView.
 
     dropType == #DndFiles ifTrue:[
-        "/ actually, a list of fileNames
-        propertyType ~~ stringAtom ifTrue:[
-            Logger info:'expected a string propertyValue in drop'.
-            ^ self
-        ].
-
-        names := OrderedCollection new.
-        i1 := 1.
-        [i1 ~~ 0] whileTrue:[
-            i2 := dropValue indexOf:(Character value:0) startingAt:i1.
-            i2 ~~ 0 ifTrue:[
-                names add:(dropValue copyFrom:i1 to:(i2-1)).
-                i1 := i2 + 1.
-            ] ifFalse:[
-                i1 := i2
-            ].
-        ].
-        dropValue := names.
-        dropValue := dropValue collect:[:nm | nm asFilename].
-        dropType := #files.
+	"/ actually, a list of fileNames
+	propertyType ~~ stringAtom ifTrue:[
+	    Logger info:'expected a string propertyValue in drop'.
+	    ^ self
+	].
+
+	names := OrderedCollection new.
+	i1 := 1.
+	[i1 ~~ 0] whileTrue:[
+	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
+	    i2 ~~ 0 ifTrue:[
+		names add:(dropValue copyFrom:i1 to:(i2-1)).
+		i1 := i2 + 1.
+	    ] ifFalse:[
+		i1 := i2
+	    ].
+	].
+	dropValue := names.
+	dropValue := dropValue collect:[:nm | nm asFilename].
+	dropType := #files.
     ] ifFalse:[ (dropType == #DndFile) ifTrue:[
-        propertyType ~~ stringAtom ifTrue:[
-            Logger info:'expected a string propertyValue in drop'.
-            ^ self
-        ].
-        dropValue := dropValue asFilename.
-        dropType := #file.
+	propertyType ~~ stringAtom ifTrue:[
+	    Logger info:'expected a string propertyValue in drop'.
+	    ^ self
+	].
+	dropValue := dropValue asFilename.
+	dropType := #file.
     ] ifFalse:[ (dropType == #DndDir) ifTrue:[
-        propertyType ~~ stringAtom ifTrue:[
-            Logger info:'expected a string propertyValue in drop'.
-            ^ self
-        ].
-        dropValue := dropValue asFilename.
-        dropType := #directory.
+	propertyType ~~ stringAtom ifTrue:[
+	    Logger info:'expected a string propertyValue in drop'.
+	    ^ self
+	].
+	dropValue := dropValue asFilename.
+	dropType := #directory.
     ] ifFalse:[ (dropType == #DndText) ifTrue:[
-        propertyType ~~ stringAtom ifTrue:[
-            Logger info:'expected a string propertyValue in drop'.
-            ^ self
-        ].
-        dropType := #text.
+	propertyType ~~ stringAtom ifTrue:[
+	    Logger info:'expected a string propertyValue in drop'.
+	    ^ self
+	].
+	dropType := #text.
     ] ifFalse:[ (dropType == #DndExe) ifTrue:[
-        propertyType ~~ stringAtom ifTrue:[
-            Logger info:'expected a string propertyValue in drop'.
-            ^ self
-        ].
-        dropType := #executable.
+	propertyType ~~ stringAtom ifTrue:[
+	    Logger info:'expected a string propertyValue in drop'.
+	    ^ self
+	].
+	dropType := #executable.
     ] ifFalse:[ (dropType == #DndLink) ifTrue:[
-        propertyType ~~ stringAtom ifTrue:[
-            Logger info:'expected a string propertyValue in drop'.
-            ^ self
-        ].
-        dropType := #link.
+	propertyType ~~ stringAtom ifTrue:[
+	    Logger info:'expected a string propertyValue in drop'.
+	    ^ self
+	].
+	dropType := #link.
     ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
-        dropType := #rawData.
+	dropType := #rawData.
     ] ifFalse:[
-        Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
-        dropType := #unknown.
+	Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
+	dropType := #unknown.
     ]]]]]]].
 
     sensor := targetView sensor.
     "not posted, if there is no sensor ..."
     sensor notNil ifTrue:[
-        sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
+	sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
     ].
 
     "Created: 4.4.1997 / 17:59:37 / cg"
@@ -11456,7 +11456,7 @@
 	^ info
     ].
     "
-     some error occured - either args are not smallintegers, imageBits is not a ByteArray
+     some error occurred - either args are not smallintegers, imageBits is not a ByteArray
      or is too small to hold the bits
     "
     self primitiveFailedOrClosedConnection.
@@ -11719,20 +11719,20 @@
     buffer := self perform:bufferGetSelector.
 
     (aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
-        "/ 'st-object' printCR.
-        "send the selection in binaryStore format"
-        "require libboss to be loaded"
-        (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
-            Logger error:'cannot use binary store for copy buffer (libboss missing)'.
-            ^ nil -> nil.
-        ].
-
-        [
-            ^ aTargetAtomID -> (buffer binaryStoreBytes).
-        ] on:Error do:[:ex|
-            Logger info:'error on binary store of copy buffer: %1' with: ex description.
-            ^ nil -> nil.
-        ].
+	"/ 'st-object' printCR.
+	"send the selection in binaryStore format"
+	"require libboss to be loaded"
+	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
+	    Logger error:'cannot use binary store for copy buffer (libboss missing)'.
+	    ^ nil -> nil.
+	].
+
+	[
+	    ^ aTargetAtomID -> (buffer binaryStoreBytes).
+	] on:Error do:[:ex|
+	    Logger info:'error on binary store of copy buffer: %1' with: ex description.
+	    ^ nil -> nil.
+	].
     ].
 
     bufferAsString := self class bufferAsString:buffer.
@@ -11740,25 +11740,25 @@
     (aTargetAtomID == (self atomIDOf:#STRING)
      or:[aTargetAtomID == (self atomIDOf:#'text/plain')]
     ) ifTrue:[
-        "/ 'string' printCR.
-        "the other view wants the selection as string"
-        ^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
+	"/ 'string' printCR.
+	"the other view wants the selection as string"
+	^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
     ].
 
     (aTargetAtomID == (self atomIDOf:#UTF8_STRING)
      or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')]
     ) ifTrue:[
-        "/ 'utf string' printCR.
-        "the other view wants the selection as utf8 string"
-        ^ aTargetAtomID -> (bufferAsString utf8Encoded).
+	"/ 'utf string' printCR.
+	"the other view wants the selection as utf8 string"
+	^ aTargetAtomID -> (bufferAsString utf8Encoded).
     ].
 
     aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[
-        "the other one wants to know the size of our selection.
-         LENGTH is deprecated, since we do not know how the selection is
-         going to be converted. The client must not rely on the length returned"
-
-        ^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
+	"the other one wants to know the size of our selection.
+	 LENGTH is deprecated, since we do not know how the selection is
+	 going to be converted. The client must not rely on the length returned"
+
+	^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
     ].
 
     "we do not support the requestet target type"
@@ -13937,11 +13937,11 @@
 %{
 #ifdef XFT
     if (__isExternalAddress(id)) {
-        XftDraw *address = (XftDraw *)__externalAddressVal(id);
-        if (address) {
-            XftDrawDestroy(address);
-            __externalAddressVal(id) = 0;
-        }
+	XftDraw *address = (XftDraw *)__externalAddressVal(id);
+	if (address) {
+	    XftDrawDestroy(address);
+	    __externalAddressVal(id) = 0;
+	}
     }
 #endif
 %}.
@@ -13959,8 +13959,8 @@
     |displayId|
 
     font isXftFont ifTrue:[
-        self displayDeviceXftString:aString from:index1 to:index2 x:x y:y opaque:opaque.
-        ^ self.
+	self displayDeviceXftString:aString from:index1 to:index2 x:x y:y opaque:opaque.
+	^ self.
     ].
 
     device flushIfAppropriate.
@@ -13981,165 +13981,165 @@
      && __isNonNilObject(aString)
      && __bothSmallInteger(index1, index2)
      && __bothSmallInteger(x, y)) {
-        int lMax = __intVal(@global(XWorkstation:MaxStringLength));
-        Display *dpy = __DisplayVal(displayId);
-        gc = __GCVal(__INST(gcId));
-        win = __WindowVal(__INST(drawableId));
-
-        i1 = __intVal(index1) - 1;
-        if (i1 >= 0) {
-            OBJ cls;
-
-            i2 = __intVal(index2) - 1;
-            if (i2 < i1) {
-                RETURN (self);
-            }
-            cp = (char *) __stringVal(aString);
-            l = i2 - i1 + 1;
-
-            if (__isStringLike(aString)) {
-                n = __stringSize(aString);
-                if (i2 < n) {
-                    cp += i1;
-                    if (l > lMax) l = lMax;
-                    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
-                    if (opaque == true)
-                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    else
-                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    LEAVE_XLIB();
-                    RETURN ( self );
-                }
-            }
-
-            cls = __qClass(aString);
-            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-            cp += nInstBytes;
-
-            if (__isBytes(aString)) {
-                n = __byteArraySize(aString) - nInstBytes - 1;
-
-                if (i2 < n) {
-                    cp += i1;
-                    if (l > lMax) l = lMax;
-                    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
-                    if (opaque == true)
-                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    else
-                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    LEAVE_XLIB();
-                    RETURN ( self );
-                }
-            }
-
-            /* TWOBYTESTRINGS */
-            if (__isWords(aString)) {
-                n = (__byteArraySize(aString) - nInstBytes) / 2;
-                if (i2 < n) {
-                    union {
-                        char b[2];
-                        unsigned short s;
-                    } u;
-                    int i;
-                    XChar2b *cp2 = (XChar2b *)0;
-                    int mustFree = 0;
-
-                    cp += (i1 * 2);
-                    if (l > lMax) l = lMax;
+	int lMax = __intVal(@global(XWorkstation:MaxStringLength));
+	Display *dpy = __DisplayVal(displayId);
+	gc = __GCVal(__INST(gcId));
+	win = __WindowVal(__INST(drawableId));
+
+	i1 = __intVal(index1) - 1;
+	if (i1 >= 0) {
+	    OBJ cls;
+
+	    i2 = __intVal(index2) - 1;
+	    if (i2 < i1) {
+		RETURN (self);
+	    }
+	    cp = (char *) __stringVal(aString);
+	    l = i2 - i1 + 1;
+
+	    if (__isStringLike(aString)) {
+		n = __stringSize(aString);
+		if (i2 < n) {
+		    cp += i1;
+		    if (l > lMax) l = lMax;
+		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+		    if (opaque == true)
+			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    else
+			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    LEAVE_XLIB();
+		    RETURN ( self );
+		}
+	    }
+
+	    cls = __qClass(aString);
+	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	    cp += nInstBytes;
+
+	    if (__isBytes(aString)) {
+		n = __byteArraySize(aString) - nInstBytes - 1;
+
+		if (i2 < n) {
+		    cp += i1;
+		    if (l > lMax) l = lMax;
+		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+		    if (opaque == true)
+			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    else
+			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    LEAVE_XLIB();
+		    RETURN ( self );
+		}
+	    }
+
+	    /* TWOBYTESTRINGS */
+	    if (__isWords(aString)) {
+		n = (__byteArraySize(aString) - nInstBytes) / 2;
+		if (i2 < n) {
+		    union {
+			char b[2];
+			unsigned short s;
+		    } u;
+		    int i;
+		    XChar2b *cp2 = (XChar2b *)0;
+		    int mustFree = 0;
+
+		    cp += (i1 * 2);
+		    if (l > lMax) l = lMax;
 
 #if defined(MSBFIRST) || defined(__MSBFIRST)
-                    /*
-                     * chars already in correct order
-                     */
+		    /*
+		     * chars already in correct order
+		     */
 #else
 # if ! (defined(LSBFIRST) || defined(__LSBFIRST))
-                    /*
-                     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
-                     * X expects them MSB first
-                     * convert as required
-                     */
-                    u.s = 0x1234;
-                    if (u.b[0] != 0x12)
-# endif  // ! (defined(LSBFIRST) || defined(__LSBFIRST)) 
-                    {
-                        if (l <= NLOCALBUFFER) {
-                            cp2 = xlatebuffer;
-                        } else {
-                            cp2 = (XChar2b *)(malloc(l * 2));
-                            mustFree = 1;
-                        }
-                        for (i=0; i<l; i++) {
-                            cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
-                            cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
-                        }
-                        cp = (char *) cp2;
-                    }
-#endif  // ! (defined(MSBFIRST) || defined(__MSBFIRST)) 
-                    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
-                    if (opaque == true)
-                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
-                    else
-                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
-                    LEAVE_XLIB();
-
-                    if (mustFree) {
-                        free(cp2);
-                    }
-
-                    RETURN ( self );
-                }
-            }
-
-            /* FOURBYTESTRINGS */
-            if (__isLongs(aString)) {
-                n = (__byteArraySize(aString) - nInstBytes) / 4;
-                if (i2 < n) {
-                    union {
-                        char b[2];
-                        unsigned short s;
-                    } u;
-                    int i;
-                    XChar2b *cp2 = (XChar2b *)0;
-                    int32 *ip;
-                    int mustFree = 0;
-
-                    cp += (i1 * 4);
-                    if (l > lMax) l = lMax;
-
-                    /*
-                     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
-                     */
-                    if (l <= NLOCALBUFFER) {
-                        cp2 = xlatebuffer;
-                    } else {
-                        cp2 = (XChar2b *)(malloc(l * 2));
-                        mustFree = 1;
-                    }
-                    for (i=0; i<l; i++) {
-                        int32 codePoint = ((int32 *)cp)[i];
-
-                        if (codePoint > 0xFFFF) {
-                            codePoint = 0xFFFF;
-                        }
-                        cp2[i].byte1 = (codePoint >> 8) & 0xFF;
-                        cp2[i].byte2 = codePoint & 0xFF;
-                    }
-
-                    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
-                    if (opaque == true)
-                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
-                    else
-                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
-                    LEAVE_XLIB();
-
-                    if (mustFree) {
-                        free(cp2);
-                    }
-
-                    RETURN ( self );
-                }
-            }
-        }
+		    /*
+		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
+		     * X expects them MSB first
+		     * convert as required
+		     */
+		    u.s = 0x1234;
+		    if (u.b[0] != 0x12)
+# endif  // ! (defined(LSBFIRST) || defined(__LSBFIRST))
+		    {
+			if (l <= NLOCALBUFFER) {
+			    cp2 = xlatebuffer;
+			} else {
+			    cp2 = (XChar2b *)(malloc(l * 2));
+			    mustFree = 1;
+			}
+			for (i=0; i<l; i++) {
+			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
+			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
+			}
+			cp = (char *) cp2;
+		    }
+#endif  // ! (defined(MSBFIRST) || defined(__MSBFIRST))
+		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+		    if (opaque == true)
+			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+		    else
+			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+		    LEAVE_XLIB();
+
+		    if (mustFree) {
+			free(cp2);
+		    }
+
+		    RETURN ( self );
+		}
+	    }
+
+	    /* FOURBYTESTRINGS */
+	    if (__isLongs(aString)) {
+		n = (__byteArraySize(aString) - nInstBytes) / 4;
+		if (i2 < n) {
+		    union {
+			char b[2];
+			unsigned short s;
+		    } u;
+		    int i;
+		    XChar2b *cp2 = (XChar2b *)0;
+		    int32 *ip;
+		    int mustFree = 0;
+
+		    cp += (i1 * 4);
+		    if (l > lMax) l = lMax;
+
+		    /*
+		     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
+		     */
+		    if (l <= NLOCALBUFFER) {
+			cp2 = xlatebuffer;
+		    } else {
+			cp2 = (XChar2b *)(malloc(l * 2));
+			mustFree = 1;
+		    }
+		    for (i=0; i<l; i++) {
+			int32 codePoint = ((int32 *)cp)[i];
+
+			if (codePoint > 0xFFFF) {
+			    codePoint = 0xFFFF;
+			}
+			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
+			cp2[i].byte2 = codePoint & 0xFF;
+		    }
+
+		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+		    if (opaque == true)
+			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
+		    else
+			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
+		    LEAVE_XLIB();
+
+		    if (mustFree) {
+			free(cp2);
+		    }
+
+		    RETURN ( self );
+		}
+	    }
+	}
     }
 #undef NLOCALBUFFER
 %}.
@@ -14167,67 +14167,67 @@
     "limit the string len, otherwise bad output is generated"
     stringLen := index2Arg - index1 + 1.
     stringLen > 1000 "8000" ifTrue:[
-        index2 := index1 + 1000 "8000" - 1.
+	index2 := index1 + 1000 "8000" - 1.
     ]  ifFalse:[
-        stringLen <= 0 ifTrue:[^ self].
-        index2 := index2Arg.
+	stringLen <= 0 ifTrue:[^ self].
+	index2 := index2Arg.
     ].
     bytesPerCharacter := aString bytesPerCharacter.
 
     clipRect notNil ifTrue:[
-        clipX := clipRect left.
-        clipY := clipRect top.
-        clipW := clipRect width.
-        clipH := clipRect height.
+	clipX := clipRect left.
+	clipY := clipRect top.
+	clipW := clipRect width.
+	clipH := clipRect height.
 "/clipW > 32767 ifTrue:['clipW > 32767: ' errorPrint. clipW errorPrintCR. clipW := 32767].
 "/(clipX > 16384 or:[clipX < -16384]) ifTrue:['clipX > 16384: ' errorPrint. clipX errorPrintCR.].
-        "/ YES YES YES: this MUST be transformed!!
-        "/ (see htmlView) fix the notebook, please.
+	"/ YES YES YES: this MUST be transformed!!
+	"/ (see htmlView) fix the notebook, please.
     ].
 
     fgR := paint scaledRed.
     fgR notNil ifTrue:[
-        fgG := paint scaledGreen.
-        fgB := paint scaledBlue.
-        fgA := paint scaledAlpha.
+	fgG := paint scaledGreen.
+	fgB := paint scaledBlue.
+	fgA := paint scaledAlpha.
     ] ifFalse:[
-        "/ when drawing into a pixmap...
-        fgPixel := paint colorId.
-        fgPixel == 0 ifTrue:[
-            fgR := fgG := fgB := 0.
-        ] ifFalse:[
-            fgR := fgG := fgB := 16rFFFF.
-        ].
-        fgA := 16rFFFF.
+	"/ when drawing into a pixmap...
+	fgPixel := paint colorId.
+	fgPixel == 0 ifTrue:[
+	    fgR := fgG := fgB := 0.
+	] ifFalse:[
+	    fgR := fgG := fgB := 16rFFFF.
+	].
+	fgA := 16rFFFF.
     ].
 
     opaque ifTrue:[
-        bgPaint isColor ifTrue:[
-            bgR := bgPaint scaledRed.
-            bgR notNil ifTrue:[
-                bgG := bgPaint scaledGreen.
-                bgB := bgPaint scaledBlue.
-                bgA := bgPaint scaledAlpha.
-            ] ifFalse:[
-                "/ when drawing into a pixmap...
-                bgPixel := bgPaint colorId.
-                bgPixel == 0 ifTrue:[
-                    bgR := bgG := bgB := 0.
-                ] ifFalse:[
-                    bgR := bgG := bgB := 16rFFFF.
-                ].
-                bgA := 16rFFFF.
-            ].
-        ] ifFalse:[
-            "images as background are not yet implemented"
-            "/ #todo: fill background rectangle
-            bgR := bgG := bgB := bgA := 16rFFFF.
-        ].
+	bgPaint isColor ifTrue:[
+	    bgR := bgPaint scaledRed.
+	    bgR notNil ifTrue:[
+		bgG := bgPaint scaledGreen.
+		bgB := bgPaint scaledBlue.
+		bgA := bgPaint scaledAlpha.
+	    ] ifFalse:[
+		"/ when drawing into a pixmap...
+		bgPixel := bgPaint colorId.
+		bgPixel == 0 ifTrue:[
+		    bgR := bgG := bgB := 0.
+		] ifFalse:[
+		    bgR := bgG := bgB := 16rFFFF.
+		].
+		bgA := 16rFFFF.
+	    ].
+	] ifFalse:[
+	    "images as background are not yet implemented"
+	    "/ #todo: fill background rectangle
+	    bgR := bgG := bgB := bgA := 16rFFFF.
+	].
     ].
 
     screen := device screen.
     self isPixmap ifTrue:[
-        pixmapDepth := depth.
+	pixmapDepth := depth.
     ].
     fontId := font getXftFontId.
 
@@ -14243,81 +14243,81 @@
     XftFont *__xftFont;
 
     if (!(__bothSmallInteger(drawX, drawY)
-          && __bothSmallInteger(index1, index2)
-          && __isSmallInteger(bytesPerCharacter)
-          && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
-          && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
-          && __isNonNilObject(aString)
-          && __isExternalAddress(displayId)
-          && __isExternalAddressLike(fontId)
+	  && __bothSmallInteger(index1, index2)
+	  && __isSmallInteger(bytesPerCharacter)
+	  && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
+	  && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
+	  && __isNonNilObject(aString)
+	  && __isExternalAddress(displayId)
+	  && __isExternalAddressLike(fontId)
     )) {
-        error = @symbol(badArgument);
-        goto out;
+	error = @symbol(badArgument);
+	goto out;
     }
 
     __xftFont = XFT_FONT(fontId);
     __bytesPerCharacter = __intVal(bytesPerCharacter);
 
     if (__INST(xftDrawId) != nil) {
-        __xftDrawId = __externalAddressVal(__INST(xftDrawId));
+	__xftDrawId = __externalAddressVal(__INST(xftDrawId));
     } else {
-        if (pixmapDepth != nil) {
-            int __pixmapDepth = __intVal(pixmapDepth);
-
-            if (__pixmapDepth == 1) {
-                __xftDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(__INST(drawableId)));
-            } else {
-                __xftDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(__INST(drawableId)), __pixmapDepth);
-            }
-        } else {
-            __xftDrawId = XftDrawCreate(DISPLAY(displayId),
-                                           DRAWABLE(__INST(drawableId)),
-                                           DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
-                                           DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
-        }
-        __INST(xftDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__xftDrawId);
-        __STORE(self, newXftDrawId);
+	if (pixmapDepth != nil) {
+	    int __pixmapDepth = __intVal(pixmapDepth);
+
+	    if (__pixmapDepth == 1) {
+		__xftDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(__INST(drawableId)));
+	    } else {
+		__xftDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(__INST(drawableId)), __pixmapDepth);
+	    }
+	} else {
+	    __xftDrawId = XftDrawCreate(DISPLAY(displayId),
+					   DRAWABLE(__INST(drawableId)),
+					   DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
+					   DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
+	}
+	__INST(xftDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__xftDrawId);
+	__STORE(self, newXftDrawId);
     }
 
     string = __stringVal(aString) + ((__intVal(index1) - 1 ) * __bytesPerCharacter);
     len = __intVal(index2) - __intVal(index1) + 1;
 
     if (clipX != nil) {
-        clipRX.x = __intVal(clipX);
-        clipRX.y = __intVal(clipY);
-        clipRX.width = __intVal(clipW);
-        clipRX.height = __intVal(clipH);
-        XftDrawSetClipRectangles(__xftDrawId, 0, 0, &clipRX, 1);
+	clipRX.x = __intVal(clipX);
+	clipRX.y = __intVal(clipY);
+	clipRX.width = __intVal(clipW);
+	clipRX.height = __intVal(clipH);
+	XftDrawSetClipRectangles(__xftDrawId, 0, 0, &clipRX, 1);
     } else {
-        XftDrawSetClip(__xftDrawId, 0);
+	XftDrawSetClip(__xftDrawId, 0);
     }
 
     if (opaque == true) {
-        if (bgPixel != nil) {
-            color.pixel = (unsigned long)__intVal(bgPixel);
-        }
-        color.color.red = __intVal(bgR);
-        color.color.green = __intVal(bgG);
-        color.color.blue = __intVal(bgB);
-        color.color.alpha = __intVal(bgA);
-
-        switch (__bytesPerCharacter) {
-        case 1:
-            XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
-            break;
-        case 2:
-            XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
-            break;
-        case 4:
-            XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
-            break;
-        }
+	if (bgPixel != nil) {
+	    color.pixel = (unsigned long)__intVal(bgPixel);
+	}
+	color.color.red = __intVal(bgR);
+	color.color.green = __intVal(bgG);
+	color.color.blue = __intVal(bgB);
+	color.color.alpha = __intVal(bgA);
+
+	switch (__bytesPerCharacter) {
+	case 1:
+	    XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
+	    break;
+	case 2:
+	    XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
+	    break;
+	case 4:
+	    XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
+	    break;
+	}
 if (extents.width < 0) printf("width: %d  < 0\n", extents.width);
 
-        XftDrawRect(__xftDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
+	XftDrawRect(__xftDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
     }
     if (__isSmallInteger(fgPixel)) {
-        color.pixel = (unsigned long)__intVal(fgPixel);
+	color.pixel = (unsigned long)__intVal(fgPixel);
     }
     color.color.red = __intVal(fgR);
     color.color.green = __intVal(fgG);
@@ -14326,39 +14326,39 @@
 
     switch (__bytesPerCharacter) {
     case 1:
-        XftDrawString8(__xftDrawId, &color,__xftFont,
-                        __intVal(drawX),
-                        __intVal(drawY),
-                        (FcChar8*)string,
-                        len);
-        break;
+	XftDrawString8(__xftDrawId, &color,__xftFont,
+			__intVal(drawX),
+			__intVal(drawY),
+			(FcChar8*)string,
+			len);
+	break;
 
     case 2:
-        XftDrawString16(__xftDrawId, &color, __xftFont,
-                        __intVal(drawX),
-                        __intVal(drawY),
-                        (FcChar16*)string,
-                        len);
-        break;
+	XftDrawString16(__xftDrawId, &color, __xftFont,
+			__intVal(drawX),
+			__intVal(drawY),
+			(FcChar16*)string,
+			len);
+	break;
 
     case 4:
-        XftDrawString32(__xftDrawId, &color, __xftFont,
-                        __intVal(drawX),
-                        __intVal(drawY),
-                        (FcChar32*)string,
-                        len);
-        break;
+	XftDrawString32(__xftDrawId, &color, __xftFont,
+			__intVal(drawX),
+			__intVal(drawY),
+			(FcChar32*)string,
+			len);
+	break;
 
     default:
-        error = @symbol(invalidStringSize);
-        goto out;
+	error = @symbol(invalidStringSize);
+	goto out;
     }
 
 out:;
 #endif
 %}.
     error notNil ifTrue:[
-        self primitiveFailed: error.
+	self primitiveFailed: error.
     ].
 ! !
 
@@ -14374,29 +14374,29 @@
     |pX pY nW nH pO pC|
 
     gcId isNil ifTrue:[
-        self initGC
+	self initGC
     ].
     transformation notNil ifTrue:[
-        pO := transformation transformPoint:x@y.
-        pC := transformation transformPoint:(x+w-1)@(y+h-1).
-        pX := pO x.
-        pY := pO y.
-        nW := pC x - pX + 1.
-        nH := pC y - pY + 1.
-
-        nW < 0 ifTrue:[
-              nW := nW abs.
-              pX := pX - nW.
-        ].
-        nH < 0 ifTrue:[
-              nH := nH abs.
-              pY := pY - nH.
-        ].
+	pO := transformation transformPoint:x@y.
+	pC := transformation transformPoint:(x+w-1)@(y+h-1).
+	pX := pO x.
+	pY := pO y.
+	nW := pC x - pX + 1.
+	nH := pC y - pY + 1.
+
+	nW < 0 ifTrue:[
+	      nW := nW abs.
+	      pX := pX - nW.
+	].
+	nH < 0 ifTrue:[
+	      nH := nH abs.
+	      pY := pY - nH.
+	].
     ] ifFalse:[
-        pX := x.
-        pY := y.
-        nW := w.
-        nH := h.
+	pX := x.
+	pY := y.
+	nW := w.
+	nH := h.
     ].
     pX := pX rounded.
     pY := pY rounded.
@@ -14404,11 +14404,11 @@
     nH := nH rounded.
 
     device
-        clearRectangleX:pX
-                     y:pY
-                 width:nW
-                height:nH
-                    in:drawableId with:gcId
+	clearRectangleX:pX
+		     y:pY
+		 width:nW
+		height:nH
+		    in:drawableId with:gcId
 ! !
 
 !XWorkstation::X11GraphicsContext methodsFor:'view creation'!
--- a/styles/expecco.style	Mon Aug 01 23:30:02 2016 +0100
+++ b/styles/expecco.style	Fri Sep 02 17:42:18 2016 +0100
@@ -60,15 +60,15 @@
 
 name                            #winVista
 
-comment                 'eXpecco style'
+comment                 'expecco style'
 previewFileName         'viewStyleSample_winvista.png'
 
 #if (Language == #german) or:[Language == #de]
-comment  'eXpecco Stil'
+comment  'expecco Stil'
 #endif
 
 #if (Language == #french) or:[Language == #fr]
-comment  'style pour eXpecco'
+comment  'style pour expecco'
 #endif
 
 menu.enteredLevel               0