comments; fixed #red/green/blueComponentOfPixel.
authorClaus Gittinger <cg@exept.de>
Tue, 08 Sep 1998 12:00:41 +0200
changeset 2301 60f9cf7dd066
parent 2300 87306f56da51
child 2302 9525834a6be7
comments; fixed #red/green/blueComponentOfPixel.
Depth24Image.st
--- a/Depth24Image.st	Tue Sep 08 11:59:30 1998 +0200
+++ b/Depth24Image.st	Tue Sep 08 12:00:41 1998 +0200
@@ -42,11 +42,11 @@
     Only the #rgb format is supported here.
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [see also:]
-        Depth1Image Depth2Image Depth4Image Depth8Image Depth16Image
-        ImageReader
+	Depth1Image Depth2Image Depth4Image Depth8Image Depth16Image
+	ImageReader
 "
 ! !
 
@@ -85,7 +85,7 @@
     bVal := bytes at:(index + 2).
 
     photometric ~~ #rgb ifTrue:[
-        ^ super colorAtX:x y:y
+	^ super colorAtX:x y:y
     ].
     ^ Color redByte:rVal greenByte:gVal blueByte:bVal
 
@@ -154,11 +154,11 @@
 
     dstIdx := (rowIndex * self bytesPerRow) + 1.
     1 to:width do:[:col |
-        pixel := pixelArray at:col.
-        bytes at:dstIdx put:((pixel bitShift:-16) bitAnd:16rFF).
-        bytes at:dstIdx+1 put:((pixel bitShift:-8) bitAnd:16rFF).
-        bytes at:dstIdx+2 put:(pixel bitAnd:16rFF).
-        dstIdx := dstIdx + 3.
+	pixel := pixelArray at:col.
+	bytes at:dstIdx put:((pixel bitShift:-16) bitAnd:16rFF).
+	bytes at:dstIdx+1 put:((pixel bitShift:-8) bitAnd:16rFF).
+	bytes at:dstIdx+2 put:(pixel bitAnd:16rFF).
+	dstIdx := dstIdx + 3.
     ].
     ^ pixelArray
 
@@ -174,11 +174,11 @@
 
     dstIdx := (rowIndex * self bytesPerRow) + 1.
     1 to:width do:[:col |
-        pixel := pixelArray at:(startIndex + col).
-        bytes at:dstIdx put:((pixel bitShift:-16) bitAnd:16rFF).
-        bytes at:dstIdx+1 put:((pixel bitShift:-8) bitAnd:16rFF).
-        bytes at:dstIdx+2 put:(pixel bitAnd:16rFF).
-        dstIdx := dstIdx + 3.
+	pixel := pixelArray at:(startIndex + col).
+	bytes at:dstIdx put:((pixel bitShift:-16) bitAnd:16rFF).
+	bytes at:dstIdx+1 put:((pixel bitShift:-8) bitAnd:16rFF).
+	bytes at:dstIdx+2 put:(pixel bitAnd:16rFF).
+	dstIdx := dstIdx + 3.
     ].
     ^ pixelArray
 
@@ -193,9 +193,9 @@
      greyScale displays."
 
     (aDevice visualType == #StaticGray) ifTrue:[
-        aDevice depth == 8 ifTrue:[
-            ^ self makeDeviceGrayPixmapOn:aDevice depth:aDevice depth fromArray:(self threshold8BitGrayBits)
-        ].
+	aDevice depth == 8 ifTrue:[
+	    ^ self makeDeviceGrayPixmapOn:aDevice depth:aDevice depth fromArray:(self threshold8BitGrayBits)
+	].
     ].
     ^ super asGrayFormOn:aDevice
 
@@ -208,12 +208,12 @@
      Pixel values are reduced to a 0..255 grey level."
 
     depth == 8 ifTrue:[
-        photometric == #rgb ifTrue:[
-            ^ Depth8Image
-                width:width
-                height:height
-                fromArray:(self threshold8BitGrayBits)
-        ]
+	photometric == #rgb ifTrue:[
+	    ^ Depth8Image
+		width:width
+		height:height
+		fromArray:(self threshold8BitGrayBits)
+	]
     ].
     ^ super asThresholdGrayImageDepth:depth
 
@@ -259,12 +259,12 @@
     |ditherColors|
 
     (ditherColors := aDevice fixColors) notNil ifTrue:[
-        ^ self 
-                rgbImageAsDitheredPseudoFormOn:aDevice
-                colors:ditherColors
-                nRed:aDevice numFixRed
-                nGreen:aDevice numFixGreen
-                nBlue:aDevice numFixBlue
+	^ self 
+		rgbImageAsDitheredPseudoFormOn:aDevice
+		colors:ditherColors
+		nRed:aDevice numFixRed
+		nGreen:aDevice numFixGreen
+		nBlue:aDevice numFixBlue
     ].
 
     ditherColors := Set new.
@@ -272,8 +272,8 @@
     ditherColors addAll:(aDevice deviceColors).
     ditherColors := ditherColors asArray.
     ^ self 
-        rgbImageAsDitheredPseudoFormOn:aDevice 
-        colors:ditherColors.
+	rgbImageAsDitheredPseudoFormOn:aDevice 
+	colors:ditherColors.
 
     "Modified: 22.4.1997 / 11:59:44 / cg"
 !
@@ -293,8 +293,8 @@
 
     numFix := fixColors size.
     numFix == 256 ifTrue:[
-        "/ algorithm below only handles 255 colors.
-        numFix := 255.
+	"/ algorithm below only handles 255 colors.
+	numFix := 255.
     ].
     fixIds := (fixColors asArray collect:[:clr | clr colorId]) asByteArray.
 
@@ -306,14 +306,14 @@
 
     deviceDepth := aDevice depth.
     deviceDepth == 8 ifTrue:[
-        has8BitImage := true.
+	has8BitImage := true.
     ] ifFalse:[
-        has8BitImage := false.
-        aDevice supportedImageFormats do:[:fmt |
-            (fmt at:#bitsPerPixel) == 8 ifTrue:[
-                has8BitImage := true.
-            ]
-        ]
+	has8BitImage := false.
+	aDevice supportedImageFormats do:[:fmt |
+	    (fmt at:#bitsPerPixel) == 8 ifTrue:[
+		has8BitImage := true.
+	    ]
+	]
     ].
     has8BitImage ifFalse:[^ nil].
 
@@ -343,114 +343,114 @@
      && __isByteArray(fixRed)
      && __isByteArray(fixGreen)
      && __isByteArray(fixBlue) ) {
-        failed = false;
+	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);
+	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;
+	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;
+		__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;
+		__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;
+		__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);
+		/*
+		 * 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;
+		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;
+		    /*
+		     * 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;
+			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;
+			eG = cG - __wantG;
+			if (eG < 0) eG = -eG;
 
-                        eB = cB - __wantB;
-                        if (eB < 0) eB = -eB;
+			eB = cB - __wantB;
+			if (eB < 0) eB = -eB;
 
-                        e = eR + eG + eB;
-                        if (e < minErr) {
-                            minErr = e;
-                            minIdx = i;
-                            if (e < 7) {
-                                break;
-                            }
-                        }
-                    }
+			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;
+		    /*
+		     * minIdx is now index into fixColors
+		     */
+		    cacheP[cacheIdx] = clrIdx = minIdx;
 /*
 printf("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;
+		/*
+		 * store the corresponding dither colorId
+		 */
+		*dstP++ = idP[clrIdx];
+		usedIdP[clrIdx] = 1;
 
-                srcP += 3;
+		srcP += 3;
 
-                /*
-                 * the new error:
-                 */
-                __eR = __wantR - redP[clrIdx]; 
-                __eG = __wantG - greenP[clrIdx]; 
-                __eB = __wantB - blueP[clrIdx]; 
-            }
-        }
+		/*
+		 * 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 on:aDevice.
@@ -462,9 +462,9 @@
 	bitsPerPixel:8 
 	depth:aDevice depth
 	padding:8
-        width:width height:height
-        x:0 y:0
-        into:(f id) 
+	width:width height:height
+	x:0 y:0
+	into:(f id) 
 	x:0 y:0 
 	width:width height:height 
 	with:(f gcId).
@@ -500,22 +500,22 @@
     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 ifTrue:[
-        has8BitImage := true.
+	has8BitImage := true.
     ] ifFalse:[
-        has8BitImage := false.
-        aDevice supportedImageFormats do:[:fmt |
-            (fmt at:#bitsPerPixel) == 8 ifTrue:[
-                has8BitImage := true.
-            ]
-        ]
+	has8BitImage := false.
+	aDevice supportedImageFormats do:[:fmt |
+	    (fmt at:#bitsPerPixel) == 8 ifTrue:[
+		has8BitImage := true.
+	    ]
+	]
     ].
     has8BitImage ifFalse:[^ nil].
 
@@ -547,136 +547,136 @@
      && __isByteArray(idsUsed)
      && __bothSmallInteger(fixR, fixG)
      && __isSmallInteger(fixB)) {
-        failed = false;
+	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;
+	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;
+	__eR = __eG = __eB = 0;
 
-        leftToRight = 1;
-        for (__y=__intVal(h); __y>0; __y--) {
-            if (leftToRight) {
-                for (__x=__w; __x>0; __x--) {
-                    int __want;
+	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;
+		    /*
+		     * 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;
+		    if (__want > 255) __want = 255;
+		    else if (__want < 0) __want = 0;
 
-                    iR = __want * __fR / 128;
-                    iR = (iR / 2) + (iR & 1);
+		    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;
+		    __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);
+		    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;
+		    __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);
+		    iB = __want * __fB / 128;
+		    iB = (iB / 2) + (iB & 1);
 
-                    idx = iR * (__fG+1);
-                    idx = (idx + iG) * (__fB+1);
-                    idx = idx + iB;
+		    idx = iR * (__fG+1);
+		    idx = (idx + iG) * (__fB+1);
+		    idx = idx + iB;
 
-                    /*
-                     * store the corresponding dither colorId
-                     */
-                    *dstP++ = idP[idx];
-                    usedIdP[idx] = 1;
+		    /*
+		     * store the corresponding dither colorId
+		     */
+		    *dstP++ = idP[idx];
+		    usedIdP[idx] = 1;
 
-                    srcP += 3;
+		    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;
+		    /*
+		     * 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;
+		    /*
+		     * 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;
+		    if (__want > 255) __want = 255;
+		    else if (__want < 0) __want = 0;
 
-                    iR = __want * __fR / 128;
-                    iR = (iR / 2) + (iR & 1);
+		    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;
+		    __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);
+		    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;
+		    __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);
+		    iB = __want * __fB / 128;
+		    iB = (iB / 2) + (iB & 1);
 
-                    idx = iR * (__fG+1);
-                    idx = (idx + iG) * (__fB+1);
-                    idx = idx + iB;
+		    idx = iR * (__fG+1);
+		    idx = (idx + iG) * (__fB+1);
+		    idx = idx + iB;
 
-                    /*
-                     * store the corresponding dither colorId
-                     */
-                    *--dstP = idP[idx];
-                    usedIdP[idx] = 1;
+		    /*
+		     * 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;
-            }
-        }
+		    /*
+		     * 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,9 +731,9 @@
     "/ 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 on:aDevice.
@@ -745,9 +745,9 @@
 	bitsPerPixel:8 
 	depth:aDevice depth
 	padding:8
-        width:width height:height
-        x:0 y:0
-        into:(f id) 
+	width:width height:height
+	x:0 y:0
+	into:(f id) 
 	x:0 y:0 
 	width:width height:height 
 	with:(f gcId).
@@ -780,10 +780,10 @@
      depth nColorCells deep nColorsNeeded|
 
     aDevice fixColors notNil ifTrue:[
-        "/ no need to look for used colors - dithering anyway ...
+	"/ no need to look for used colors - dithering anyway ...
 
-        f := self rgbImageAsDitheredPseudoFormOn:aDevice.
-        f notNil ifTrue:[^ f].
+	f := self rgbImageAsDitheredPseudoFormOn:aDevice.
+	f notNil ifTrue:[^ f].
     ].
 
     "find used colors; build color-tree"
@@ -802,205 +802,205 @@
     'Depth24Image [info]: allocating colors ...' infoPrintCR.
 
     [fit] whileFalse:[
-        [fitMap] whileFalse:[
-            srcIndex := 1.
-            redArray := Array new:256.
+	[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:[
+	    "
+	     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 (__isByteArray(_INST(bytes))) {
-                    int sI = __intVal(srcIndex);
-                    unsigned char *cp = __ByteArrayInstPtr(_INST(bytes))->ba_element;
+		if (__isByteArray(_INST(bytes))) {
+		    int sI = __intVal(srcIndex);
+		    unsigned char *cp = __ByteArrayInstPtr(_INST(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;
-                }
+		    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
-                ].
+		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:[
+		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
-            ].
+			srcIndex := dataSize + 1
+		    ]
+		]
+	    ].
+	    nColorsNeeded isNil ifTrue:[
+		nColorsNeeded := nColors
+	    ].
 
-            "again with less color bits if it does not fit colormap"
+	    "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
-                        ]
-                    ]
-                ].
+	    (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.
+	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.
+	"
+	 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|
+	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 on: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
-        ].
+			    (fit and:[present ~~ 0]) ifTrue:[
+				color := Color redByte:r
+					     greenByte:g
+					      blueByte:b.
+				color := color on: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"
+	"again with less color bits if we did not get all colors"
 
-        fit ifFalse:[
+	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.
+	    "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
-        ]
+	    "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.
+	"/ 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.
+	'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 asSet.
+	"/
+	"/ dither using those we got ...
+	"/
+	DitherAlgorithm == #floydSteinberg ifTrue:[
+	    colors := colors asSet.
 "/            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].
-            colors := colors asArray.
-            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].
+	    colors := colors asArray.
+	    colors size > 256 ifTrue:[
+		colors := colors copyTo:256
+	    ].
+	    f := self rgbImageAsDitheredPseudoFormOn:aDevice colors:colors.
+	    f notNil ifTrue:[^ f].
+	].
     ].
 
     "create pseudocolor bits and translate"
@@ -1013,34 +1013,34 @@
     (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 on:aDevice.
@@ -1052,9 +1052,9 @@
 	bitsPerPixel:8 
 	depth:depth
 	padding:8
-        width:width height:height
-        x:0 y:0
-        into:(f id) 
+	width:width height:height
+	x:0 y:0
+	into:(f id) 
 	x:0 y:0 
 	width:width height:height 
 	with:(f gcId).
@@ -1086,11 +1086,11 @@
     "/
     myDepth := self bitsPerPixel.
     myDepth == usedDeviceBitsPerPixel ifTrue:[
-        "/
-        "/ first, the trivial case, where the depths match
-        "/ 24 bit/pixel
-        "/
-        imageBits := bytes.
+	"/
+	"/ first, the trivial case, where the depths match
+	"/ 24 bit/pixel
+	"/
+	imageBits := bytes.
 	"/
 	"/ however, the rgb-order could still be different
 	"/
@@ -1100,313 +1100,313 @@
 
 	    "/ now, walk over the image and compose 24bit values from the r/g/b triples
 %{
-                if (__bothSmallInteger(_INST(height), _INST(width))
-                 && __bothSmallInteger(rightShiftR, shiftRed)
-                 && __bothSmallInteger(rightShiftG, shiftGreen)
-                 && __bothSmallInteger(rightShiftB, shiftBlue)
-                 && __isByteArray(_INST(bytes))
-                 && __isByteArray(imageBits)) {
-                    int rShRed = __intVal(rightShiftR),
-                        rShGreen = __intVal(rightShiftG),
-                        rShBlue = __intVal(rightShiftB),
-                        lShRed = __intVal(shiftRed),
-                        lShGreen = __intVal(shiftGreen),
-                        lShBlue = __intVal(shiftBlue);
-                    int x, y, w;
+		if (__bothSmallInteger(_INST(height), _INST(width))
+		 && __bothSmallInteger(rightShiftR, shiftRed)
+		 && __bothSmallInteger(rightShiftG, shiftGreen)
+		 && __bothSmallInteger(rightShiftB, shiftBlue)
+		 && __isByteArray(_INST(bytes))
+		 && __isByteArray(imageBits)) {
+		    int rShRed = __intVal(rightShiftR),
+			rShGreen = __intVal(rightShiftG),
+			rShBlue = __intVal(rightShiftB),
+			lShRed = __intVal(shiftRed),
+			lShGreen = __intVal(shiftGreen),
+			lShBlue = __intVal(shiftBlue);
+		    int x, y, w;
 
-                    unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element;
-                    unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
+		    unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element;
+		    unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
 
-                    w = __intVal(_INST(width));
-                    if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
-                        for (y=__intVal(_INST(height)); y > 0; y--) {
-                            for (x=w; x > 0; x--) {
-                                unsigned v;
+		    w = __intVal(_INST(width));
+		    if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
+			for (y=__intVal(_INST(height)); y > 0; y--) {
+			    for (x=w; x > 0; x--) {
+				unsigned v;
 
-                                v = srcPtr[0] << lShRed;
-                                v |= (srcPtr[1] << lShGreen);
-                                v |= (srcPtr[2] << lShBlue);
+				v = srcPtr[0] << lShRed;
+				v |= (srcPtr[1] << lShGreen);
+				v |= (srcPtr[2] << lShBlue);
 # ifdef MSBFIRST
-                                dstPtr[0] = (v) & 0xFF;
-                                dstPtr[1] = (v>>8) & 0xFF;
-                                dstPtr[2] = (v>>16) & 0xFF;
+				dstPtr[0] = (v) & 0xFF;
+				dstPtr[1] = (v>>8) & 0xFF;
+				dstPtr[2] = (v>>16) & 0xFF;
 # else
-                                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;
 # endif
-                                dstPtr += 3;
-                                srcPtr += 3;
-                            }
-                        }
-                    } else {
-                        for (y=__intVal(_INST(height)); y > 0; y--) {
-                            for (x=w; x > 0; x--) {
-                                unsigned r, g, b, v;
+				dstPtr += 3;
+				srcPtr += 3;
+			    }
+			}
+		    } else {
+			for (y=__intVal(_INST(height)); y > 0; y--) {
+			    for (x=w; x > 0; x--) {
+				unsigned r, g, b, v;
 
-                                r = srcPtr[0] >> rShRed;
-                                g = srcPtr[1] >> rShGreen;
-                                b = srcPtr[2] >> rShBlue;
-                                v = r << lShRed;
-                                v |= (g << lShGreen);
-                                v |= (b << lShBlue);
+				r = srcPtr[0] >> rShRed;
+				g = srcPtr[1] >> rShGreen;
+				b = srcPtr[2] >> rShBlue;
+				v = r << lShRed;
+				v |= (g << lShGreen);
+				v |= (b << lShBlue);
 # ifdef MSBFIRST
-                                dstPtr[0] = (v) & 0xFF;
-                                dstPtr[1] = (v>>8) & 0xFF;
-                                dstPtr[2] = (v>>16) & 0xFF;
+				dstPtr[0] = (v) & 0xFF;
+				dstPtr[1] = (v>>8) & 0xFF;
+				dstPtr[2] = (v>>16) & 0xFF;
 # else
-                                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;
 # endif
-                                dstPtr += 3;
-                                srcPtr += 3;
-                            }
-                        }
-                    }
-                }
+				dstPtr += 3;
+				srcPtr += 3;
+			    }
+			}
+		    }
+		}
 %}.
 	]
     ] ifFalse:[
-        "/
-        "/ 16 bit/pixel ...
-        "/
-        (usedDeviceBitsPerPixel == 16) ifTrue:[
+	"/
+	"/ 16 bit/pixel ...
+	"/
+	(usedDeviceBitsPerPixel == 16) ifTrue:[
 	    padd := width \\ (usedDevicePadding // 16).
-            imageBits := ByteArray uninitializedNew:((width + padd) * height * 2).
+	    imageBits := ByteArray uninitializedNew:((width + padd) * height * 2).
 
-            "/ now, walk over the image and compose 16bit values from the r/g/b triples
+	    "/ now, walk over the image and compose 16bit values from the r/g/b triples
 
 %{
-            if (__bothSmallInteger(_INST(height),_INST(width))
-             && __bothSmallInteger(rightShiftR, shiftRed)
-             && __bothSmallInteger(rightShiftG, shiftGreen)
-             && __bothSmallInteger(rightShiftB, shiftBlue)
-             && __isByteArray(_INST(bytes))
-             && __isByteArray(imageBits)) {
-                int rShRed = __intVal(rightShiftR),
-                    rShGreen = __intVal(rightShiftG),
-                    rShBlue = __intVal(rightShiftB),
-                    lShRed = __intVal(shiftRed),
-                    lShGreen = __intVal(shiftGreen),
-                    lShBlue = __intVal(shiftBlue);
-                int x, y, w;
+	    if (__bothSmallInteger(_INST(height),_INST(width))
+	     && __bothSmallInteger(rightShiftR, shiftRed)
+	     && __bothSmallInteger(rightShiftG, shiftGreen)
+	     && __bothSmallInteger(rightShiftB, shiftBlue)
+	     && __isByteArray(_INST(bytes))
+	     && __isByteArray(imageBits)) {
+		int rShRed = __intVal(rightShiftR),
+		    rShGreen = __intVal(rightShiftG),
+		    rShBlue = __intVal(rightShiftB),
+		    lShRed = __intVal(shiftRed),
+		    lShGreen = __intVal(shiftGreen),
+		    lShBlue = __intVal(shiftBlue);
+		int x, y, w;
 		int p;
 
-                unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
-                unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+		unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
+		unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
 
-                w = __intVal(_INST(width));
+		w = __intVal(_INST(width));
 		p = __intVal(padd) * 2;
 
-                if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
-                    for (y=__intVal(_INST(height)); y > 0; y--) {
-                        for (x=w; x > 0; x--) {
-                            unsigned v;
+		if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
+		    for (y=__intVal(_INST(height)); y > 0; y--) {
+			for (x=w; x > 0; x--) {
+			    unsigned v;
 
-                            v = srcPtr[0] << lShRed;
-                            v |= (srcPtr[1] << lShGreen);
-                            v |= (srcPtr[2] << lShBlue);
+			    v = srcPtr[0] << lShRed;
+			    v |= (srcPtr[1] << lShGreen);
+			    v |= (srcPtr[2] << lShBlue);
 # 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;
-                            srcPtr += 3;
-                        }
+			    dstPtr += 2;
+			    srcPtr += 3;
+			}
 			dstPtr += p;
-                    }
-                } else {
-                    for (y=__intVal(_INST(height)); y > 0; y--) {
-                        for (x=w; x > 0; x--) {
-                            unsigned r, g, b, v;
+		    }
+		} else {
+		    for (y=__intVal(_INST(height)); y > 0; y--) {
+			for (x=w; x > 0; x--) {
+			    unsigned r, g, b, v;
 
-                            r = srcPtr[0] >> rShRed;
-                            g = srcPtr[1] >> rShGreen;
-                            b = srcPtr[2] >> rShBlue;
-                            v = r << lShRed;
-                            v |= (g << lShGreen);
-                            v |= (b << lShBlue);
+			    r = srcPtr[0] >> rShRed;
+			    g = srcPtr[1] >> rShGreen;
+			    b = srcPtr[2] >> rShBlue;
+			    v = r << lShRed;
+			    v |= (g << lShGreen);
+			    v |= (b << lShBlue);
 # 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;
-                            srcPtr += 3;
-                        }
+			    dstPtr += 2;
+			    srcPtr += 3;
+			}
 			dstPtr += p;
-                    }
-                }
-            }
+		    }
+		}
+	    }
 %}.
-        ] ifFalse:[
-            "/
-            "/ 32 bits/pixel ...
-            "/
-            (usedDeviceBitsPerPixel == 32) ifTrue:[
-	        usedDevicePadding := 8.
-                imageBits := ByteArray uninitializedNew:(width * height * 4).
+	] ifFalse:[
+	    "/
+	    "/ 32 bits/pixel ...
+	    "/
+	    (usedDeviceBitsPerPixel == 32) ifTrue:[
+		usedDevicePadding := 8.
+		imageBits := ByteArray uninitializedNew:(width * height * 4).
 
-                "/ now, walk over the image and compose 32bit values from the r/g/b triples
+		"/ now, walk over the image and compose 32bit values from the r/g/b triples
 
 %{       
-                if (__bothSmallInteger(_INST(height), _INST(width))
-                 && __bothSmallInteger(rightShiftR, shiftRed)
-                 && __bothSmallInteger(rightShiftG, shiftGreen)
-                 && __bothSmallInteger(rightShiftB, shiftBlue)
-                 && __isByteArray(_INST(bytes))
-                 && __isByteArray(imageBits)) {
-                    int rShRed = __intVal(rightShiftR),
-                        rShGreen = __intVal(rightShiftG),
-                        rShBlue = __intVal(rightShiftB),
-                        lShRed = __intVal(shiftRed),
-                        lShGreen = __intVal(shiftGreen),
-                        lShBlue = __intVal(shiftBlue);
-                    int x, y, w;
+		if (__bothSmallInteger(_INST(height), _INST(width))
+		 && __bothSmallInteger(rightShiftR, shiftRed)
+		 && __bothSmallInteger(rightShiftG, shiftGreen)
+		 && __bothSmallInteger(rightShiftB, shiftBlue)
+		 && __isByteArray(_INST(bytes))
+		 && __isByteArray(imageBits)) {
+		    int rShRed = __intVal(rightShiftR),
+			rShGreen = __intVal(rightShiftG),
+			rShBlue = __intVal(rightShiftB),
+			lShRed = __intVal(shiftRed),
+			lShGreen = __intVal(shiftGreen),
+			lShBlue = __intVal(shiftBlue);
+		    int x, y, w;
 
-                    unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
-                    unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+		    unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
+		    unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
 
-                    w = __intVal(_INST(width));
-                    if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
-                        for (y=__intVal(_INST(height)); y > 0; y--) {
-                            for (x=w; x > 0; x--) {
-                                unsigned v;
+		    w = __intVal(_INST(width));
+		    if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
+			for (y=__intVal(_INST(height)); y > 0; y--) {
+			    for (x=w; x > 0; x--) {
+				unsigned v;
 
-                                v = srcPtr[0] << lShRed;
-                                v |= (srcPtr[1] << lShGreen);
-                                v |= (srcPtr[2] << lShBlue);
+				v = srcPtr[0] << lShRed;
+				v |= (srcPtr[1] << lShGreen);
+				v |= (srcPtr[2] << lShBlue);
 # ifdef MSBFIRST
-                                ((int *)dstPtr)[0] = v;
+				((int *)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 += 3;
-                            }
-                        }
-                    } else {
-                        for (y=__intVal(_INST(height)); y > 0; y--) {
-                            for (x=w; x > 0; x--) {
-                                unsigned r, g, b, v;
+				dstPtr += 4;
+				srcPtr += 3;
+			    }
+			}
+		    } else {
+			for (y=__intVal(_INST(height)); y > 0; y--) {
+			    for (x=w; x > 0; x--) {
+				unsigned r, g, b, v;
 
-                                r = srcPtr[0] >> rShRed;
-                                g = srcPtr[1] >> rShGreen;
-                                b = srcPtr[2] >> rShBlue;
-                                v = r << lShRed;
-                                v |= (g << lShGreen);
-                                v |= (b << lShBlue);
+				r = srcPtr[0] >> rShRed;
+				g = srcPtr[1] >> rShGreen;
+				b = srcPtr[2] >> rShBlue;
+				v = r << lShRed;
+				v |= (g << lShGreen);
+				v |= (b << lShBlue);
 # ifdef MSBFIRST
-                                ((int *)dstPtr)[0] = v;
+				((int *)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 += 3;
-                            }
-                        }
-                    }
-                }
+				dstPtr += 4;
+				srcPtr += 3;
+			    }
+			}
+		    }
+		}
 %}.
-            ] ifFalse:[
-                "/
-                "/ 8 bits/pixel ...
-                "/
-                (usedDeviceBitsPerPixel == 8) ifTrue:[
-	            usedDevicePadding := 8.
-                    imageBits := ByteArray uninitializedNew:(width * height).
+	    ] ifFalse:[
+		"/
+		"/ 8 bits/pixel ...
+		"/
+		(usedDeviceBitsPerPixel == 8) ifTrue:[
+		    usedDevicePadding := 8.
+		    imageBits := ByteArray uninitializedNew:(width * height).
 
-                    "/ now, walk over the image and compose 8bit values from the r/g/b triples
+		    "/ now, walk over the image and compose 8bit values from the r/g/b triples
 
 %{              
-                    if (__bothSmallInteger(_INST(height), _INST(width))
-                     && __bothSmallInteger(rightShiftR, shiftRed)
-                     && __bothSmallInteger(rightShiftG, shiftGreen)
-                     && __bothSmallInteger(rightShiftB, shiftBlue)
-                     && __isByteArray(_INST(bytes))
-                     && __isByteArray(imageBits)) {
-                        int rShRed = __intVal(rightShiftR),
-                            rShGreen = __intVal(rightShiftG),
-                            rShBlue = __intVal(rightShiftB),
-                            lShRed = __intVal(shiftRed),
-                            lShGreen = __intVal(shiftGreen),
-                            lShBlue = __intVal(shiftBlue);
-                        int x, y, w;
+		    if (__bothSmallInteger(_INST(height), _INST(width))
+		     && __bothSmallInteger(rightShiftR, shiftRed)
+		     && __bothSmallInteger(rightShiftG, shiftGreen)
+		     && __bothSmallInteger(rightShiftB, shiftBlue)
+		     && __isByteArray(_INST(bytes))
+		     && __isByteArray(imageBits)) {
+			int rShRed = __intVal(rightShiftR),
+			    rShGreen = __intVal(rightShiftG),
+			    rShBlue = __intVal(rightShiftB),
+			    lShRed = __intVal(shiftRed),
+			    lShGreen = __intVal(shiftGreen),
+			    lShBlue = __intVal(shiftBlue);
+			int x, y, w;
 
-                        unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
-                        unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
+			unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element;
+			unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element;
 
-                        w = __intVal(_INST(width));
-                        if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
-                            for (y=__intVal(_INST(height)); y > 0; y--) {
-                                for (x=w; x > 0; x--) {
-                                    unsigned v;
+			w = __intVal(_INST(width));
+			if ((rShRed == 0) && (rShGreen == 0) && (rShBlue == 0)) {
+			    for (y=__intVal(_INST(height)); y > 0; y--) {
+				for (x=w; x > 0; x--) {
+				    unsigned v;
 
-                                    v = srcPtr[0] << lShRed;
-                                    v |= (srcPtr[1] << lShGreen);
-                                    v |= (srcPtr[2] << lShBlue);
-                                    dstPtr[0] = v;
+				    v = srcPtr[0] << lShRed;
+				    v |= (srcPtr[1] << lShGreen);
+				    v |= (srcPtr[2] << lShBlue);
+				    dstPtr[0] = v;
 
-                                    dstPtr += 1;
-                                    srcPtr += 3;
-                                }
-                            }
-                        } else {
-                            for (y=__intVal(_INST(height)); y > 0; y--) {
-                                for (x=w; x > 0; x--) {
-                                    unsigned r, g, b, v;
+				    dstPtr += 1;
+				    srcPtr += 3;
+				}
+			    }
+			} else {
+			    for (y=__intVal(_INST(height)); y > 0; y--) {
+				for (x=w; x > 0; x--) {
+				    unsigned r, g, b, v;
 
-                                    r = srcPtr[0] >> rShRed;
-                                    g = srcPtr[1] >> rShGreen;
-                                    b = srcPtr[2] >> rShBlue;
-                                    v = r << lShRed;
-                                    v |= (g << lShGreen);
-                                    v |= (b << lShBlue);
+				    r = srcPtr[0] >> rShRed;
+				    g = srcPtr[1] >> rShGreen;
+				    b = srcPtr[2] >> rShBlue;
+				    v = r << lShRed;
+				    v |= (g << lShGreen);
+				    v |= (b << lShBlue);
 
-                                    dstPtr[0] = v;
+				    dstPtr[0] = v;
 
-                                    dstPtr += 1;
-                                    srcPtr += 3;
-                                }
-                            }
-                        }
-                    }
+				    dstPtr += 1;
+				    srcPtr += 3;
+				}
+			    }
+			}
+		    }
 %}.
-                ]
-            ].
-        ]
+		]
+	    ].
+	]
     ].
 
     imageBits isNil ifTrue:[            
-        'IMAGE: unimplemented trueColor depth in #rgbImageAsTrueColorFormOn: ' errorPrint.
-        usedDeviceBitsPerPixel errorPrintCR.
-        ^ self asMonochromeFormOn:aDevice
+	'IMAGE: unimplemented trueColor depth in #rgbImageAsTrueColorFormOn: ' errorPrint.
+	usedDeviceBitsPerPixel errorPrintCR.
+	^ self asMonochromeFormOn:aDevice
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth on:aDevice.
     form isNil ifTrue:[
-        'Depth24Image [warning]: display bitmap creation failed' errorPrintCR.
-        ^ nil
+	'Depth24Image [warning]: display bitmap creation failed' errorPrintCR.
+	^ nil
     ].
     form initGC.
 
     form 
-        copyBitsFrom:imageBits 
+	copyBitsFrom:imageBits 
 	bitsPerPixel:usedDeviceBitsPerPixel 
 	depth:usedDeviceDepth 
 	padding:usedDevicePadding
-        width:width height:height 
-        x:0 y:0 toX:0 y:0. 
+	width:width height:height 
+	x:0 y:0 toX:0 y:0. 
 
     ^ form
 
@@ -1437,7 +1437,7 @@
     (samplesPerPixel ~~ 3
     or:[bitsPerSample ~= #(8 8 8)
     or:[depth > 8]]) ifTrue:[
-        ^ super floydSteinbergDitheredGrayBitsDepth:depth
+	^ super floydSteinbergDitheredGrayBitsDepth:depth
     ].
 
     w := width.
@@ -1447,26 +1447,26 @@
     bytesPerOutRow := ((w * depth) + 7) // 8.
     outBits := ByteArray uninitializedNew:(bytesPerOutRow * h).
     (outBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     depth ~~ 8 ifTrue:[
-        greyLevels := (1 bitShift:depth) - 1.
-        greyMap1 := Array new:256.
-        greyMap2 := Array new:256.
-        1 to:256 do:[:i |
-            v := (greyLevels / 255 * (i-1)).
-            greyMap1 at:i put:v.
-            greyMap2 at:i put:v.
-        ].
-        greyMap1 := (greyMap1 collect:[:b | b truncated]) asByteArray.      
+	greyLevels := (1 bitShift:depth) - 1.
+	greyMap1 := Array new:256.
+	greyMap2 := Array new:256.
+	1 to:256 do:[:i |
+	    v := (greyLevels / 255 * (i-1)).
+	    greyMap1 at:i put:v.
+	    greyMap2 at:i put:v.
+	].
+	greyMap1 := (greyMap1 collect:[:b | b truncated]) asByteArray.      
 
-        greyMap2 := (greyMap2 collect:[:el | 
-                                            ((el - el truncated)  "/ the error (0..1)
-                                                * 255) rounded]) asByteArray.
+	greyMap2 := (greyMap2 collect:[:el | 
+					    ((el - el truncated)  "/ the error (0..1)
+						* 255) rounded]) asByteArray.
 
-        errorArray := ByteArray new:(w + 2) * 2.
-        errorArray1 := ByteArray new:(w + 2) * 2.
+	errorArray := ByteArray new:(w + 2) * 2.
+	errorArray1 := ByteArray new:(w + 2) * 2.
     ].
 
 %{
@@ -1497,90 +1497,90 @@
     short *__t;
 
     if (__depth == 8) {
-        /*
-         * special code for destination depth 8
-         */
-        for (__y=0; __y<__h; __y++) {
-            __nextDst = __dstIdx + __bytesPerOutRow;
-            __nextSrc = __srcIdx + __bytesPerRow;
-            for (__x=0; __x<__w; __x++) {
-                __grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
-                         + (__bytes[__srcIdx+1] * 6)
-                         + __bytes[__srcIdx+2];   
-                __pixel = __grey / 10;                      /* 0 .. 255 */
+	/*
+	 * special code for destination depth 8
+	 */
+	for (__y=0; __y<__h; __y++) {
+	    __nextDst = __dstIdx + __bytesPerOutRow;
+	    __nextSrc = __srcIdx + __bytesPerRow;
+	    for (__x=0; __x<__w; __x++) {
+		__grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
+			 + (__bytes[__srcIdx+1] * 6)
+			 + __bytes[__srcIdx+2];   
+		__pixel = __grey / 10;                      /* 0 .. 255 */
 
-                __srcIdx += 3;
-                __outBits[__dstIdx] = __pixel;
-               __dstIdx++;
-            }
-            __srcIdx = __nextSrc;
-            __dstIdx = __nextDst;
-        }
+		__srcIdx += 3;
+		__outBits[__dstIdx] = __pixel;
+	       __dstIdx++;
+	    }
+	    __srcIdx = __nextSrc;
+	    __dstIdx = __nextDst;
+	}
     } else {
-        bzero(errorArray1, (__w+2) * 2);
+	bzero(errorArray1, (__w+2) * 2);
 
-        __bitCnt = 8;
-        for (__y=0; __y<__h; __y++) {
-            __nextDst = __dstIdx + __bytesPerOutRow;
-            __nextSrc = __srcIdx + __bytesPerRow;
+	__bitCnt = 8;
+	for (__y=0; __y<__h; __y++) {
+	    __nextDst = __dstIdx + __bytesPerOutRow;
+	    __nextSrc = __srcIdx + __bytesPerRow;
 
-            __byte = 0;
+	    __byte = 0;
 
-            __t = __errorArray;
-            __errorArray = __errorArray1;
-            __errorArray1 = __t;
-            bzero(errorArray1, (__w+2) * 2);
+	    __t = __errorArray;
+	    __errorArray = __errorArray1;
+	    __errorArray1 = __t;
+	    bzero(errorArray1, (__w+2) * 2);
 
-            for (__x=0; __x<__w; __x++) {
-                __grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
-                         + (__bytes[__srcIdx+1] * 6)
-                         + __bytes[__srcIdx+2];   
-                __grey = __grey / 10;                      /* 0 .. 255 */
+	    for (__x=0; __x<__w; __x++) {
+		__grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
+			 + (__bytes[__srcIdx+1] * 6)
+			 + __bytes[__srcIdx+2];   
+		__grey = __grey / 10;                      /* 0 .. 255 */
 
-                __pixel = __greyMap1[__grey];            /* 0..(greyLevels-1) */
-                __err = __greyMap2[__grey];              /* 0.. 255 - error) */
-                __err += __errorArray[__x+1];
+		__pixel = __greyMap1[__grey];            /* 0..(greyLevels-1) */
+		__err = __greyMap2[__grey];              /* 0.. 255 - error) */
+		__err += __errorArray[__x+1];
 
-                if (__err > 127) {                        /* dither says: next pixel */
-                   if ( __pixel != __greyLevels)
-                        __pixel++;
-                    __err = __err - 255;
-                } else {
-                }
-                if (__err) {
-                    __e16 = __err >> 4;
-                    __eR = __e16 * 7;                    /* 7/16 -> right pixel */
-                    __eRB = __e16 * 1;                   /* 1/16 -> right below */
-                    __eB = __e16 * 5;                    /* 5/16 -> below */
-                    __eLB = __err - __eR - __eRB - __eB; /* 3/16 -> left below */
+		if (__err > 127) {                        /* dither says: next pixel */
+		   if ( __pixel != __greyLevels)
+			__pixel++;
+		    __err = __err - 255;
+		} else {
+		}
+		if (__err) {
+		    __e16 = __err >> 4;
+		    __eR = __e16 * 7;                    /* 7/16 -> right pixel */
+		    __eRB = __e16 * 1;                   /* 1/16 -> right below */
+		    __eB = __e16 * 5;                    /* 5/16 -> below */
+		    __eLB = __err - __eR - __eRB - __eB; /* 3/16 -> left below */
                     
-                    __errorArray [__x+1+1] += __eR;      
-                    __errorArray1[__x+1+1] += __eRB;     
-                    __errorArray1[__x+1  ] += __eB;      
-                    __errorArray1[__x+1-1] += __eLB;     
-                }
+		    __errorArray [__x+1+1] += __eR;      
+		    __errorArray1[__x+1+1] += __eRB;     
+		    __errorArray1[__x+1  ] += __eB;      
+		    __errorArray1[__x+1-1] += __eLB;     
+		}
 
-                __srcIdx += 3;
+		__srcIdx += 3;
 
-                __byte = (__byte << __depth) | __pixel;
+		__byte = (__byte << __depth) | __pixel;
 
-                __bitCnt = __bitCnt - __depth;
-                if (__bitCnt == 0) {
-                    __outBits[__dstIdx] = __byte;
-                    __dstIdx++;
-                    __byte = 0;
-                    __bitCnt = 8;
-                }
-            }
+		__bitCnt = __bitCnt - __depth;
+		if (__bitCnt == 0) {
+		    __outBits[__dstIdx] = __byte;
+		    __dstIdx++;
+		    __byte = 0;
+		    __bitCnt = 8;
+		}
+	    }
 
-            if (__bitCnt != 8) {
-                __byte = __byte << __bitCnt;
-                __outBits[__dstIdx] = __byte;
-                __bitCnt = 8;
-            }
-            __srcIdx = __nextSrc;
-            __dstIdx = __nextDst;
-        }
+	    if (__bitCnt != 8) {
+		__byte = __byte << __bitCnt;
+		__outBits[__dstIdx] = __byte;
+		__bitCnt = 8;
+	    }
+	    __srcIdx = __nextSrc;
+	    __dstIdx = __nextDst;
+	}
     }
 %}.
 
@@ -1614,8 +1614,8 @@
      h               "{Class: SmallInteger }"|
 
     photometric ~~ #rgb ifTrue:[
-        self error:'invalid format'.
-        ^ nil
+	self error:'invalid format'.
+	^ nil
     ].
 
     nDither := ditherMatrix size.
@@ -1630,32 +1630,32 @@
     bytesPerOutRow := (w * depth + 7) // 8.
     outBits := ByteArray uninitializedNew:(bytesPerOutRow * h).
     (outBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     greyMap1 := Array new:256.
     greyMap2 := Array new:256.
     range := greyLevels-1.
     1 to:256 do:[:i |
-        v := (range / 255 * (i-1)).
-        greyMap1 at:i put:v.
-        greyMap2 at:i put:v.
+	v := (range / 255 * (i-1)).
+	greyMap1 at:i put:v.
+	greyMap2 at:i put:v.
     ].
 
     greyMap1 := (greyMap1 collect:[:b | b isNil ifTrue:[
-                                            0
-                                        ] ifFalse:[
-                                            b truncated
-                                        ]
-                                  ]) asByteArray.      
+					    0
+					] ifFalse:[
+					    b truncated
+					]
+				  ]) asByteArray.      
 
     greyMap2 := (greyMap2 collect:[:el | 
-                                        el isNil ifTrue:[
-                                            0
-                                        ] ifFalse:[
-                                            ((el - el truncated)  "/ the error (0..1)
-                                            * nDither) rounded
-                                        ]]) asByteArray.
+					el isNil ifTrue:[
+					    0
+					] ifFalse:[
+					    ((el - el truncated)  "/ the error (0..1)
+					    * nDither) rounded
+					]]) asByteArray.
 %{
     int __dW = __intVal(dW);
     int __dH = __intVal(dH);
@@ -1686,56 +1686,56 @@
 
     __oY = __dY = 0;
     for (__y=0; __y<__h; __y++) {
-        __nextDst = __dstIdx + __bytesPerOutRow;
-        __nextSrc = __srcIdx + __bytesPerRow;
+	__nextDst = __dstIdx + __bytesPerOutRow;
+	__nextSrc = __srcIdx + __bytesPerRow;
 
-        __byte = 0;
-        __bitCnt = 8;
+	__byte = 0;
+	__bitCnt = 8;
 
-        __oX = 0;
+	__oX = 0;
 
-        for (__x=0; __x<__w; __x++) {
-            __grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
-                     + (__bytes[__srcIdx+1] * 6)
-                     + __bytes[__srcIdx+2];   
-            __grey = __grey / 10;                      /* 0 .. 255 */
+	for (__x=0; __x<__w; __x++) {
+	    __grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
+		     + (__bytes[__srcIdx+1] * 6)
+		     + __bytes[__srcIdx+2];   
+	    __grey = __grey / 10;                      /* 0 .. 255 */
 
-            __pixel = __greyMap1[__grey];            /* 0..(greyLevels-1) */
-            __dO    = __greyMap2[__grey];            /* 0.. nDither-1) */
-            __dT = __ditherMatrix[__dY + __oX];
+	    __pixel = __greyMap1[__grey];            /* 0..(greyLevels-1) */
+	    __dO    = __greyMap2[__grey];            /* 0.. nDither-1) */
+	    __dT = __ditherMatrix[__dY + __oX];
 
-            if (__dO > __dT)                         /* dither says: next pixel */
-                __pixel++;
+	    if (__dO > __dT)                         /* dither says: next pixel */
+		__pixel++;
 
-            __srcIdx += 3;
+	    __srcIdx += 3;
 
-            __oX++;
-            if (__oX == __dW) __oX = 0;
+	    __oX++;
+	    if (__oX == __dW) __oX = 0;
 
-            __byte = (__byte << __depth) | __pixel;
+	    __byte = (__byte << __depth) | __pixel;
 
-            __bitCnt = __bitCnt - __depth;
-            if (__bitCnt == 0) {
-                __outBits[__dstIdx] = __byte;
-                __dstIdx++;
-                __byte = 0;
-                __bitCnt = 8;
-            }
-        }
+	    __bitCnt = __bitCnt - __depth;
+	    if (__bitCnt == 0) {
+		__outBits[__dstIdx] = __byte;
+		__dstIdx++;
+		__byte = 0;
+		__bitCnt = 8;
+	    }
+	}
 
-        if (__bitCnt != 8) {
-            __byte = __byte << __bitCnt;
-            __outBits[__dstIdx] = __byte;
-        }
+	if (__bitCnt != 8) {
+	    __byte = __byte << __bitCnt;
+	    __outBits[__dstIdx] = __byte;
+	}
 
-        __oY++; __dY += __dW;
-        if (__oY == __dH) {
-            __oY = 0;
-            __dY = 0;
-        }
+	__oY++; __dY += __dW;
+	if (__oY == __dH) {
+	    __oY = 0;
+	    __dY = 0;
+	}
 
-        __srcIdx = __nextSrc;
-        __dstIdx = __nextDst;
+	__srcIdx = __nextSrc;
+	__dstIdx = __nextDst;
     }
 %}.
 
@@ -1768,8 +1768,8 @@
      h               "{Class: SmallInteger }"|
 
     photometric ~~ #rgb ifTrue:[
-        self error:'invalid format'.
-        ^ nil
+	self error:'invalid format'.
+	^ nil
     ].
 
     nDither := ditherMatrix size.
@@ -1783,7 +1783,7 @@
     bytesPerMonoRow := w + 7 // 8.
     monoBits := ByteArray uninitializedNew:(bytesPerMonoRow * h).
     (monoBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
 %{
@@ -1812,53 +1812,53 @@
 
     __oY = __dY = 0;
     for (__y=0; __y<__h; __y++) {
-        __nextDst = __dstIdx + __bytesPerMonoRow;
-        __nextSrc = __srcIdx + __bytesPerRow;
+	__nextDst = __dstIdx + __bytesPerMonoRow;
+	__nextSrc = __srcIdx + __bytesPerRow;
 
-        __byte = 0;
-        __bitCnt = 8;
+	__byte = 0;
+	__bitCnt = 8;
 
-        __oX = 0;
+	__oX = 0;
 
-        for (__x=0; __x<__w; __x++) {
-            __grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
-                     + (__bytes[__srcIdx+1] * 6)
-                     + __bytes[__srcIdx+2];   
-            __grey = __grey * (__nDither+1) / 2550;    /* 0 .. nDither+1 */
-            __srcIdx += 3;
+	for (__x=0; __x<__w; __x++) {
+	    __grey = (__bytes[__srcIdx] * 3)           /* 0.3*r + 0.6*g + b -> 0..2550 */
+		     + (__bytes[__srcIdx+1] * 6)
+		     + __bytes[__srcIdx+2];   
+	    __grey = __grey * (__nDither+1) / 2550;    /* 0 .. nDither+1 */
+	    __srcIdx += 3;
 
-            __dT = __ditherMatrix[__dY + __oX];
+	    __dT = __ditherMatrix[__dY + __oX];
 
-            __oX++;
-            if (__oX == __dW) __oX = 0;
+	    __oX++;
+	    if (__oX == __dW) __oX = 0;
 
-            __byte = __byte << 1;
-            if (__grey > __dT) {
-                __byte = __byte | 1;                   /* white */
-            }
+	    __byte = __byte << 1;
+	    if (__grey > __dT) {
+		__byte = __byte | 1;                   /* white */
+	    }
 
-            __bitCnt--;
-            if (__bitCnt == 0) {
-                __monoBits[__dstIdx] = __byte;
-                __dstIdx++;
-                __byte = 0;
-                __bitCnt = 8;
-            }
-        }
+	    __bitCnt--;
+	    if (__bitCnt == 0) {
+		__monoBits[__dstIdx] = __byte;
+		__dstIdx++;
+		__byte = 0;
+		__bitCnt = 8;
+	    }
+	}
 
-        if (__bitCnt != 8) {
-            __byte = __byte << __bitCnt;
-            __monoBits[__dstIdx] = __byte;
-        }
+	if (__bitCnt != 8) {
+	    __byte = __byte << __bitCnt;
+	    __monoBits[__dstIdx] = __byte;
+	}
 
-        __oY++; __dY += __dW;
-        if (__oY == __dH) {
-            __oY = 0;
-            __dY = 0;
-        }
+	__oY++; __dY += __dW;
+	if (__oY == __dH) {
+	    __oY = 0;
+	    __dY = 0;
+	}
 
-        __srcIdx = __nextSrc;
-        __dstIdx = __nextDst;
+	__srcIdx = __nextSrc;
+	__dstIdx = __nextDst;
     }
 %}.
 
@@ -1891,19 +1891,19 @@
 
     if ((__Class(__INST(bytes)) == ByteArray)
      && (__Class(greyBits) == ByteArray)) {
-        srcPtr = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-        dstPtr = __ByteArrayInstPtr(greyBits)->ba_element;
+	srcPtr = __ByteArrayInstPtr(__INST(bytes))->ba_element;
+	dstPtr = __ByteArrayInstPtr(greyBits)->ba_element;
 
-        i = __intVal(__INST(height)) * __intVal(__INST(width));
+	i = __intVal(__INST(height)) * __intVal(__INST(width));
 
-        for (; i > 0; i--) {
-            __v = (srcPtr[0] * 3);     /* 3*r + 6*g + b ; 0 .. 2550 */
-            __v += (srcPtr[1] * 6);
-            __v += srcPtr[2];
-            srcPtr += 3;
-            __v /= 10;                 /* 0..255 */
-            *dstPtr++ = __v ;
-        }
+	for (; i > 0; i--) {
+	    __v = (srcPtr[0] * 3);     /* 3*r + 6*g + b ; 0 .. 2550 */
+	    __v += (srcPtr[1] * 6);
+	    __v += srcPtr[2];
+	    srcPtr += 3;
+	    __v /= 10;                 /* 0..255 */
+	    *dstPtr++ = __v ;
+	}
     }
 %}.
     ^ greyBits
@@ -1929,7 +1929,7 @@
      lastR lastG lastB lastColor|
 
     photometric ~~ #rgb ifTrue:[
-        ^ super colorsAtY:y from:xLow to:xHigh do:aBlock.
+	^ super colorsAtY:y from:xLow to:xHigh do:aBlock.
     ].
 
     x1 := xLow.
@@ -1938,18 +1938,18 @@
     srcIndex := 1 + (((width * y) + x1) * 3).
 
     x1 to:x2 do:[:x |
-        rVal := bytes at:(srcIndex).
-        gVal := bytes at:(srcIndex + 1).
-        bVal := bytes at:(srcIndex + 2).
-        srcIndex := srcIndex + 3.
+	rVal := bytes at:(srcIndex).
+	gVal := bytes at:(srcIndex + 1).
+	bVal := bytes at:(srcIndex + 2).
+	srcIndex := srcIndex + 3.
 
-        (rVal == lastR and:[gVal == lastG and:[bVal == lastB]]) ifFalse:[
-            lastColor := Color redByte:rVal greenByte:gVal blueByte:bVal.
-            lastR := rVal.
-            lastG := gVal.
-            lastB := bVal.
-        ].
-        aBlock value:x value:lastColor
+	(rVal == lastR and:[gVal == lastG and:[bVal == lastB]]) ifFalse:[
+	    lastColor := Color redByte:rVal greenByte:gVal blueByte:bVal.
+	    lastR := rVal.
+	    lastG := gVal.
+	    lastB := bVal.
+	].
+	aBlock value:x value:lastColor
     ]
 
     "Created: / 7.6.1996 / 19:12:28 / cg"
@@ -1979,11 +1979,11 @@
     srcIndex := 1 + (((width * y) + x1) * 3).
 
     x1 to:x2 do:[:x |
-        r := bytes at:(srcIndex).
-        g := bytes at:(srcIndex + 1).
-        b := bytes at:(srcIndex + 2).
-        srcIndex := srcIndex + 3.
-        aBlock value:x value:(((r bitShift:16) bitOr:(g bitShift:8)) bitOr:b)
+	r := bytes at:(srcIndex).
+	g := bytes at:(srcIndex + 1).
+	b := bytes at:(srcIndex + 2).
+	srcIndex := srcIndex + 3.
+	aBlock value:x value:(((r bitShift:16) bitOr:(g bitShift:8)) bitOr:b)
     ]
 
     "Created: 7.6.1996 / 19:09:40 / cg"
@@ -1995,22 +1995,22 @@
     |index newImage newBytes nBytes r g b|
 
     photometric ~~ #rgb ifTrue:[
-        ^ super negative.
+	^ super negative.
     ].
     newImage := self copy.
     nBytes := bytes size.
     newImage bits:(newBytes := ByteArray new:nBytes).
     index := 1.
     [index < nBytes] whileTrue:[
-        r := bytes at:index.
-        newBytes at:index put:(255-r).
-        index := index + 1.
-        g := bytes at:index.
-        newBytes at:index put:(255-g).
-        index := index + 1.
-        b := bytes at:index.
-        newBytes at:index put:(255-b).
-        index := index + 1.
+	r := bytes at:index.
+	newBytes at:index put:(255-r).
+	index := index + 1.
+	g := bytes at:index.
+	newBytes at:index put:(255-g).
+	index := index + 1.
+	b := bytes at:index.
+	newBytes at:index put:(255-b).
+	index := index + 1.
     ].
     ^ newImage
 
@@ -2050,19 +2050,19 @@
     ].
 
     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.
 
     mY := mY asFloat.
     mX := mX asFloat.
@@ -2081,86 +2081,86 @@
     double _mY = __floatVal(mY);
 
     for (_row = 0; _row <= _h; _row++) {
-        double _srcY;
-        double _dY;
-        int _sR;
+	double _srcY;
+	double _dY;
+	int _sR;
 
-        _srcY = ((double)_row / _mY);
-        _sR = (int)_srcY;
-        _dY = _srcY - ((double)_sR);
-        _srcRowP = _srcP + (_width3 * _sR);
+	_srcY = ((double)_row / _mY);
+	_sR = (int)_srcY;
+	_dY = _srcY - ((double)_sR);
+	_srcRowP = _srcP + (_width3 * _sR);
 
-        for (_col = 0; _col <= _w; _col++) {
-            unsigned int rHere, gHere, bHere;
-            unsigned int rRight, gRight, bRight;
-            unsigned int rRightBelow, gRightBelow, bRightBelow;
-            unsigned int rBelow, gBelow, bBelow;
-            unsigned int _r, _g, _b;
-            double wHere, wRight, wRightBelow, wBelow, sumW;
-            double _srcX;
-            double _dX;
-            int _sC;
+	for (_col = 0; _col <= _w; _col++) {
+	    unsigned int rHere, gHere, bHere;
+	    unsigned int rRight, gRight, bRight;
+	    unsigned int rRightBelow, gRightBelow, bRightBelow;
+	    unsigned int rBelow, gBelow, bBelow;
+	    unsigned int _r, _g, _b;
+	    double wHere, wRight, wRightBelow, wBelow, sumW;
+	    double _srcX;
+	    double _dX;
+	    int _sC;
 
-            _srcX = ((double)_col / _mX);
-            _sC = (int)_srcX;
-            _dX = _srcX - ((double)_sC);
-            sP = _srcRowP + (_sC * 3);
+	    _srcX = ((double)_col / _mX);
+	    _sC = (int)_srcX;
+	    _dX = _srcX - ((double)_sC);
+	    sP = _srcRowP + (_sC * 3);
         
-            rHere = sP[0];
-            gHere = sP[1];
-            bHere = sP[2];
+	    rHere = sP[0];
+	    gHere = sP[1];
+	    bHere = sP[2];
 
-            if (_sC < _oldW) {
-                rRight = sP[3];
-                gRight = sP[4];
-                bRight = sP[5];
+	    if (_sC < _oldW) {
+		rRight = sP[3];
+		gRight = sP[4];
+		bRight = sP[5];
 
-                if (_sR < _oldH) {
-                    rBelow = sP[0+_width3];
-                    gBelow = sP[1+_width3];
-                    bBelow = sP[2+_width3];
-                    rRightBelow = sP[3+_width3];
-                    gRightBelow = sP[4+_width3];
-                    bRightBelow = sP[5+_width3];
-                } else {
-                    rRightBelow = rHere;
-                    gRightBelow = gHere;
-                    bRightBelow = bHere;
-                    rBelow = rHere;
-                    gBelow = gHere;
-                    bBelow = bHere;
-                }
-            } else {
-                rRight = rRightBelow = rHere;
-                gRight = gRightBelow = gHere;
-                bRight = bRightBelow = bHere;
-                if (_sR < _oldH) {
-                    rBelow = sP[0+_width3];
-                    gBelow = sP[1+_width3];
-                    bBelow = sP[2+_width3];
-                } else {
-                    rBelow = rHere;
-                    gBelow = gHere;
-                    bBelow = bHere;
-                }
-            }
+		if (_sR < _oldH) {
+		    rBelow = sP[0+_width3];
+		    gBelow = sP[1+_width3];
+		    bBelow = sP[2+_width3];
+		    rRightBelow = sP[3+_width3];
+		    gRightBelow = sP[4+_width3];
+		    bRightBelow = sP[5+_width3];
+		} else {
+		    rRightBelow = rHere;
+		    gRightBelow = gHere;
+		    bRightBelow = bHere;
+		    rBelow = rHere;
+		    gBelow = gHere;
+		    bBelow = bHere;
+		}
+	    } else {
+		rRight = rRightBelow = rHere;
+		gRight = gRightBelow = gHere;
+		bRight = bRightBelow = bHere;
+		if (_sR < _oldH) {
+		    rBelow = sP[0+_width3];
+		    gBelow = sP[1+_width3];
+		    bBelow = sP[2+_width3];
+		} else {
+		    rBelow = rHere;
+		    gBelow = gHere;
+		    bBelow = bHere;
+		}
+	    }
 
-            wHere = (1.0 - _dX) * (1.0 - _dY);
-            wRight = _dX * (1.0 - _dY);
-            wBelow = _dY * (1.0 - _dX);
-            wRightBelow = _dX * _dY;
-            sumW = wHere + wRight + wBelow + wRightBelow;
+	    wHere = (1.0 - _dX) * (1.0 - _dY);
+	    wRight = _dX * (1.0 - _dY);
+	    wBelow = _dY * (1.0 - _dX);
+	    wRightBelow = _dX * _dY;
+	    sumW = wHere + wRight + wBelow + wRightBelow;
 
-            _r = ((rHere * wHere) + (rRight * wRight) + (rBelow * wBelow) + (rRightBelow * wRightBelow)) / sumW;
-            _g = ((gHere * wHere) + (gRight * wRight) + (gBelow * wBelow) + (gRightBelow * wRightBelow)) / sumW;
-            _b = ((bHere * wHere) + (bRight * wRight) + (bBelow * wBelow) + (bRightBelow * wRightBelow)) / sumW;
+	    _r = ((rHere * wHere) + (rRight * wRight) + (rBelow * wBelow) + (rRightBelow * wRightBelow)) / sumW;
+	    _g = ((gHere * wHere) + (gRight * wRight) + (gBelow * wBelow) + (gRightBelow * wRightBelow)) / sumW;
+	    _b = ((bHere * wHere) + (bRight * wRight) + (bBelow * wBelow) + (bRightBelow * wRightBelow)) / sumW;
 
-            _dstP[0] = _r;
-            _dstP[1] = _g;
-            _dstP[2] = _b;
+	    _dstP[0] = _r;
+	    _dstP[1] = _g;
+	    _dstP[2] = _b;
 
-            _dstP += 3;
-        }
+	    _dstP += 3;
+	}
     }
 %}.
 
@@ -2174,8 +2174,8 @@
     "
      |i|
      i := Depth24Image width:3 height:3 fromArray:#[ 0 0 0  0 0 0  0 0 0
-                                                     0 0 0  255 255 255  0 0 0
-                                                     0 0 0  0 0 0  0 0 0].
+						     0 0 0  255 255 255  0 0 0
+						     0 0 0  0 0 0  0 0 0].
      i hardAntiAliasedMagnifiedBy:8@8
     "
 
@@ -2209,19 +2209,19 @@
     newBytes := ByteArray uninitializedNew:(newWidth * 3 * 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:#(8 8 8) 
-        colorMap:nil
-        bits:newBytes
-        mask:newMask.
+	width:newWidth 
+	height:newHeight 
+	photometric:photometric 
+	samplesPerPixel:samplesPerPixel 
+	bitsPerSample:#(8 8 8) 
+	colorMap:nil
+	bits:newBytes
+	mask:newMask.
 
     "walk over destination image fetching pixels from source image"
 
@@ -2239,14 +2239,14 @@
     double _mY = _floatVal(mY);
 
     for (_row = 0; _row <= _h; _row++) {
-        _srcRowP = _srcP + (_width3 * (int)((double)_row / _mY));
-        for (_col = 0; _col <= _w; _col++) {
-            sP = _srcRowP + (((int)((double)_col / _mX)) * 3);
-            _dstP[0] = sP[0];
-            _dstP[1] = sP[1];
-            _dstP[2] = sP[2];
-            _dstP += 3;
-        }
+	_srcRowP = _srcP + (_width3 * (int)((double)_row / _mY));
+	for (_col = 0; _col <= _w; _col++) {
+	    sP = _srcRowP + (((int)((double)_col / _mX)) * 3);
+	    _dstP[0] = sP[0];
+	    _dstP[1] = sP[1];
+	    _dstP[2] = sP[2];
+	    _dstP += 3;
+	}
     }
 %}
 .
@@ -2256,17 +2256,17 @@
     w := newWidth - 1.
     h := newHeight - 1.
     0 to:h do:[:row |
-        srcRowIdx := (width * 3 * (row // mY)) + 1.
-        0 to:w do:[:col |
-            srcIndex := srcRowIdx + ((col // mX) * 3).
-            value := bytes at:srcIndex.
-            newBytes at:dstIndex put:value.
-            value := bytes at:(srcIndex + 1).
-            newBytes at:(dstIndex + 1) put:value.
-            value := bytes at:(srcIndex + 2).
-            newBytes at:(dstIndex + 2) put:value.
-            dstIndex := dstIndex + 3
-        ]
+	srcRowIdx := (width * 3 * (row // mY)) + 1.
+	0 to:w do:[:col |
+	    srcIndex := srcRowIdx + ((col // mX) * 3).
+	    value := bytes at:srcIndex.
+	    newBytes at:dstIndex put:value.
+	    value := bytes at:(srcIndex + 1).
+	    newBytes at:(dstIndex + 1) put:value.
+	    value := bytes at:(srcIndex + 2).
+	    newBytes at:(dstIndex + 2) put:value.
+	    dstIndex := dstIndex + 3
+	]
     ].
 "
     ^ newImage
@@ -2337,12 +2337,16 @@
 !
 
 blueBitsOf:pixel
+    "given a pixel-value, return the blue component as byteValue (0..255)"
+
     ^ pixel bitAnd:16rFF.
 
     "Created: 8.6.1996 / 09:56:20 / cg"
 !
 
 blueComponentOf:pixel
+    "given a pixel-value, return the blue component in percent (0..100)"
+
     ^ (100.0 / 255.0) * (pixel bitAnd:16rFF)
 
     "Created: 8.6.1996 / 08:42:44 / cg"
@@ -2356,6 +2360,8 @@
 !
 
 greenBitsOf:pixel
+    "given a pixel-value, return the green component as byteValue (0..255)"
+
     ^ (pixel bitShift:-8) bitAnd:16rFF.
 
     "Modified: 8.6.1996 / 08:56:28 / cg"
@@ -2363,13 +2369,17 @@
 !
 
 greenComponentOf:pixel
-    ^ (100.0 / 255.0) * (pixel bitShift:-8) bitAnd:16rFF.
+    "given a pixel-value, return the green component in percent (0..100)"
+
+    ^ (100.0 / 255.0) * ((pixel bitShift:-8) bitAnd:16rFF).
 
     "Created: 8.6.1996 / 08:42:37 / cg"
     "Modified: 8.6.1996 / 09:57:32 / cg"
 !
 
 redBitsOf:pixel
+    "given a pixel-value, return the red component as byteValue (0..255)"
+
     ^ (pixel bitShift:-16) bitAnd:16rFF.
 
     "Modified: 8.6.1996 / 08:56:31 / cg"
@@ -2377,7 +2387,9 @@
 !
 
 redComponentOf:pixel
-    ^ (100.0 / 255.0) * (pixel bitShift:-16) bitAnd:16rFF.
+    "given a pixel-value, return the red component in percent (0..100)"
+
+    ^ (100.0 / 255.0) * ((pixel bitShift:-16) bitAnd:16rFF).
 
     "Created: 8.6.1996 / 08:42:25 / cg"
     "Modified: 8.6.1996 / 09:57:23 / cg"
@@ -2395,5 +2407,5 @@
 !Depth24Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.64 1998-07-27 18:03:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.65 1998-09-08 10:00:41 cg Exp $'
 ! !