improved hardRotate
authorClaus Gittinger <cg@exept.de>
Wed, 23 Apr 1997 11:04:42 +0200
changeset 1642 c14ef12246aa
parent 1641 b7c128be3394
child 1643 21cde7805ad4
improved hardRotate
Image.st
--- a/Image.st	Wed Apr 23 01:11:09 1997 +0200
+++ b/Image.st	Wed Apr 23 11:04:42 1997 +0200
@@ -56,14 +56,14 @@
 
     Usually, you get a device specific representation of the image by
     sending the 
-        'on:aDevice' 
+	'on:aDevice' 
     message to it, which will create a (possibly dithered) device-form, 
     representing the image using the currently available colors.
 
     In rare cases, an explicit monochrome representation of the image is needed 
     (X servers take monochrome icons only), this can be created by sending
     it the message 
-        'monochromeOn:aDevice'.
+	'monochromeOn:aDevice'.
 
     Also, it is planned to generate another hi-color resolution version,
     which uses its own colormap and allows the use of all 256 colors on an 8bit display 
@@ -99,360 +99,360 @@
        DitherAlgorithm:
 
        nil                  a simple threshold algorithm
-                            (i.e. for mono, p<0.5 -> black, p>=0.5 -> white)
+			    (i.e. for mono, p<0.5 -> black, p>=0.5 -> white)
 
        #pattern             patterned dither
-                            (for p, take dithered color to fill pixel;
-                             uses dithering in color-class)
+			    (for p, take dithered color to fill pixel;
+			     uses dithering in color-class)
 
        #error               error diffusion dither (Floyd-Steinberg)
-                            planned - not yet implemented.
+			    planned - not yet implemented.
 
 
 
     [instance variables:]
 
-        width               <Integer>       the width in pixels
-        height              <Integer>       the height in pixels
-        bytes               <ByteArray>     the full image information
-        photometric         <Symbol>        #rgb, #palette, #blackIs0 or #whiteIs0
-        samplesPerPixel     <Integer>       the number of planes
-        bitsPerSample       <Array>         the number of bits per plane
-
-        colorMap            <Array>         only if photometric is #pseudocolor;
-                                            maps pixel values to r/g/b values.
-
-        device              <Workstation>   the device on which deviceForm,
-                                            monoDeviceForm and lowResDeviceForm are
-
-        deviceForm          <Form>          the device form which gives the best
-                                            possible aproximation of the image on
-                                            device using standard colors.
-
-        monoDeviceForm      <Form>          the device form which gives a monochrome
-                                            aproximation of the image on device.
-
-        fullColorDeviceForm <Form>          the device form which gives the best
-                                            possible aproximation of the image on
-                                            device using private colors.
-
-	bitsPerPixel			    not used in ST/X
-        depth				    these have been added in instVar-slots
-	maxPixelValue 			    according to the ST-80's image class.
-        rowByteSize			    to allow loading of st-80 images
+	width               <Integer>       the width in pixels
+	height              <Integer>       the height in pixels
+	bytes               <ByteArray>     the full image information
+	photometric         <Symbol>        #rgb, #palette, #blackIs0 or #whiteIs0
+	samplesPerPixel     <Integer>       the number of planes
+	bitsPerSample       <Array>         the number of bits per plane
+
+	colorMap            <Array>         only if photometric is #pseudocolor;
+					    maps pixel values to r/g/b values.
+
+	device              <Workstation>   the device on which deviceForm,
+					    monoDeviceForm and lowResDeviceForm are
+
+	deviceForm          <Form>          the device form which gives the best
+					    possible aproximation of the image on
+					    device using standard colors.
+
+	monoDeviceForm      <Form>          the device form which gives a monochrome
+					    aproximation of the image on device.
+
+	fullColorDeviceForm <Form>          the device form which gives the best
+					    possible aproximation of the image on
+					    device using private colors.
+
+	bitsPerPixel                        not used in ST/X
+	depth                               these have been added in instVar-slots
+	maxPixelValue                       according to the ST-80's image class.
+	rowByteSize                         to allow loading of st-80 images
 					    (which are stored as instVarAt:put: expressions)
 
     [class variables:]
 
-        Lobby               <Registry>      keeps track of known images
-                                            (for resource freeing with garbage collector)
-
-        DitherAlgorithm     <Symbol>        defines how to dither
-
-        NumberOfDitherColors <Integer>      defines, how many dither colors to use
-
-        FileFormats         <Dictionary>    associates filename extensions to
-                                            image reader classes (now set-up in startup-file)
-
-        CollectGarbageWhenRunningOutOfColors
-                            <Boolean>       if true, and we run out of available
-                                            device colors during creation of a
-                                            device image, collect garbage for
-                                            possible image reclamation.
-                                            If false, proceed immediately.
-                                            Default is true.
-
-        ImageNotFoundNotificationSignal
-                            <QuerySignal>   raised, if an image could not be loaded
-                                            from a file. The parameter is the images
-                                            fileName. May return a replacement
-                                            image or proceed with nil.
-                                            If unhandled, a nil is returned from the
-                                            image creation.
+	Lobby               <Registry>      keeps track of known images
+					    (for resource freeing with garbage collector)
+
+	DitherAlgorithm     <Symbol>        defines how to dither
+
+	NumberOfDitherColors <Integer>      defines, how many dither colors to use
+
+	FileFormats         <Dictionary>    associates filename extensions to
+					    image reader classes (now set-up in startup-file)
+
+	CollectGarbageWhenRunningOutOfColors
+			    <Boolean>       if true, and we run out of available
+					    device colors during creation of a
+					    device image, collect garbage for
+					    possible image reclamation.
+					    If false, proceed immediately.
+					    Default is true.
+
+	ImageNotFoundNotificationSignal
+			    <QuerySignal>   raised, if an image could not be loaded
+					    from a file. The parameter is the images
+					    fileName. May return a replacement
+					    image or proceed with nil.
+					    If unhandled, a nil is returned from the
+					    image creation.
 
     todo:
-        there is currently no mask stored/available in the image itself; currently masks
-        have to be stored as separate bitmaps. 
-        (which is bad for image-file formats, which provide a mask)
-        Thus, currently, all images are completely opaque.
+	there is currently no mask stored/available in the image itself; currently masks
+	have to be stored as separate bitmaps. 
+	(which is bad for image-file formats, which provide a mask)
+	Thus, currently, all images are completely opaque.
 
     [See also:]
-        Form Icon ImageReader
+	Form Icon ImageReader
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 "
 !
 
 examples
 "
     reading from a file (many formats are supported):
-                                                                        [exBegin]
-        (Image fromFile:'bitmaps/claus.gif') inspect
-                                                                        [exEnd]
-                                                                        [exBegin]
-        (Image fromFile:'bitmaps/SmalltalkX.xbm') inspect
-                                                                        [exEnd]
-                                                                        [exBegin]
-        (Image fromFile:'bitmaps/okSmily_up.bmp') inspect
-                                                                        [exEnd]
+									[exBegin]
+	(Image fromFile:'bitmaps/claus.gif') inspect
+									[exEnd]
+									[exBegin]
+	(Image fromFile:'bitmaps/SmalltalkX.xbm') inspect
+									[exEnd]
+									[exBegin]
+	(Image fromFile:'bitmaps/okSmily_up.bmp') inspect
+									[exEnd]
 
     inline image:
       default: depth=1 & #blackIs0
-                                                                        [exBegin]
-        (Image width:8 height:8
-               fromArray:#( 2r11111111
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r11111111 )) inspect
-                                                                        [exEnd]
+									[exBegin]
+	(Image width:8 height:8
+	       fromArray:#( 2r11111111
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r11111111 )) inspect
+									[exEnd]
 
       with #whiteIs0 photometric
-                                                                        [exBegin]
-        ((Image width:8 height:8
-               fromArray:#( 2r11111111
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r10000001
-                            2r11111111 ))
-            photometric:#whiteIs0)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Image width:8 height:8
+	       fromArray:#( 2r11111111
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r11111111 ))
+	    photometric:#whiteIs0)
+		 inspect
+									[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)))
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Image width:8 height:8
+	       fromArray:#( 2r11111111
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r10000001
+			    2r11111111 ))
+	    colorMap:(Array with:(Color red)
+			    with:(Color yellow)))
+		 inspect
+									[exEnd]
 
       a depth4 greyScale image:
-                                                                        [exBegin]
-        ((Depth4Image
-             width:4 
-             height:4
-             fromArray:#[ 
-                            16r01 16r23
-                            16r45 16r67
-                            16r89 16rab
-                            16rcd 16ref 
-                        ])
-            magnifiedBy:30)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Depth4Image
+	     width:4 
+	     height:4
+	     fromArray:#[ 
+			    16r01 16r23
+			    16r45 16r67
+			    16r89 16rab
+			    16rcd 16ref 
+			])
+	    magnifiedBy:30)
+		 inspect
+									[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)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Image
+	     width:4 
+	     height:4
+	     depth:4
+	     fromArray:#[ 
+			    16r01 16r23
+			    16r45 16r67
+			    16r89 16rab
+			    16rcd 16ref 
+			])
+	    magnifiedBy:30)
+		 inspect
+									[exEnd]
       with reverse grey-interpretation:
-                                                                        [exBegin]
-        ((Depth4Image
-             width:4 
-             height:4
-             fromArray:#[ 
-                            16r01 16r23
-                            16r45 16r67
-                            16r89 16rab
-                            16rcd 16ref 
-                        ])
-            photometric:#whiteIs0;
-            magnifiedBy:30)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Depth4Image
+	     width:4 
+	     height:4
+	     fromArray:#[ 
+			    16r01 16r23
+			    16r45 16r67
+			    16r89 16rab
+			    16rcd 16ref 
+			])
+	    photometric:#whiteIs0;
+	    magnifiedBy:30)
+		 inspect
+									[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)
-                 inspect
-                                                                        [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)
+		 inspect
+									[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)
-                 inspect
-                                                                        [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)
+		 inspect
+									[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 inspect.
-                                                                        [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 inspect.
+									[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 inspect.
-                                                                        [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 inspect.
+									[exEnd]
 
 
       a 2plane greyscale image:
-                                                                        [exBegin]
-        ((Depth2Image
-             width:4 
-             height:4
-             fromArray:#[ 
-                            4r0123
-                            4r1230
-                            4r2301
-                            4r3012 
-                        ])
-            magnifiedBy:30)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Depth2Image
+	     width:4 
+	     height:4
+	     fromArray:#[ 
+			    4r0123
+			    4r1230
+			    4r2301
+			    4r3012 
+			])
+	    magnifiedBy:30)
+		 inspect
+									[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)
-                 inspect
-                                                                        [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)
+		 inspect
+									[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:30)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Depth8Image
+	     width:16 
+	     height:16
+	     fromArray:(ByteArray withAll:(0 to:16rFF)))
+	    photometric:#rgb;
+	    samplesPerPixel:3;
+	    bitsPerSample:#(3 3 2);
+	    magnifiedBy:30)
+		 inspect
+									[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:30)
-                 inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Depth8Image
+	     width:8 
+	     height:8
+	     fromArray:(ByteArray withAll:(0 to:16r3F)))
+	    photometric:#rgb;
+	    samplesPerPixel:3;
+	    bitsPerSample:#(2 2 2);
+	    magnifiedBy:30)
+		 inspect
+									[exEnd]
 
     storing (only a few formats are currently supported):
-                                                                        [exBegin]
-        |img|
-
-        img := Image fromFile:'bitmaps/okSmily_up.bmp'.
-        img saveOn:'myImage.tiff'.
-        (Image fromFile:'myImage.tiff') inspect
-                                                                        [exEnd]
+									[exBegin]
+	|img|
+
+	img := Image fromFile:'bitmaps/okSmily_up.bmp'.
+	img saveOn:'myImage.tiff'.
+	(Image fromFile:'myImage.tiff') inspect
+									[exEnd]
     magnifying (any factor):
-                                                                        [exBegin]
-        ((Image fromFile:'bitmaps/claus.gif') 
-            magnifiedTo:(48@48))
-                inspect
-                                                                        [exEnd]
-                                                                        [exBegin]
-        ((Image fromFile:'bitmaps/claus.gif') 
-            magnifiedBy:0.7)
-                inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Image fromFile:'bitmaps/claus.gif') 
+	    magnifiedTo:(48@48))
+		inspect
+									[exEnd]
+									[exBegin]
+	((Image fromFile:'bitmaps/claus.gif') 
+	    magnifiedBy:0.7)
+		inspect
+									[exEnd]
     rotating (currently, only multiples of 90 degrees are supported):
-                                                                        [exBegin]
-        ((Image fromFile:'bitmaps/claus.gif') 
-            rotated:90)
-                inspect
-                                                                        [exEnd]
-                                                                        [exBegin]
-        (((Image fromFile:'bitmaps/claus.gif') 
-            magnifiedBy:0.3@0.7) rotated:270)
-                inspect
-                                                                        [exEnd]
+									[exBegin]
+	((Image fromFile:'bitmaps/claus.gif') 
+	    rotated:90)
+		inspect
+									[exEnd]
+									[exBegin]
+	(((Image fromFile:'bitmaps/claus.gif') 
+	    magnifiedBy:0.3@0.7) rotated:270)
+		inspect
+									[exEnd]
 "
 ! !
 
@@ -493,7 +493,7 @@
     "simply release all deviceForms"
 
     Lobby do:[:anImage |
-        anImage restored
+	anImage restored
     ]
 
     "Modified: 15.6.1996 / 15:45:02 / cg"
@@ -504,49 +504,49 @@
 
     "setup tracker of known pictures"
     Lobby isNil ifTrue:[
-        Lobby := Registry new.
-        ObjectMemory addDependent:self.
-
-        "/ define the algorithm to use for dithering - 
-        "/ supported values are:
-        "/      #threshold
-        "/      #ordered
-        "/      #floydSteinberg
-        "/      #burkes
-
-        DitherAlgorithm := #floydSteinberg.   
-
-        (Display notNil and:[Display hasGrayscales]) ifFalse:[
-            NumberOfDitherColors := 64
-        ] ifTrue:[
-            "as far as I remember, this is about the number of grey values, the eye can distinguish"
-            NumberOfDitherColors := 100
-        ].
-
-        "define reader classes"
-        FileFormats isNil ifTrue:[
-            self initializeFileFormatTable
-        ].
-
-        CollectGarbageWhenRunningOutOfColors := false.
-
-        ImageNotFoundQuerySignal := QuerySignal new.
-        ImageNotFoundQuerySignal nameClass:self message:#imageNotFoundQuerySignal.
-
-        ImageSaveErrorSignal := ErrorSignal newSignalMayProceed:true.
-        ImageSaveErrorSignal nameClass:self message:#imageSaveErrorSignal.
-
-        FileCreationErrorSignal := ImageSaveErrorSignal newSignalMayProceed:true.
-        FileCreationErrorSignal nameClass:self message:#fileCreationErrorSignal.
-
-        CannotRepresentImageSignal := ImageSaveErrorSignal newSignalMayProceed:true.
-        CannotRepresentImageSignal nameClass:self message:#cannotRepresentImageSignal.
-
-        InformationLostQuerySignal := QuerySignal new.
-        InformationLostQuerySignal nameClass:self message:#informationLostQuerySignal.
-
-        BadImageFormatQuerySignal := QuerySignal new.
-        BadImageFormatQuerySignal nameClass:self message:#badImageFormatQuerySignal.
+	Lobby := Registry new.
+	ObjectMemory addDependent:self.
+
+	"/ define the algorithm to use for dithering - 
+	"/ supported values are:
+	"/      #threshold
+	"/      #ordered
+	"/      #floydSteinberg
+	"/      #burkes
+
+	DitherAlgorithm := #floydSteinberg.   
+
+	(Display notNil and:[Display hasGrayscales]) ifFalse:[
+	    NumberOfDitherColors := 64
+	] ifTrue:[
+	    "as far as I remember, this is about the number of grey values, the eye can distinguish"
+	    NumberOfDitherColors := 100
+	].
+
+	"define reader classes"
+	FileFormats isNil ifTrue:[
+	    self initializeFileFormatTable
+	].
+
+	CollectGarbageWhenRunningOutOfColors := false.
+
+	ImageNotFoundQuerySignal := QuerySignal new.
+	ImageNotFoundQuerySignal nameClass:self message:#imageNotFoundQuerySignal.
+
+	ImageSaveErrorSignal := ErrorSignal newSignalMayProceed:true.
+	ImageSaveErrorSignal nameClass:self message:#imageSaveErrorSignal.
+
+	FileCreationErrorSignal := ImageSaveErrorSignal newSignalMayProceed:true.
+	FileCreationErrorSignal nameClass:self message:#fileCreationErrorSignal.
+
+	CannotRepresentImageSignal := ImageSaveErrorSignal newSignalMayProceed:true.
+	CannotRepresentImageSignal nameClass:self message:#cannotRepresentImageSignal.
+
+	InformationLostQuerySignal := QuerySignal new.
+	InformationLostQuerySignal nameClass:self message:#informationLostQuerySignal.
+
+	BadImageFormatQuerySignal := QuerySignal new.
+	BadImageFormatQuerySignal nameClass:self message:#badImageFormatQuerySignal.
     ]
 
     "Modified: 27.2.1997 / 12:42:13 / cg"
@@ -576,7 +576,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"
@@ -665,21 +665,21 @@
     device := aForm device.
 
     (device notNil and:[depth == device 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 := device 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 := device visualType.
+	(vis == #TrueColor or:[vis == #DirectColor]) ifTrue:[
+	    depth > 8 ifTrue:[
+		depth := 24.
+	    ]
+	].
     ].
     img := (self implementorForDepth:depth) new.
     device isNil ifTrue:[
-        ^ img fromForm:aForm.
+	^ img fromForm:aForm.
     ].
     ^ img from:aForm in:(0@0 extent:(aForm extent))
 
@@ -732,9 +732,9 @@
     |newImage|
 
     self == Image ifTrue:[
-        newImage := self implementorForDepth:anImage depth.
+	newImage := self implementorForDepth:anImage depth.
     ] ifFalse:[
-        newImage := self new.
+	newImage := self new.
     ].
     ^ newImage fromSubImage:anImage in:aRectangle.
 
@@ -798,48 +798,48 @@
      depth (8-bit padded)."
 
     ^ (self implementorForDepth:d) new 
-                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].
     "
 
     "Modified: 10.6.1996 / 18:18:10 / cg"
@@ -855,30 +855,30 @@
     img := (self implementorForDepth:d) new width:w height:h depth:d .
 
     padding ~~ 8 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.
-        srcRowBytes := ((w * d + padding - 1) bitShift:-5) bitShift:2.
-
-        newBits := ByteArray new:(dstRowBytes * h).
-        srcIndex := 1.
-        dstIndex := 1.
-
-        1 to:h do:[:row |
-            newBits replaceFrom:dstIndex 
-                             to:(dstIndex + dstRowBytes - 1)
-                           with:pixelData
-                     startingAt:srcIndex.
-            srcIndex := srcIndex + srcRowBytes.
-            dstIndex := dstIndex + dstRowBytes.
-        ].
+	"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.
+	srcRowBytes := ((w * d + padding - 1) bitShift:-5) bitShift:2.
+
+	newBits := ByteArray new:(dstRowBytes * h).
+	srcIndex := 1.
+	dstIndex := 1.
+
+	1 to:h do:[:row |
+	    newBits replaceFrom:dstIndex 
+			     to:(dstIndex + dstRowBytes - 1)
+			   with:pixelData
+		     startingAt:srcIndex.
+	    srcIndex := srcIndex + srcRowBytes.
+	    dstIndex := dstIndex + dstRowBytes.
+	].
     ] 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
@@ -896,29 +896,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"
@@ -1002,14 +1002,14 @@
      to release all cached Images from that device"
 
     Lobby 
-        unregisterAllForWhich:[:anImage | 
-                |ok|
-                ok := anImage graphicsDevice == aDevice.
-                ok ifTrue:[
-                    anImage quickRelease
-                ].
-                ok
-        ]
+	unregisterAllForWhich:[:anImage | 
+		|ok|
+		ok := anImage graphicsDevice == aDevice.
+		ok ifTrue:[
+		    anImage quickRelease
+		].
+		ok
+	]
 
     "Created: 16.1.1997 / 19:30:44 / cg"
     "Modified: 16.1.1997 / 19:33:49 / cg"
@@ -1037,19 +1037,19 @@
 
     inStream := Smalltalk systemFileStreamFor:name.
     inStream isNil ifTrue:[
-        inStream := Smalltalk bitmapFileStreamFor:name.
-        inStream isNil ifTrue:[
-
-            "/ this signal is a query - if noone seems to
-            "/ care, return nil.
-            "/ However, a handler may provide a replacement.
+	inStream := Smalltalk bitmapFileStreamFor:name.
+	inStream isNil ifTrue:[
+
+	    "/ this signal is a query - if noone seems to
+	    "/ care, return nil.
+	    "/ However, a handler may provide a replacement.
 
 "/            ('IMAGE: ' , aFileName , ' does not exist or is not readable') infoPrintCR.
-            ^ ImageNotFoundQuerySignal
-                        raiseRequestWith:aFileName
-                        errorString:('IMAGE: ''' , aFileName , ''' does not exist or is not readable').
-        ].
-        name := 'bitmaps/' , name.
+	    ^ ImageNotFoundQuerySignal
+			raiseRequestWith:aFileName
+			errorString:('IMAGE: ''' , aFileName , ''' does not exist or is not readable').
+	].
+	name := 'bitmaps/' , name.
     ].
     inStream close.
 
@@ -1061,13 +1061,13 @@
     "/ handle compressed-suffix
     "/
     (#('Z' 'gz') includes:suffix) ifTrue:[
-        fn := fn withoutSuffix.
-        nm := fn name.
-        suffix := fn suffix.
+	fn := fn withoutSuffix.
+	nm := fn name.
+	suffix := fn suffix.
     ].
 
     suffix isEmpty ifTrue:[
-        suffix := nm.
+	suffix := nm.
     ].
 
     "/
@@ -1076,8 +1076,8 @@
 
     readerClass := FileFormats at:(suffix asLowercase) ifAbsent:nil.
     readerClass notNil ifTrue:[
-        image := readerClass fromFile:name.
-        image notNil ifTrue:[^ image].
+	image := readerClass fromFile:name.
+	image notNil ifTrue:[^ image].
     ].
 
     "
@@ -1087,11 +1087,11 @@
      therefore, it takes a bit longer.
     "
     FileFormats do:[:readerClass |
-        readerClass notNil ifTrue:[
-            (readerClass isValidImageFile:name) ifTrue:[
-                ^ readerClass fromFile:name 
-            ]
-        ]
+	readerClass notNil ifTrue:[
+	    (readerClass isValidImageFile:name) ifTrue:[
+		^ readerClass fromFile:name 
+	    ]
+	]
     ].
 
     "/ nope - unknown format
@@ -1102,8 +1102,8 @@
 
 "/    'IMAGE: unknown image file format: ' infoPrint. aFileName infoPrintNL.
     ^ ImageNotFoundQuerySignal
-                raiseRequestWith:aFileName
-                errorString:('IMAGE: unknown image file format: ''' , aFileName , '''').
+		raiseRequestWith:aFileName
+		errorString:('IMAGE: unknown image file format: ''' , aFileName , '''').
 
     "
      Image fromFile:'bitmaps/dano.tiff'
@@ -1131,10 +1131,10 @@
 
      Image imageNotFoundQuerySignal 
      handle:[:ex |
-        ex errorString printCR.
-        ex proceedWith:nil
+	ex errorString printCR.
+	ex proceedWith:nil
      ] do:[
-         Image fromFile:'fooBar'
+	 Image fromFile:'fooBar'
      ]
     "
 
@@ -1143,7 +1143,7 @@
      Image imageNotFoundQuerySignal 
      answer:(Image fromFile:'bitmaps/SmalltalkX.xbm')
      do:[
-         Image fromFile:'fooBar'
+	 Image fromFile:'fooBar'
      ]
     "
 
@@ -1159,7 +1159,7 @@
 
     img := self fromFile:aFileName.
     img notNil ifTrue:[
-        ^ img on:aDevice
+	^ img on:aDevice
     ].
     ^ nil
 
@@ -1193,8 +1193,8 @@
     "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
     ].
 
     dpiH := dev horizontalPixelPerInch.
@@ -1205,8 +1205,8 @@
 
     img := img magnifiedBy:(mag @ mag).
     aDevice notNil ifTrue:[
-        "should not happen ..."
-        ^ img on:aDevice
+	"should not happen ..."
+	^ img on:aDevice
     ].
     ^ img
 
@@ -1228,10 +1228,10 @@
      this format ...
     "
     FileFormats do:[:readerClass |
-        readerClass notNil ifTrue:[
-            image := readerClass fromStream:aStream.
-            image notNil ifTrue:[^ image].
-        ]
+	readerClass notNil ifTrue:[
+	    image := readerClass fromStream:aStream.
+	    image notNil ifTrue:[^ image].
+	]
     ].
 
     "
@@ -1240,8 +1240,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').
 
     "
      Image fromFile:'bitmaps/dano.tiff'
@@ -1284,8 +1284,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"
@@ -1295,10 +1295,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
 
@@ -1307,10 +1307,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
 
@@ -1334,33 +1334,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
@@ -1442,16 +1442,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
@@ -1464,13 +1464,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)
@@ -1484,13 +1484,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)
@@ -1513,8 +1513,8 @@
      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|
 
@@ -1527,9 +1527,9 @@
     "/
     vis := aDisplay visualType.
     (vis == #TrueColor or:[vis == #DirectColor]) ifTrue:[
-        depth > 8 ifTrue:[
-            depth := 24.
-        ]
+	depth > 8 ifTrue:[
+	    depth := 24.
+	]
     ].
 
     img := (self implementorForDepth: depth) new.
@@ -1544,8 +1544,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)."
 
     ^ self fromScreen:(Rectangle fromUser)
 
@@ -1561,8 +1561,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
 
@@ -1582,12 +1582,12 @@
      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)
@@ -1617,15 +1617,15 @@
      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 dev|
 
     dev := aView graphicsDevice.
     org := dev translatePoint:(0@0)
-                         from:(aView id)
-                           to:dev rootWindowId.
+			 from:(aView id)
+			   to:dev rootWindowId.
     ^ self fromScreen:(org extent:aView extent) on:dev grab:doGrab
 
     "Created: 26.3.1997 / 10:34:20 / cg"
@@ -1675,23 +1675,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'.
@@ -1742,29 +1742,29 @@
 
     (aColorMap isNil and:[colorMap isNil]) ifTrue:[^ self].
     photometric == #palette ifTrue:[
-        "/ any change at all ?
-        (sz := aColorMap size) == colorMap size ifTrue:[
-            sameColors := true.
-
-            1 to:sz do:[:idx |
-                (aColorMap at:idx) = (colorMap at:idx) ifFalse:[
-                    sameColors := false.
-                ]
-            ].
-            sameColors ifTrue:[^ self].
-        ]
+	"/ any change at all ?
+	(sz := aColorMap size) == colorMap size ifTrue:[
+	    sameColors := true.
+
+	    1 to:sz do:[:idx |
+		(aColorMap at:idx) = (colorMap at:idx) ifFalse:[
+		    sameColors := false.
+		]
+	    ].
+	    sameColors ifTrue:[^ self].
+	]
     ].
 
     colorMap := aColorMap.
     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"
@@ -1837,16 +1837,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.
@@ -1971,15 +1971,15 @@
 
     pixel := self valueAtX:x y:y.
     photometric == #blackIs0 ifTrue:[
-        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-        ^ Color gray:(pixel * (100 / maxPixel)).
+	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+	^ Color gray:(pixel * (100 / maxPixel)).
     ].
     photometric == #whiteIs0 ifTrue:[
-        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-        ^ Color gray:100 - (pixel * (100 / maxPixel)).
+	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+	^ Color gray:100 - (pixel * (100 / maxPixel)).
     ].
     photometric == #palette ifTrue:[
-        ^ colorMap at:(pixel + 1)
+	^ colorMap at:(pixel + 1)
     ].
 
     ^ self colorFromValue:pixel
@@ -1999,26 +1999,26 @@
     |pixel maxPixel|
 
     photometric == #whiteIs0 ifTrue:[
-        maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-        pixel := maxPixel - (aColor brightness * maxPixel) rounded.
+	maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+	pixel := maxPixel - (aColor brightness * maxPixel) rounded.
     ] ifFalse:[
-        photometric == #blackIs0 ifTrue:[
-            maxPixel := (1 bitShift:self bitsPerPixel) - 1.
-            pixel := (aColor brightness * maxPixel) rounded.
-        ] ifFalse:[
-            photometric ~~ #palette ifTrue:[
-                self error:'format not supported'.
-                ^ nil
-            ].
-            pixel := colorMap indexOf:aColor.
-            pixel == 0 ifTrue:[
-                "
-                 the color to be stored is not in the images colormap
-                "
-                self error:'invalid color - not in colorMap'
-            ].
-            pixel := pixel - 1
-        ]
+	photometric == #blackIs0 ifTrue:[
+	    maxPixel := (1 bitShift:self bitsPerPixel) - 1.
+	    pixel := (aColor brightness * maxPixel) rounded.
+	] ifFalse:[
+	    photometric ~~ #palette ifTrue:[
+		self error:'format not supported'.
+		^ nil
+	    ].
+	    pixel := colorMap indexOf:aColor.
+	    pixel == 0 ifTrue:[
+		"
+		 the color to be stored is not in the images colormap
+		"
+		self error:'invalid color - not in colorMap'
+	    ].
+	    pixel := pixel - 1
+	]
     ].
     self atX:x y:y putValue:pixel.
 
@@ -2069,7 +2069,7 @@
 
     w := width-1.
     0 to:w do:[:col |
-        self atX:col y:rowIndex putValue:(pixelArray at:(col + 1))
+	self atX:col y:rowIndex putValue:(pixelArray at:(col + 1))
     ].
     ^ pixelArray
 
@@ -2138,11 +2138,11 @@
     depth := self depth.
     bitsPerPixel := d.
     d == 24 ifTrue:[
-        samplesPerPixel := 3.
-        bitsPerSample := #(8 8 8)
+	samplesPerPixel := 3.
+	bitsPerSample := #(8 8 8)
     ] ifFalse:[
-        samplesPerPixel := 1.
-        bitsPerSample := Array with:d 
+	samplesPerPixel := 1.
+	bitsPerSample := Array with:d 
     ]
 
     "Modified: 20.2.1997 / 14:39:10 / cg"
@@ -2176,7 +2176,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
@@ -2187,19 +2187,19 @@
 
     photometric := aSymbol.
     bitsPerSample isNil ifTrue:[
-        photometric == #rgb ifTrue:[
-            b := self class imageDepth // 3.
-            bitsPerSample := Array with:b with:b with:b
-        ] ifFalse:[
-            bitsPerSample := Array with:(self class imageDepth)
-        ].
+	photometric == #rgb ifTrue:[
+	    b := self class imageDepth // 3.
+	    bitsPerSample := Array with:b with:b with:b
+	] ifFalse:[
+	    bitsPerSample := Array 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"
@@ -2283,7 +2283,7 @@
     self depth:d.
     colorMap := aColormap.
     aColormap notNil ifTrue:[
-        photometric := #palette
+	photometric := #palette
     ]
 
     "Modified: 23.4.1996 / 11:08:56 / cg"
@@ -2298,14 +2298,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"
 !
@@ -2409,14 +2409,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.
@@ -2432,10 +2432,10 @@
     "return an error-diffusion dithered monochrome image from the receiver image."
 
     DitherAlgorithm == #burkes ifTrue:[
-        ^ self asBurkesDitheredMonochromeImage
+	^ self asBurkesDitheredMonochromeImage
     ].
     DitherAlgorithm == #stevensonArce ifTrue:[
-        ^ self asStevensonArgceDitheredMonochromeImage
+	^ self asStevensonArgceDitheredMonochromeImage
     ].
     ^ self asFloydSteinbergDitheredMonochromeImage
 
@@ -2461,14 +2461,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.
@@ -2492,14 +2492,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].
 
@@ -2515,46 +2515,46 @@
     "/
     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  
-               width:width height:height
-                   x:0 y:0
-                into:(f id) x:0 y:0 
-               width:width height:height with:(f gcId).
+	       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)) on: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)) on:Display].
 
      img8 := Image fromFile:'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.
     "
@@ -2570,12 +2570,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 floydSteinbergDitheredBitsDepth:depth.
+	bits := self floydSteinbergDitheredBitsDepth:depth.
     ].
 
     ^ self makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
@@ -2604,12 +2604,12 @@
     |ditheredBits|
 
     (depth == 1) ifTrue:[
-        ^ self asFloydSteinbergDitheredMonochromeImage
+	^ self asFloydSteinbergDitheredMonochromeImage
     ].
 
     ditheredBits := self floydSteinbergDitheredBitsDepth:depth.
     ^ (self class implementorForDepth:depth)
-        width:width height:height fromArray:ditheredBits
+	width:width height:height fromArray:ditheredBits
 
     "
      |i|
@@ -2625,11 +2625,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.
 
@@ -2642,13 +2642,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.
 
@@ -2680,14 +2680,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.
@@ -2718,16 +2718,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.
     "
 
@@ -2767,14 +2767,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.
@@ -2795,29 +2795,29 @@
 
     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:[
-        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 on:aDevice.
@@ -2829,18 +2829,18 @@
     "/
     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  
-               width:width height:height
-                   x:0 y:0
-                into:(f id) x:0 y:0 
-               width:width height:height with:(f gcId).
+	       width:width height:height
+		   x:0 y:0
+		into:(f id) x:0 y:0 
+	       width:width height:height with:(f gcId).
     ^ f
 
     "
@@ -2869,53 +2869,53 @@
     ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
 
     mask notNil ifTrue:[
-        mask := mask on:aDevice
+	mask := mask on:aDevice
     ].
 
     (aDevice depth == 1
     or:[aDevice hasGrayscales not]) ifTrue:[
-        ^ self asMonochromeFormOn:aDevice
+	^ self asMonochromeFormOn:aDevice
     ].
 
     ((visual := aDevice visualType) == #StaticGray) ifTrue:[
-        ^ self asGrayFormOn:aDevice
+	^ self asGrayFormOn:aDevice
     ].
 
     (visual == #PseudoColor
      or:[visual == #StaticColor]) ifTrue:[
-        form := self asPseudoFormQuickOn:aDevice.
-        form notNil ifTrue:[
-            ^ form
-        ].
+	form := self asPseudoFormQuickOn:aDevice.
+	form notNil ifTrue:[
+	    ^ form
+	].
     ].
 
     (photometric == #palette) ifTrue:[
-        form := self paletteImageAsFormOn:aDevice
+	form := self paletteImageAsFormOn:aDevice
     ] ifFalse:[
-        (photometric == #rgb) ifTrue:[
-            form := self rgbImageAsFormOn:aDevice
-        ] ifFalse:[
-            form := self greyImageAsFormOn:aDevice
-        ]
+	(photometric == #rgb) 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:[
-            deviceForm := 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:[
+	    deviceForm := 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
@@ -2947,17 +2947,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.
@@ -2987,12 +2987,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
@@ -3010,22 +3010,22 @@
     form := self asMonochromeFormOn:aDevice dither:DitherAlgorithm.
 
     (device isNil or:[aDevice == device]) ifTrue:[
-        "remember this form in the receiver ..."
-
-        form notNil ifTrue:[
-            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:[
+	    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
@@ -3047,22 +3047,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.
+	    ]
+	]
     ].
 
     "/
@@ -3087,14 +3087,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].
 
@@ -3110,46 +3110,46 @@
     "/
     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  
-               width:width height:height
-                   x:0 y:0
-                into:(f id) x:0 y:0 
-               width:width height:height with:(f gcId).
+	       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)) on: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)) on:Display].
 
      img8 := Image fromFile:'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.
     "
@@ -3167,16 +3167,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
-                orderedDitheredBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
-                ditherWidth:8
-                depth:depth.
+		orderedDitheredBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
+		ditherWidth:8
+		depth:depth.
 
     ^ self makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
 
@@ -3199,26 +3199,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
-                orderedDitheredBitsWithDitherMatrix:dither
-                ditherWidth:8
-                depth:depth)
+	width:width
+	height:height
+	fromArray:(
+	    self
+		orderedDitheredBitsWithDitherMatrix:dither
+		ditherWidth:8
+		depth:depth)
 
     "
      |i i1 i2 i4 i8|
@@ -3273,9 +3273,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 
@@ -3363,8 +3363,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)
@@ -3426,8 +3426,8 @@
 
      i := Image fromFile:'garfield.gif'.
      i
-        asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:4)
-        ditherWidth:4
+	asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:4)
+	ditherWidth:4
     "
 
     "order-6 dither:
@@ -3436,8 +3436,8 @@
 
      i := Image fromFile:'garfield.gif'.
      i
-        asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:8)
-        ditherWidth:8
+	asOrderedDitheredMonochromeImageWithDitherMatrix:(Image orderedDitherMatrixOfSize:8)
+	ditherWidth:8
     "
 
 
@@ -3447,8 +3447,8 @@
 
      i := Image fromFile:'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):
@@ -3457,8 +3457,8 @@
 
      i := Image fromFile:'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):
@@ -3467,8 +3467,8 @@
 
      i := Image fromFile:'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"
@@ -3498,31 +3498,31 @@
     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].
-            ].
-            cMap at:(pixel) put:clr.
-            idMap at:(pixel) put:(clr colorId).
-        ].
+	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].
+	    ].
+	    cMap at:(pixel) put:clr.
+	    idMap at:(pixel) put:(clr colorId).
+	].
     ] ifFalse:[
-        1 to:nClr do:[:pixel |
-            clr := self colorFromValue:pixel-1.
-            clr := clr exactOn:aDevice.
-            clr isNil ifTrue:[^ nil].
-
-            cMap at:(pixel) put:clr.
-            idMap at:(pixel) put:(clr colorId).
-        ].
+	1 to:nClr do:[:pixel |
+	    clr := self colorFromValue:pixel-1.
+	    clr := clr exactOn:aDevice.
+	    clr isNil ifTrue:[^ nil].
+
+	    cMap at:(pixel) put:clr.
+	    idMap at:(pixel) put:(clr colorId).
+	].
     ].
 
     "/ got all colors; good - simply change depth & translate pixels
@@ -3530,42 +3530,42 @@
     dDev := aDevice depth.
 
     (d == 8 and:[dDev == 8]) ifTrue:[
-        "/ only translate
-        temp := ByteArray uninitializedNew:(width * height).
-        bytes expandPixels:8         "xlate only"
-                    width:width 
-                   height:height
-                     into:temp
-                  mapping:idMap.
+	"/ only translate
+	temp := ByteArray uninitializedNew:(width * height).
+	bytes expandPixels:8         "xlate only"
+		    width:width 
+		   height:height
+		     into:temp
+		  mapping:idMap.
     ] ifFalse:[
 
-        "/ stupid: expandPixels can only handle any-to-8
-        "/ compressPixels can only handle 8-to-any
-
-        d ~~ 8 ifTrue:[
-            temp8 := ByteArray uninitializedNew:(width * height).
-
-            bytes expandPixels:d      
-                         width:width 
-                        height:height
-                          into:temp8
-                       mapping:idMap.
-            idMap := nil.
-        ] ifFalse:[
-            temp8 := bytes.
-        ].
-
-        dDev ~~ 8 ifTrue:[
-            temp := ByteArray uninitializedNew:((width * dDev + 7) // 8 * height).
-
-            temp8 compressPixels:dDev      
-                         width:width 
-                        height:height
-                          into:temp
-                       mapping:idMap.
-        ] ifFalse:[
-            temp := temp8
-        ].
+	"/ stupid: expandPixels can only handle any-to-8
+	"/ compressPixels can only handle 8-to-any
+
+	d ~~ 8 ifTrue:[
+	    temp8 := ByteArray uninitializedNew:(width * height).
+
+	    bytes expandPixels:d      
+			 width:width 
+			height:height
+			  into:temp8
+		       mapping:idMap.
+	    idMap := nil.
+	] ifFalse:[
+	    temp8 := bytes.
+	].
+
+	dDev ~~ 8 ifTrue:[
+	    temp := ByteArray uninitializedNew:((width * dDev + 7) // 8 * height).
+
+	    temp8 compressPixels:dDev      
+			 width:width 
+			height:height
+			  into:temp
+		       mapping:idMap.
+	] ifFalse:[
+	    temp := temp8
+	].
     ].
 
     f := Form width:width height:height depth:dDev on:aDevice.
@@ -3575,32 +3575,32 @@
     f initGC.
 
     aDevice 
-        drawBits:temp 
-        depth:dDev 
-        width:width 
-        height:height
-        x:0 y:0
-        into:(f id) x:0 y:0 
-        width:width 
-        height:height 
-        with:(f gcId).
+	drawBits:temp 
+	depth:dDev 
+	width:width 
+	height:height
+	x:0 y:0
+	into:(f id) x:0 y:0 
+	width:width 
+	height:height 
+	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
      "
 
@@ -3645,14 +3645,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.
@@ -3669,16 +3669,16 @@
     |depth|
 
     (depth := aDevice depth) == 1 ifTrue:[
-        ^ self asThresholdMonochromeFormOn:aDevice
+	^ self asThresholdMonochromeFormOn:aDevice
     ].
 
     ^ self 
-        makeDeviceGrayPixmapOn:aDevice 
-        depth:depth 
-        fromArray:(self
-                        orderedDitheredBitsWithDitherMatrix:#[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
+			orderedDitheredBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+			ditherWidth:4
+			depth:depth)
 
     "
      |i|
@@ -3695,26 +3695,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
-                orderedDitheredBitsWithDitherMatrix:#[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
+		orderedDitheredBitsWithDitherMatrix:#[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]
+		ditherWidth:4
+		depth:depth)
 
     "
      |i|
@@ -3744,9 +3744,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|
@@ -3786,8 +3786,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|
@@ -3829,17 +3829,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.
@@ -3895,9 +3895,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
@@ -3906,34 +3906,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.
-                    colorMap := 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.
+		    colorMap := Array with:c0 with:c1.
+		]
+	    ]
+	]
     ] ifFalse:[
-        map notNil ifTrue:[
-            photometric := #palette.
-            colorMap := map copy.
-        ] ifFalse:[
-            "
-             photometric stays at default
-             (which is rgb for d24, greyscale for others)
-            "
-        ]
+	map notNil ifTrue:[
+	    photometric := #palette.
+	    colorMap := map copy.
+	] ifFalse:[
+	    "
+	     photometric stays at default
+	     (which is rgb for d24, greyscale for others)
+	    "
+	]
     ].
 
     "Modified: 5.7.1996 / 16:24:31 / cg"
@@ -3956,7 +3956,7 @@
     self colormapFromImage:anImage.
     self mask:anImage mask.
     anImage colorsFromX:0 y:0 toX:(width-1) y:(height-1) do:[:x :y :clr |
-        self atX:x y:y put:clr
+	self atX:x y:y put:clr
     ].
 
     "
@@ -4004,19 +4004,19 @@
     ((photometric == anImage photometric)
     and:[self bitsPerPixel = anImage bitsPerPixel
     and:[colorMap = anImage colorMap]]) ifTrue:[
-        "/ can do it by value
-        anImage valuesFromX:x0  y:y0 
-                        toX:aRectangle right y:aRectangle bottom 
-                         do:[:x :y :pixelValue |
-            self atX:x-x0 y:y-y0 putValue:pixelValue.
-        ]
+	"/ can do it by value
+	anImage valuesFromX:x0  y:y0 
+			toX:aRectangle right y:aRectangle bottom 
+			 do:[:x :y :pixelValue |
+	    self atX:x-x0 y:y-y0 putValue:pixelValue.
+	]
     ] ifFalse:[
-        "/ must do it by colors
-        anImage colorsFromX:x0  y:y0 
-                        toX:aRectangle right y:aRectangle bottom 
-                         do:[:x :y :clr |
-            self atX:x-x0 y:y-y0 put:clr.
-        ]
+	"/ must do it by colors
+	anImage colorsFromX:x0  y:y0 
+			toX:aRectangle right y:aRectangle bottom 
+			 do:[:x :y :clr |
+	    self atX:x-x0 y:y-y0 put:clr.
+	]
     ].
 
     "
@@ -4060,10 +4060,10 @@
     ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ self].
 
     (device notNil and:[aDevice ~~ device]) ifTrue:[
-        "oops, I am already accociated to another device
-         - need a copy ...
-        "
-        ^ self copy on:aDevice
+	"oops, I am already accociated to another device
+	 - need a copy ...
+	"
+	^ self copy on:aDevice
     ].
     deviceForm := self asFormOn:aDevice.
     device := aDevice.
@@ -4093,8 +4093,8 @@
 
     nPlanes := samplesPerPixel.
     (nPlanes == 2) ifTrue:[
-        'Image [info]: alpha plane ignored' infoPrintCR.
-        nPlanes := 1
+	'Image [info]: alpha plane ignored' infoPrintCR.
+	nPlanes := 1
     ].
 
     pictureDepth := bitsPerSample at:1.
@@ -4102,11 +4102,11 @@
     "monochrome is very easy ..."
 
     (pictureDepth == 1) ifTrue:[
-        ^ Form width:width height:height fromArray:bytes on:aDevice
+	^ Form width:width height:height fromArray:bytes on:aDevice
     ].
 
     (aDevice visualType == #TrueColor) ifTrue:[
-        ^ self greyImageAsTrueColorFormOn:aDevice
+	^ self greyImageAsTrueColorFormOn:aDevice
     ].
 
 "/    (aDevice visualType == #PseudoColor 
@@ -4132,42 +4132,42 @@
     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"
-
-        usedColors := bytes usedValues.
-        nUsed := usedColors max + 1.
-
-        colorMap := Array new:nUsed.
-        photometric == #blackIs0 ifTrue:[
-            usedColors do:[:grey |
-                colorMap at:(grey + 1) put:(Color gray:(100.0 / 256.0 * grey))
-            ]
-        ] ifFalse:[
-            usedColors do:[:grey |
-                colorMap at:(grey + 1) put:(Color gray:(100 - (100.0 / 256.0 * grey)))
-            ]
-        ]
+	"for 8bits, we scan for used colors first;
+	 to avoid allocating too many colors"
+
+	usedColors := bytes usedValues.
+	nUsed := usedColors max + 1.
+
+	colorMap := Array new:nUsed.
+	photometric == #blackIs0 ifTrue:[
+	    usedColors do:[:grey |
+		colorMap at:(grey + 1) put:(Color gray:(100.0 / 256.0 * grey))
+	    ]
+	] ifFalse:[
+	    usedColors do:[:grey |
+		colorMap at:(grey + 1) put:(Color gray:(100 - (100.0 / 256.0 * grey)))
+	    ]
+	]
     ] ifFalse:[
-        nColors := (1 bitShift:pictureDepth).
-        colorMap := Array new:nColors.
-        range := 100 / (nColors - 1) asFloat.
-        photometric == #blackIs0 ifTrue:[
-            1 to:nColors do:[:i |
-                colorMap at:i put:(Color gray:(i - 1) * range).
-            ].
-        ] ifFalse:[
-            1 to:nColors do:[:i |
-                colorMap at:(nColors - i + 1) put:(Color gray:(i - 1) * range).
-            ].
-        ].
+	nColors := (1 bitShift:pictureDepth).
+	colorMap := Array new:nColors.
+	range := 100 / (nColors - 1) asFloat.
+	photometric == #blackIs0 ifTrue:[
+	    1 to:nColors do:[:i |
+		colorMap at:i put:(Color gray:(i - 1) * range).
+	    ].
+	] ifFalse:[
+	    1 to:nColors do:[:i |
+		colorMap at:(nColors - i + 1) put:(Color gray:(i - 1) * range).
+	    ].
+	].
     ].
 
     "XXX should reduce 8->6->4->2 planes, if not all colors could be allocated"
@@ -4176,33 +4176,33 @@
     map := ByteArray uninitializedNew:256.
     nColors := colorMap size.
     1 to:nColors do:[:i |
-        aColor := colorMap at:i.
-        aColor notNil ifTrue:[
-            aColor := aColor on:aDevice.
-            colorMap at:i put:aColor.
-            id := aColor colorId.
-            id notNil ifTrue:[
-                map at:i put:id
-            ] ifFalse:[
-                map at:i put:0
-            ]
-        ]
+	aColor := colorMap at:i.
+	aColor notNil ifTrue:[
+	    aColor := aColor on:aDevice.
+	    colorMap at:i put:aColor.
+	    id := aColor colorId.
+	    id notNil ifTrue:[
+		map at:i put:id
+	    ] ifFalse:[
+		map at:i put:0
+	    ]
+	]
     ].
 
     "expand & translate"
     bytes expandPixels:pictureDepth
-                width:width 
-               height:height
-                 into:wideBits
-              mapping:map.
+		width:width 
+	       height:height
+		 into:wideBits
+	      mapping:map.
 
     f := Form width:width height:height depth:8 on:aDevice.
     f isNil ifTrue:[^ nil].
     f colorMap:colorMap. 
     f initGC.
     aDevice drawBits:wideBits depth:8 width:width height:height
-                       x:0 y:0
-                    into:(f id) x:0 y:0 width:width height:height with:(f gcId).
+		       x:0 y:0
+		    into:(f id) x:0 y:0 width:width height:height with:(f gcId).
     ^ f
 
     "Modified: 28.5.1996 / 20:55:57 / cg"
@@ -4235,8 +4235,8 @@
     depth := aDevice depth.
     myDepth := self depth.
     myDepth > 12 ifTrue:[
-        self error:'unsupported trueColor depth in greyImageAsTrueColorFormOn:'.
-        ^ nil
+	self error:'unsupported trueColor depth in greyImageAsTrueColorFormOn:'.
+	^ nil
     ].
 
     "/ compute scale to map from my pixels into devices range
@@ -4254,21 +4254,21 @@
     nColors := (1 bitShift:myDepth).
     colorValues := Array new:nColors.
     1 to:nColors do:[:i |
-        |v gv bv rv nv|
-
-        "/ scale down to 0..1
-        v := (i-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:i put:nv
+	|v gv bv rv nv|
+
+	"/ scale down to 0..1
+	v := (i-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:i 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.
@@ -4278,44 +4278,44 @@
     "/ for now, only support some depths
 
     usedDeviceBitsPerPixel == 16 ifTrue:[
-        imageBits := ByteArray uninitializedNew:(width * height * 2).
-
-        "/ now, walk over the image and replace
-        "/ colorMap indices by color values in the bits array
-
-        destIndex := 1.
-        endRow := height - 1.
-        endCol := width - 1.
-        0 to:endRow do:[:y |
-            0 to:endCol do:[:x |
-                greyValue := self valueAtX:x y:y.
-                imageBits wordAt:destIndex put:(colorValues at:greyValue + 1) MSB:true.
-                destIndex := destIndex + 2.
-            ]
-        ]
+	imageBits := ByteArray uninitializedNew:(width * height * 2).
+
+	"/ now, walk over the image and replace
+	"/ colorMap indices by color values in the bits array
+
+	destIndex := 1.
+	endRow := height - 1.
+	endCol := width - 1.
+	0 to:endRow do:[:y |
+	    0 to:endCol do:[:x |
+		greyValue := self valueAtX:x y:y.
+		imageBits wordAt:destIndex put:(colorValues at:greyValue + 1) MSB:true.
+		destIndex := destIndex + 2.
+	    ]
+	]
     ] ifFalse:[
-        usedDeviceBitsPerPixel == 32 ifTrue:[
-            imageBits := ByteArray uninitializedNew:(width * height * 4).
-
-            "/ now, walk over the image and replace
-            "/ colorMap indices by color values in the bits array
-
-            destIndex := 1.
-            endRow := height - 1.
-            endCol := width - 1.
-            0 to:endRow do:[:y |
-                0 to:endCol do:[:x |
-                    greyValue := self valueAtX:x y:y.
-                    imageBits doubleWordAt:destIndex put:(colorValues at:greyValue + 1) MSB:true.
-                    destIndex := destIndex + 4.
-                ]
-            ]
-        ]
+	usedDeviceBitsPerPixel == 32 ifTrue:[
+	    imageBits := ByteArray uninitializedNew:(width * height * 4).
+
+	    "/ now, walk over the image and replace
+	    "/ colorMap indices by color values in the bits array
+
+	    destIndex := 1.
+	    endRow := height - 1.
+	    endCol := width - 1.
+	    0 to:endRow do:[:y |
+		0 to:endCol do:[:x |
+		    greyValue := self valueAtX:x y:y.
+		    imageBits doubleWordAt:destIndex put:(colorValues at:greyValue + 1) MSB:true.
+		    destIndex := destIndex + 4.
+		]
+	    ]
+	]
     ].
 
     imageBits isNil ifTrue:[            
-        'Image [warning]: unimplemented trueColor depth on greyImageAsTrueColorFormOn:' errorPrintCR.
-        ^ self asMonochromeFormOn:aDevice
+	'Image [warning]: unimplemented trueColor depth on greyImageAsTrueColorFormOn:' errorPrintCR.
+	^ self asMonochromeFormOn:aDevice
     ].
 
     form :=
@@ -4324,9 +4324,9 @@
     form initGC.
 
     form 
-        copyBitsFrom:imageBits bitsPerPixel:usedDeviceBitsPerPixel depth:usedDeviceDepth 
-               width:width height:height 
-                   x:0 y:0 toX:0 y:0. 
+	copyBitsFrom:imageBits bitsPerPixel:usedDeviceBitsPerPixel depth:usedDeviceDepth 
+	       width:width height:height 
+		   x:0 y:0 toX:0 y:0. 
 
     ^ form
 
@@ -4348,23 +4348,23 @@
     ].
 
     ((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
@@ -4438,23 +4438,23 @@
     colorValues := Array uninitializedNew:nColors.
 
     1 to:nColors do:[:index |
-        |clr rv gv bv v "{ Class: SmallInteger }" |
-
-        clr := colorMap at:index.
-        clr notNil ifTrue:[
-            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:index put:v.
+	|clr rv gv bv v "{ Class: SmallInteger }" |
+
+	clr := colorMap at:index.
+	clr notNil ifTrue:[
+	    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:index put:v.
 "/ clr print. ' ' print.
 "/ rv print. ' ' print. gv print. ' ' print. bv print. ' ' print.
 "/ ' -> ' print. v printNL.
 
-        ]
+	]
     ].
 
     bestFormat := self bestSupportedImageFormatFor:aDevice.
@@ -4464,23 +4464,23 @@
     "/ for now, only support some depths
 
     usedDeviceBitsPerPixel == 16 ifTrue:[
-        n := (width * height * 2).
+	n := (width * height * 2).
     ] ifFalse:[
-        usedDeviceBitsPerPixel == 32 ifTrue:[
-            n := (width * height * 4).
-        ] ifFalse:[
-            usedDeviceBitsPerPixel == 8 ifTrue:[
-                n := (width * height).
-            ] ifFalse:[
-                usedDeviceBitsPerPixel == 24 ifTrue:[
-                    n := (width * height * 3).
-                ]
-            ]
-        ]
+	usedDeviceBitsPerPixel == 32 ifTrue:[
+	    n := (width * height * 4).
+	] ifFalse:[
+	    usedDeviceBitsPerPixel == 8 ifTrue:[
+		n := (width * height).
+	    ] ifFalse:[
+		usedDeviceBitsPerPixel == 24 ifTrue:[
+		    n := (width * height * 3).
+		]
+	    ]
+	]
     ].
     n 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
     ].
     imageBits := ByteArray uninitializedNew:n.
 
@@ -4488,39 +4488,39 @@
     h := height - 1.
     dstIdx := 1.
     0 to:h do:[:y |
-        0 to:w do:[:x |
-            "/ fetch pixelValue
-            pixel := self valueAtX:x y:y.
-            "/ get colorValue
-            rgbVal := colorValues at:(pixel + 1).
-            "/ store in image bits
-
-            usedDeviceBitsPerPixel == 16 ifTrue:[
-                imageBits at:dstIdx   put:((rgbVal bitShift:-8) bitAnd:16rFF).
-                imageBits at:dstIdx+1 put:(rgbVal bitAnd:16rFF).
-                dstIdx := dstIdx + 2.
-            ] ifFalse:[
-                usedDeviceBitsPerPixel == 32 ifTrue:[
-                    imageBits at:dstIdx   put:((rgbVal bitShift:-24) bitAnd:16rFF).
-                    imageBits at:dstIdx+1 put:((rgbVal bitShift:-16) bitAnd:16rFF).
-                    imageBits at:dstIdx+2 put:((rgbVal bitShift:-8) bitAnd:16rFF).
-                    imageBits at:dstIdx+3 put:(rgbVal bitAnd:16rFF).
-                    dstIdx := dstIdx + 4.
-                ] ifFalse:[
-                    usedDeviceBitsPerPixel == 24 ifTrue:[
-                        imageBits at:dstIdx   put:((rgbVal bitShift:-16) bitAnd:16rFF).
-                        imageBits at:dstIdx+1 put:((rgbVal bitShift:-8) bitAnd:16rFF).
-                        imageBits at:dstIdx+2 put:(rgbVal bitAnd:16rFF).
-                        dstIdx := dstIdx + 3.
-                    ] ifFalse:[
-                        usedDeviceBitsPerPixel == 8 ifTrue:[
-                            imageBits at:dstIdx put:(rgbVal bitAnd:16rFF).
-                            dstIdx := dstIdx + 1.
-                        ]
-                    ]
-                ]
-            ]
-        ]
+	0 to:w do:[:x |
+	    "/ fetch pixelValue
+	    pixel := self valueAtX:x y:y.
+	    "/ get colorValue
+	    rgbVal := colorValues at:(pixel + 1).
+	    "/ store in image bits
+
+	    usedDeviceBitsPerPixel == 16 ifTrue:[
+		imageBits at:dstIdx   put:((rgbVal bitShift:-8) bitAnd:16rFF).
+		imageBits at:dstIdx+1 put:(rgbVal bitAnd:16rFF).
+		dstIdx := dstIdx + 2.
+	    ] ifFalse:[
+		usedDeviceBitsPerPixel == 32 ifTrue:[
+		    imageBits at:dstIdx   put:((rgbVal bitShift:-24) bitAnd:16rFF).
+		    imageBits at:dstIdx+1 put:((rgbVal bitShift:-16) bitAnd:16rFF).
+		    imageBits at:dstIdx+2 put:((rgbVal bitShift:-8) bitAnd:16rFF).
+		    imageBits at:dstIdx+3 put:(rgbVal bitAnd:16rFF).
+		    dstIdx := dstIdx + 4.
+		] ifFalse:[
+		    usedDeviceBitsPerPixel == 24 ifTrue:[
+			imageBits at:dstIdx   put:((rgbVal bitShift:-16) bitAnd:16rFF).
+			imageBits at:dstIdx+1 put:((rgbVal bitShift:-8) bitAnd:16rFF).
+			imageBits at:dstIdx+2 put:(rgbVal bitAnd:16rFF).
+			dstIdx := dstIdx + 3.
+		    ] ifFalse:[
+			usedDeviceBitsPerPixel == 8 ifTrue:[
+			    imageBits at:dstIdx put:(rgbVal bitAnd:16rFF).
+			    dstIdx := dstIdx + 1.
+			]
+		    ]
+		]
+	    ]
+	]
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth on:aDevice.
@@ -4528,9 +4528,9 @@
     form initGC.
 
     form 
-        copyBitsFrom:imageBits bitsPerPixel:usedDeviceBitsPerPixel depth:usedDeviceDepth 
-               width:width height:height 
-                   x:0 y:0 toX:0 y:0. 
+	copyBitsFrom:imageBits bitsPerPixel:usedDeviceBitsPerPixel depth:usedDeviceDepth 
+	       width:width height:height 
+		   x:0 y:0 toX:0 y:0. 
 
     ^ form
 
@@ -4564,21 +4564,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
 
     "Modified: 14.6.1996 / 17:18:57 / cg"
     "Created: 14.6.1996 / 17:23:52 / cg"
@@ -4592,10 +4592,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
@@ -4614,21 +4614,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)
-        ].
-
-        colorMap := palette.
-        photometric := #palette.
-        f := self paletteImageAsPseudoFormOn:aDevice.
-        colorMap := 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)
+	].
+
+	colorMap := palette.
+	photometric := #palette.
+	f := self paletteImageAsPseudoFormOn:aDevice.
+	colorMap := nil.
+	photometric := #rgb.
+	^ f
     ].
 
     ^ self subclassResponsibility
@@ -4648,7 +4648,7 @@
 
     "/ kludge for some 15bit XFree servers (should return 16 here - does not)
     usedDeviceBitsPerPixel == 15 ifTrue:[
-        usedDeviceBitsPerPixel := 16
+	usedDeviceBitsPerPixel := 16
     ].
 
     "/
@@ -4657,21 +4657,21 @@
     "/ be done in concrete subclasses (see D24Image)
     "/
     self bitsPerPixel == usedDeviceBitsPerPixel ifFalse:[
-        'Image [warning]: unimplemented trueColor depth in rgbImageAsTrueColorFormOn: ' errorPrint. self bitsPerPixel errorPrintCR.
-        ^ self asMonochromeFormOn:aDevice
+	'Image [warning]: unimplemented trueColor depth in rgbImageAsTrueColorFormOn: ' errorPrint. self bitsPerPixel errorPrintCR.
+	^ self asMonochromeFormOn:aDevice
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth on:aDevice.
     form isNil ifTrue:[
-        'Image [warning]: display bitmap creation failed' errorPrintCR.
-        ^ nil
+	'Image [warning]: display bitmap creation failed' errorPrintCR.
+	^ nil
     ].
     form initGC.
 
     form 
-        copyBitsFrom:bytes bitsPerPixel:usedDeviceBitsPerPixel depth:usedDeviceDepth 
-               width:width height:height 
-                   x:0 y:0 toX:0 y:0. 
+	copyBitsFrom:bytes bitsPerPixel:usedDeviceBitsPerPixel depth:usedDeviceDepth 
+	       width:width height:height 
+		   x:0 y:0 toX:0 y:0. 
 
     ^ form
 
@@ -4762,7 +4762,7 @@
      grey|
 
     self depth > 12 ifTrue:[
-        ^ self floydSteinbergDitheredMonochromeBits
+	^ self floydSteinbergDitheredMonochromeBits
     ].
 
     w := width.
@@ -4771,7 +4771,7 @@
     bytesPerMonoRow := (w + 7) // 8.
     monoBits := ByteArray uninitializedNew:(bytesPerMonoRow * h).
     (monoBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     errorArray := Array new:(w+4).
@@ -4785,90 +4785,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
@@ -4898,8 +4898,8 @@
      eR eRB eB eLB |
 
     depth > 8 ifTrue:[
-        self error:'unimplemented conversion'.
-        ^ nil
+	self error:'unimplemented conversion'.
+	^ nil
     ].
 
     w := width.
@@ -4908,7 +4908,7 @@
     bytesPerOutRow := ((w * depth) + 7) // 8.
     outBits := ByteArray uninitializedNew:(bytesPerOutRow * h).
     (outBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     greyLevels := (1 bitShift:depth) - 1.
@@ -4922,176 +4922,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
@@ -5127,18 +5127,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 ...
@@ -5148,49 +5148,49 @@
     "/ ... 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
+		    ].
     ditherIds := (ditherColors asArray collect:[:clr | clr colorId]) asByteArray.
 
     "/ build an index table, for fast lookup from manhatten-r-g-b distance
@@ -5199,20 +5199,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).
 
@@ -5228,13 +5228,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.
     ].
 
     pseudoBits := ByteArray uninitializedNew:(width * height).
@@ -5264,23 +5264,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 (__isByteArray(__INST(bytes))
      && __isByteArray(pseudoBits)
@@ -5289,50 +5289,50 @@
      && __isByteArray(ditherIds)
      && __isByteArray(clrLookup)
      && __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;
-        __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;
-
-                pix = *srcP++;
-
-                /*
-                 * wR, wG and wB is the wanted r/g/b value;
-                 */
-                idx = pix+pix+pix;  /* pix * 3 */
-
-                __wantR = rgbP[idx] + __eR;
-                __wantG = rgbP[idx+1] + __eG;
-                __wantB = rgbP[idx+2] + __eB;
+	failed = false;
+
+	srcP = __ByteArrayInstPtr(_INST(bytes))->ba_element;
+	dstP = __ByteArrayInstPtr(pseudoBits)->ba_element;
+	rgbP = __ByteArrayInstPtr(rgbBytes)->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;
+
+		pix = *srcP++;
+
+		/*
+		 * wR, wG and wB is the wanted r/g/b value;
+		 */
+		idx = pix+pix+pix;  /* pix * 3 */
+
+		__wantR = rgbP[idx] + __eR;
+		__wantG = rgbP[idx+1] + __eG;
+		__wantB = rgbP[idx+2] + __eB;
 
 #define RED_SCALE 30
 #define GREEN_SCALE 59
@@ -5349,236 +5349,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];
 
 /*
 printf("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
@@ -5621,8 +5621,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.
 
@@ -5634,17 +5634,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).
@@ -5662,18 +5662,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.
@@ -5696,121 +5696,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
@@ -5844,7 +5844,7 @@
     bytesPerMonoRow := (w + 7) // 8.
     monoBits := ByteArray uninitializedNew:(bytesPerMonoRow * h).
     (monoBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     errorArray := Array new:w+2.
@@ -5857,68 +5857,68 @@
     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 isNil ifTrue:[
-                                                   0
-                                               ] ifFalse:[
-                                                   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 isNil ifTrue:[
+						   0
+					       ] ifFalse:[
+						   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]);
+		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);
+		__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 }" 
@@ -5971,91 +5971,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
@@ -6096,31 +6096,31 @@
 
     "/ simple check
     (fixR * fixG * fixB) ~~ fixColors size ifTrue:[
-        self error:'invalid color array passed'.
-        ^ nil
+	self error:'invalid color array passed'.
+	^ nil
     ].
 
     "/
     "/ collect colorIds
     "/
     photometric == #palette ifTrue:[
-        lastColor := colorMap size - 1
+	lastColor := colorMap size - 1
     ] ifFalse:[
-        lastColor := 255.
+	lastColor := 255.
     ].
     fixGfixB := fixG * fixB.
 
     idMap := ByteArray uninitializedNew:256.
 
     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.
+	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).
@@ -6128,10 +6128,10 @@
     "/ translate
 
     bytes expandPixels:8         "xlate only"
-                width:width 
-               height:height
-                 into:pseudoBits
-              mapping:idMap.
+		width:width 
+	       height:height
+		 into:pseudoBits
+	      mapping:idMap.
 
     ^ pseudoBits
 
@@ -6188,18 +6188,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 ...
@@ -6213,13 +6213,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
@@ -6247,17 +6247,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).
@@ -6265,10 +6265,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.
@@ -6366,297 +6366,297 @@
      && __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;
-
-                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;
-
-                        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;
-                        }
-                    }
-                    /* 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;
+
+		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;
+
+			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;
+			}
+		    }
+		    /* 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];
-                    }
-                }
+		    {
+			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 ...
-                 */
+		/*
+		 * 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
-                /*
-                 * fetch that colors r/g/b components
-                 */
-                dp = __ByteArrayInstPtr(ditherRGBBytes)->ba_element;
-                dp += bestIdx * 3;
-                __dR = dp[0];
-                __dG = dp[1];
-                __dB = dp[2];
+		/*
+		 * 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
 
 /*
 printf("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
-            }
-        }
+	    }
+	}
     }
 %}.
     failed ifTrue:[
-        self primitiveFailed.
-        ^ nil
+	self primitiveFailed.
+	^ nil
     ].
 
     ^ pseudoBits
@@ -6666,9 +6666,9 @@
     "return the bitmap for a dithered depth-bitmap from the image"
 
     ^ self
-        orderedDitheredBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
-        ditherWidth:8
-        depth:depth.
+	orderedDitheredBitsWithDitherMatrix:(self class orderedDitherMatrixOfSize:8)
+	ditherWidth:8
+	depth:depth.
 
     "Created: 15.6.1996 / 09:18:04 / cg"
 !
@@ -6693,8 +6693,8 @@
      byte            "{Class: SmallInteger }" |
 
     depth > 8 ifTrue:[
-        'IMAGE: unimplemented orderedDither conversion' errorPrintCR.
-        ^ nil
+	'IMAGE: unimplemented orderedDither conversion' errorPrintCR.
+	^ nil
     ].
 
     nDither := ditherMatrix size.
@@ -6709,149 +6709,149 @@
     bytesPerOutRow := (w * depth + 7) // 8.
     outBits := ByteArray uninitializedNew:(bytesPerOutRow * h).
     (outBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     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);
-                int __value = __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[__value];
-                __grey = __greyErrors[__value];
-
-                __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);
+		int __value = __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[__value];
+		__grey = __greyErrors[__value];
+
+		__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
+	'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).
+	    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.
+		"/ 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;
+		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);
+		__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
 !
@@ -6861,8 +6861,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"
 !
@@ -6894,105 +6894,105 @@
     bytesPerMonoRow := (w + 7) // 8.
     monoBits := ByteArray uninitializedNew:(bytesPerMonoRow * h).
     (monoBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     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.
 "/     
@@ -7008,13 +7008,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
 !
@@ -7038,7 +7038,7 @@
      xE              "{Class: SmallInteger }" |
 
     self depth > 12 ifTrue:[
-        ^ self floydSteinbergDitheredMonochromeBits
+	^ self floydSteinbergDitheredMonochromeBits
     ].
 
     w := width.
@@ -7047,7 +7047,7 @@
     bytesPerMonoRow := (w + 7) // 8.
     monoBits := ByteArray uninitializedNew:(bytesPerMonoRow * h).
     (monoBits isNil or:[bytes isNil]) ifTrue:[
-        ^ nil
+	^ nil
     ].
 
     errorArray := Array new:(w+6).
@@ -7063,98 +7063,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
@@ -7190,9 +7190,9 @@
     wI := w.
     hI := h.
     yI to:yI+hI-1 do:[:yRun |
-        xI to:xI+wI-1 do:[:xRun |
-            self atX:xRun y:yRun putValue:aPixelValue
-        ]
+	xI to:xI+wI-1 do:[:xRun |
+	    self atX:xRun y:yRun putValue:aPixelValue
+	]
     ]
 
     "Created: 22.4.1997 / 14:02:14 / cg"
@@ -7229,7 +7229,7 @@
     xStart := x1.
     xEnd := x2.
     xStart to:xEnd do:[:xRun |
-        aBlock value:xRun value:(self atX:xRun y:y)
+	aBlock value:xRun value:(self atX:xRun y:y)
     ]
 
     "Created: 7.6.1996 / 19:12:51 / cg"
@@ -7254,9 +7254,9 @@
 
     yS to:yE do:[:yRun |    
 	yR := yRun.
-        self colorsAtY:yRun from:xStart to:xEnd do:[:xRun :color |
-            aBlock value:xRun value:yR value:color 
-        ]
+	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"
@@ -7287,7 +7287,7 @@
     xStart := x1.
     xEnd := x2.
     xStart to:xEnd do:[:xRun |
-        aBlock value:xRun value:(self valueAtX:xRun y:y)
+	aBlock value:xRun value:(self valueAtX:xRun y:y)
     ]
 
     "Modified: 17.5.1996 / 12:03:59 / cg"
@@ -7308,9 +7308,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"
@@ -7330,13 +7330,13 @@
     h := height - 1.
 
     0 to:h do:[:y |
-        0 to:w do:[:x |
-            newImage atX:x y:y putValue:(pixelFunctionBlock
-                                                value:self
-                                                value:(self valueAtX:x y:y)
-                                                value:x
-                                                value:y)
-        ]
+	0 to:w do:[:x |
+	    newImage atX:x y:y putValue:(pixelFunctionBlock
+						value:self
+						value:(self valueAtX:x y:y)
+						value:x
+						value:y)
+	]
     ].
 
     "Created: 10.4.1997 / 16:26:17 / cg"
@@ -7353,17 +7353,17 @@
     |nColors "{ Class: SmallInteger }"|
 
     colorMap isNil ifTrue:[
-        ^ self error:'image has no colormap'
+	^ self error:'image has no colormap'
     ].
 
     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"
@@ -7437,7 +7437,7 @@
      CAVEAT: Need an argument, which specifies by how much it should be darker."
 
      ^ self 
-        copyWithColorMapProcessing:[:clr | clr darkened]
+	copyWithColorMapProcessing:[:clr | clr darkened]
 
     "
      (Image fromFile:'bitmaps/claus.gif') inspect
@@ -7459,16 +7459,16 @@
     h := height - 1.
 
     0 to:h do:[:row |
-        c2 := w.
-        0 to:(w // 2) do:[:col |
-            value := self valueAtX:col y:row.
-            self atX:col y:row putValue:(self valueAtX:c2 y:row).
-            self atX:c2 y:row putValue:value.
-            c2 := c2 - 1.
-        ]
+	c2 := w.
+	0 to:(w // 2) do:[:col |
+	    value := self valueAtX:col y:row.
+	    self atX:col y:row putValue:(self valueAtX:c2 y:row).
+	    self atX:c2 y:row putValue:value.
+	    c2 := c2 - 1.
+	]
     ].
     mask notNil ifTrue:[
-        mask flipHorizontal
+	mask flipHorizontal
     ].
     "flush device info"
     self restored
@@ -7494,14 +7494,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 restored
@@ -7537,19 +7537,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"
 
@@ -7557,11 +7557,11 @@
     h := newHeight - 1.
 
     0 to:h do:[:row |
-        srcRow := (row // mY).
-        0 to:w do:[:col |
-            value := self valueAtX:(col // mX) y:srcRow.
-            newImage atX:col y:row putValue:value.
-        ]
+	srcRow := (row // mY).
+	0 to:w do:[:col |
+	    value := self valueAtX:(col // mX) y:srcRow.
+	    newImage atX:col y:row putValue:value.
+	]
     ].
 
     ^ newImage
@@ -7583,7 +7583,9 @@
      newBytesPerRow newBits
      blackPixel halfW halfH radians m t bad
      bytesPerRow myDepth maskBits
-     pX pY pY2 nP srcX srcY pix theta nX nY nTheta|
+     pX pY srcX srcY pix nX nY 
+     sinRot cosRot sinPY cosPY|
+
 
     "/ placing the image at the origin,
     "/ compute the diagonal and angle.
@@ -7608,36 +7610,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].
     ].
 
 
@@ -7656,29 +7658,29 @@
     newImage colorMap:colorMap copy.
     newImage maskedPixelsAre0:maskedPixelsAre0.
     mask notNil ifTrue:[
-        newImage mask:(mask rotated:degrees)
+	newImage mask:(mask rotated:degrees)
     ] ifFalse:[
-        self isMask ifFalse:[
-            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:[
+	    m := ImageMask width:width height:height.
+	    m bits:(maskBits := ByteArray new:(m bytesPerRow * height)).
+	    maskBits atAllPut:16rFF.
+	    newImage mask:(m rotated:degrees)
+	]
     ].
 
     maskedPixelsAre0 ifTrue:[
-        blackPixel := 0.
+	blackPixel := 0.
     ] ifFalse:[
-        blackPixel := self valueFromColor:Color black.
-        blackPixel isNil ifTrue:[
-            blackPixel := self valueFromColor:Color white.
-            blackPixel isNil ifTrue:[
-                blackPixel := 0.
-            ]
-        ]
+	blackPixel := self valueFromColor:Color black.
+	blackPixel isNil ifTrue:[
+	    blackPixel := self valueFromColor:Color white.
+	    blackPixel isNil ifTrue:[
+		blackPixel := 0.
+	    ]
+	]
     ].
     self isMask ifTrue:[
-        blackPixel := 0.
+	blackPixel := 0.
     ].
 
     myDepth := self depth.
@@ -7708,12 +7710,14 @@
     int __nSrcBytes, __nDstBytes;
     int __srcBytesPerRow = __intVal(bytesPerRow);
     int __dstBytesPerRow = __intVal(newBytesPerRow);
-    int __dstMask;
+    int __dstMask, __blackPixel;
     int __rot1 = 0;
+    double __sin, __cos;
+    double sin(), cos();
 #   define Float_PI 3.14159
 
     if (__isSmallInteger(degrees) && (__intVal(degrees)<90)) {
-        __rot1 = 1;
+	__rot1 = 1;
     }
 
     bad = true;
@@ -7725,270 +7729,493 @@
      && __isFloat(halfH)
      && __isByteArray(newBits)
      && __isByteArray(__INST(bytes))) {
-        __srcBytes = __ByteArrayInstPtr(__INST(bytes))->ba_element;
-        __dstBytes = __ByteArrayInstPtr(newBits)->ba_element;
-        __nSrcBytes = __byteArraySize(__INST(bytes));
-        __nDstBytes = __byteArraySize(newBits);
-
-        __radians = __floatVal(radians);
-        __minX = __floatVal(minX);
-        __minY = __floatVal(minY);
-        __halfW = __floatVal(halfW);
-        __halfH = __floatVal(halfH);
-
-        __dstRowPtr = __dstBytes;
-        __dstEndPtr = __dstBytes + __nDstBytes;
-
-        for (__dstY = 0; __dstY < __newHeight; __dstY++) {
-            double __pY, __pY2;
-#define EARLY_OUT
+	__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
+
+	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) {
+#ifdef EARLY_OUT
+			    if (didFetchInRow) {
+				if (__rot1) break;
+			    }
+#endif
+			    __pix = __blackPixel;
+			} else {
+			    int __srcX;
+
+			    __srcX = (int)__nX;
+			    /* inside ? */
+			    if (__srcX >= __width) {
+#ifdef EARLY_OUT
+				if (didFetchInRow) {
+				    if (__rot1) 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) {
+#ifdef EARLY_OUT
+				    if (didFetchInRow) {
+					if (__rot1) break;
+				    }
+#endif
+				    __pix = __blackPixel;
+				} else {
+				    int __srcY;
+
+				    __srcY = (int)__nY;
+				    /* inside ? */
+				    if (__srcY >= __height) {
+#ifdef EARLY_OUT
+					if (didFetchInRow) {
+					    if (__rot1) break;
+					}
 #endif
-            __pY = (double)__dstY + __minY;
-            __pY2 = __pY * __pY;
-
-            __dstPtr = __dstRowPtr;
-            __dstMask = 0x80;
-            __dstRowPtr += __dstBytesPerRow;
-
-            for (__dstX = 0; __dstX < __newWidth; __dstX++) {
-                double __nX, __nY;
-                double sqrt(), sin(), cos(), atan(), floor();
-                double __r, __theta;
-
-                {
-                    double __pX;
-
-                    __pX = (double)__dstX + __minX;
-
-                    __r = sqrt((__pX * __pX) + __pY2);
-                    if (__pX == 0.0) {
-                        if (__pY >= 0.0) {
-                            __theta = Float_PI * 0.5;
-                        } else {
-                            __theta = Float_PI * 1.5;
-                        }
-                    } else {
-                        __theta = atan(__pY / __pX);
-                        if (__pX < 0.0) {
-                            __theta = __theta + Float_PI;
-                        }
-                    }
-                }
-                __theta = __theta - __radians;
-                __nX = __r * cos(__theta);
-
-                {
-                    int __srcX, __srcY;
-                    OBJ __pix;
-
-                    /* translate in source */
-                    __nX = __nX + __halfW + 0.5;
-                    if (__nX < 0) {
+					__pix = __blackPixel;
+				    } else {
+					/* fetch source pixel */
+
+					int idx;
+#ifdef EARLY_OUT
+					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;
 #ifdef EARLY_OUT
-                        if (didFetchInRow) {
-                            if (__rot1) break;
-                        }
+		    int didFetchInRow = 0;
 #endif
-                        __pix = blackPixel;
-                    } else {
-                        __srcX = (int)__nX;
-                        /* inside ? */
-                        if (__srcX >= __width) {
+		    __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) {
-                                if (__rot1) break;
-                            }
+			    if (didFetchInRow) {
+				if (__rot1) break;
+			    }
 #endif
-                            __pix = blackPixel;
-                        } else {
-                            __nY = __r * sin(__theta);
-                            __nY = __nY + __halfH + 0.5;
-
-                            if (__nY < 0) {
+			    __pix = __blackPixel;
+			} else {
+			    int __srcX;
+
+			    __srcX = (int)__nX;
+			    /* inside ? */
+			    if (__srcX >= __width) {
+#ifdef EARLY_OUT
+				if (didFetchInRow) {
+				    if (__rot1) 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) {
 #ifdef EARLY_OUT
-                                if (didFetchInRow) {
-                                    if (__rot1) break;
-                                }
+				    if (didFetchInRow) {
+					if (__rot1) break;
+				    }
 #endif
-                                __pix = blackPixel;
-                            } else {
-                                __srcY = (int)__nY;
-                                /* inside ? */
-                                if (__srcY >= __height) {
+				    __pix = __blackPixel;
+				} else {
+				    int __srcY;
+
+				    __srcY = (int)__nY;
+				    /* inside ? */
+				    if (__srcY >= __height) {
 #ifdef EARLY_OUT
-                                    if (didFetchInRow) {
-                                        if (__rot1) break;
-                                    }
+					if (didFetchInRow) {
+					    if (__rot1) break;
+					}
+#endif
+					__pix = __blackPixel;
+				    } else {
+					/* fetch source pixel */
+
+					int idx, pV;
+#ifdef EARLY_OUT
+					didFetchInRow = 1;
 #endif
-                                    __pix = blackPixel;
-                                } else {
-                                    /* fetch source pixel */
-
-                                    static struct inlineCache valAt = _ILC2;
-                                    int idx, pV;
-
+					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
-                                    didFetchInRow = 1;
+		    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) {
+#ifdef EARLY_OUT
+			    if (didFetchInRow) {
+				if (__rot1) break;
+			    }
+#endif
+			    __pix = __blackPixel;
+			} else {
+			    int __srcX;
+
+			    __srcX = (int)__nX;
+			    /* inside ? */
+			    if (__srcX >= __width) {
+#ifdef EARLY_OUT
+				if (didFetchInRow) {
+				    if (__rot1) 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) {
+#ifdef EARLY_OUT
+				    if (didFetchInRow) {
+					if (__rot1) break;
+				    }
+#endif
+				    __pix = __blackPixel;
+				} else {
+				    int __srcY;
+
+				    __srcY = (int)__nY;
+				    /* inside ? */
+				    if (__srcY >= __height) {
+#ifdef EARLY_OUT
+					if (didFetchInRow) {
+					    if (__rot1) break;
+					}
+#endif
+					__pix = __blackPixel;
+				    } else {
+					/* fetch source pixel */
+
+					int idx;
+#ifdef EARLY_OUT
+					didFetchInRow = 1;
 #endif
-                                    switch (__depth) {
-                                        case 1:
-                                            idx = __srcY * __srcBytesPerRow + (__srcX >> 3);
-                                            if ((unsigned)idx < __nSrcBytes) {
-                                                pV = __srcBytes[idx];
-                                                __pix = (pV & (0x80 >> (__srcX & 7))) ? __MKSMALLINT(1) : __MKSMALLINT(0);
-                                                break;
-                                            }
-                                            printf("should not happen: fetch1\n");
-                                            goto slowFetch;
-
-                                        case 8:
-                                            idx = __srcY * __srcBytesPerRow + __srcX;
-                                            if ((unsigned)idx < __nSrcBytes) {
-                                                __pix = __MKSMALLINT(__srcBytes[idx]);
-                                                break;
-                                            }
-                                            printf("should not happen: fetch8\n");
-                                            goto slowFetch;
-
-                                        case 24:
-                                            idx = __srcY * __srcBytesPerRow + __srcX + __srcX + __srcX;
-                                            if ((unsigned)idx < __nSrcBytes) {
-                                                pV = __srcBytes[idx];
-                                                pV = (pV<<8) | __srcBytes[idx+1];
-                                                pV = (pV<<8) | __srcBytes[idx+2];
-                                                __pix = __MKSMALLINT(pV);
-                                                break;
-                                            }
-                                            printf("should not happen: fetch24\n");
-                                            goto slowFetch;
-
-                                        default:
-                                        slowFetch: ;
-                                            __pix = (*valAt.ilc_func)(self,
-                                                                  @symbol(valueAtX:y:),
-                                                                  nil, &valAt,
-                                                                  __MKSMALLINT(__srcX),
-                                                                  __MKSMALLINT(__srcY));
-                                            break;
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    /* store pixel */
-                    switch (__depth) {
-                        case 1:
-                            if (__pix != __MKSMALLINT(0)) {
-                                *__dstPtr |= __dstMask;
-                            }
-                            __dstMask >>= 1;
-                            if (__dstMask == 0) {
-                                __dstMask = 0x80;
-                                __dstPtr++;
-                            }
-                            break;
-
-                        case 8:
-                            if (__pix != __MKSMALLINT(0)) {
-                                *__dstPtr = __intVal(__pix);
-                            }
-                            __dstPtr++;
-                            break;
-
-                        case 24:
-                            if (__pix != __MKSMALLINT(0)) {
-                                int pV = __intVal(__pix);
-
-                                __dstPtr[0] = (pV >> 16 & 0xFF);
-                                __dstPtr[1] = (pV >> 8) & 0xFF;
-                                __dstPtr[2] = pV & 0xFF;
-                            }
-                            __dstPtr += 3;
-                            break;
-
-                        default:
-                        slowStore: ;
-                            {
-                                static struct inlineCache atPutVal = _ILC3;
-
-                                if (__pix != __MKSMALLINT(0)) {
-                                    (*atPutVal.ilc_func)(newImage,
-                                                          @symbol(atX:y:putValue:),
-                                                          nil, &atPutVal,
-                                                          __MKSMALLINT(__dstX),
-                                                          __MKSMALLINT(__dstY),
-                                                          __pix
-                                                         );
-                                }
-                            }
-                            break;
-                    }
-                }
-            }
-        }
-        bad = false;
+					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];
+					    break;
+					}
+				    }
+				}
+			    }
+			}
+
+			/* 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;
+#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) {
+#ifdef EARLY_OUT
+			    if (didFetchInRow) {
+				if (__rot1) break;
+			    }
+#endif
+			    __pix = blackPixel;
+			} else {
+			    int __srcX;
+
+			    __srcX = (int)__nX;
+			    /* inside ? */
+			    if (__srcX >= __width) {
+#ifdef EARLY_OUT
+				if (didFetchInRow) {
+				    if (__rot1) 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) {
+#ifdef EARLY_OUT
+				    if (didFetchInRow) {
+					if (__rot1) break;
+				    }
+#endif
+				    __pix = blackPixel;
+				} else {
+				    int __srcY;
+
+				    __srcY = (int)__nY;
+				    /* inside ? */
+				    if (__srcY >= __height) {
+#ifdef EARLY_OUT
+					if (didFetchInRow) {
+					    if (__rot1) break;
+					}
+#endif
+					__pix = blackPixel;
+				    } else {
+					/* fetch source pixel */
+
+					static struct inlineCache valAt = _ILC2;
+#ifdef EARLY_OUT
+					didFetchInRow = 1;
+#endif
+					__pix = (*valAt.ilc_func)(self,
+							      @symbol(valueAtX:y:),
+							      nil, &valAt,
+							      __MKSMALLINT(__srcX),
+							      __MKSMALLINT(__srcY));
+				    }
+				}
+			    }
+			}
+
+			/* store pixel */
+			{
+			    static struct inlineCache atPutVal = _ILC3;
+
+			    if (__pix != __MKSMALLINT(0)) {
+				(*atPutVal.ilc_func)(newImage,
+						      @symbol(atX:y:putValue:),
+						      nil, &atPutVal,
+						      __MKSMALLINT(__dstX),
+						      __MKSMALLINT(__dstY),
+						      __pix
+						     );
+			    }
+			}
+		    }
+		}
+		break;
+	}
+
+	bad = false;
     }
 %}.
 
     bad ifTrue:[
-        0 to:newHeight-1 do:[:dstY |
-            pY := (dstY + minY).
-            pY2 := pY * pY.
-
-            0 to:newWidth-1 do:[:dstX |
-
-                "/ translate to center
-                pX := (dstX + minX).
-
-                "/ rotate back
-                "/ inlined: 
-                "/    p := pX @ pY.
-                "/    r := p r.
-                "/    theta := p theta.
-
-                r := ((pX * pX) + pY2) sqrt.
-                pX = 0 ifTrue:[
-                    pY >= 0 ifTrue:[
-                        theta := Float pi * 0.5
-                    ] ifFalse:[
-                        theta := Float pi * 1.5
-                    ]
-                ] ifFalse:[
-                    t := pY / pX.
-                    theta := t arcTan.
-                    pX < 0 ifTrue:[
-                        theta := theta + Float pi
-                    ]
-                ].
-
-                nTheta := theta - radians.
-                nX := r * nTheta cos.
-                nY := r * nTheta sin.
-
-                "/ translate in source
-                srcX := nX + halfW.
-                srcX := srcX rounded.
-                "/ inside ?
-
-                (srcX >= 0 and:[srcX < width]) ifTrue:[
-                    srcY := nY + halfH.
-                    srcY := srcY rounded.
-
-                    "/ inside ?
-                    (srcY >= 0 and:[srcY < height]) ifTrue:[
-                        pix := self valueAtX:srcX y:srcY
-                    ] ifFalse:[
-                        pix := blackPixel.        
-                    ].
-                ] ifFalse:[
-                    pix := blackPixel.        
-                ].
-                newImage atX:dstX y:dstY putValue:pix.        
-            ].
-        ].
+	sinRot := radians negated sin.
+	cosRot := radians negated cos.
+
+	0 to:newHeight-1 do:[:dstY |
+	    pY := (dstY + minY).
+	    sinPY := (sinRot * pY).
+	    cosPY := (cosRot * pY).
+
+	    0 to:newWidth-1 do:[:dstX |
+
+		"/ translate center to origin
+		pX := (dstX + minX).
+
+		nX := (cosRot * pX) - sinPY.
+
+		"/ translate in source
+		srcX := nX + halfW.
+		srcX := srcX rounded.
+		"/ inside ?
+
+		(srcX >= 0 and:[srcX < width]) ifTrue:[
+		    nY := (sinRot * pX) + cosPY.
+		    srcY := nY + halfH.
+		    srcY := srcY rounded.
+
+		    "/ inside ?
+		    (srcY >= 0 and:[srcY < height]) ifTrue:[
+			pix := self valueAtX:srcX y:srcY
+		    ] ifFalse:[
+			pix := blackPixel.        
+		    ].
+		] ifFalse:[
+		    pix := blackPixel.        
+		].
+		pix ~~ blackPixel ifTrue:[
+		    newImage atX:dstX y:dstY putValue:pix.        
+		]
+	    ].
+	].
     ].
 
     ^ newImage
@@ -8014,9 +8241,9 @@
 
      i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
      Transcript showCR:(
-        Time millisecondsToRun:[
-           i rotated:45.
-        ]
+	Time millisecondsToRun:[
+	   i rotated:45.
+	]
      ).
     "
     "
@@ -8027,10 +8254,10 @@
      v openAndWait.
      rot := 0.
      [true] whileTrue:[
-        rI := i rotated:rot.
-        v clear.
-        v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
-        rot := rot + 5.
+	rI := i rotated:rot.
+	v clear.
+	v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
+	rot := rot + 5.
      ]
     "
     "
@@ -8041,16 +8268,14 @@
      v openAndWait.
      rot := 0.
      [true] whileTrue:[
-        rI := i rotated:rot.
-        v clear.
-        v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
-        rot := rot + 5.
+	rI := i rotated:rot.
+	v clear.
+	v displayForm:rI x:v width//2-(rI width//2) y:v height//2-(rI height // 2).
+	rot := rot + 5.
      ]
     "
 
     "Modified: 22.4.1997 / 17:36:37 / cg"
-
-
 !
 
 lightened
@@ -8059,7 +8284,7 @@
      CAVEAT: Need an argument, which specifies by how much it should be lighter."
 
      ^ self 
-        copyWithColorMapProcessing:[:clr | clr lightened]
+	copyWithColorMapProcessing:[:clr | clr lightened]
 
     "
      (Image fromFile:'bitmaps/claus.gif') inspect
@@ -8094,7 +8319,7 @@
     ((mX = 1) and:[mY = 1]) ifTrue:[^ self].
 
     ((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[
-        ^ self hardMagnifiedBy:scalePoint
+	^ self hardMagnifiedBy:scalePoint
     ].
 
     bitsPerPixel := self depth.
@@ -8111,60 +8336,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:mY 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:mY 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:mY 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:mY do:[:i |
+		    newBits replaceFrom:dstOffset 
+			    to:(dstOffset + newBytesPerRow - 1)
+			    with:newBits 
+			    startingAt:first.
+		    dstOffset := dstOffset + newBytesPerRow
+		].
+		srcOffset := srcOffset + oldBytesPerRow.
+	    ].
+	]
     ].
     ^ newImage
 
@@ -8218,7 +8443,7 @@
      If rotation is heavily used, this method should be redefined in
      concrete subclasses.
      CAVEAT: 
-        Currently, only rotation by a multiple of 90 degrees is implemented."
+	Currently, only rotation by a multiple of 90 degrees is implemented."
 
     |w  "{Class: SmallInteger }"
      h  "{Class: SmallInteger }"
@@ -8235,15 +8460,15 @@
     d = 0 ifTrue:[^ self].
 "/ ^ self hardRotated:d.
     ((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.
     ].
 
     newBytesPerRow := ((nW * self depth) + 7) // 8.
@@ -8258,35 +8483,35 @@
     newImage bitsPerSample:bitsPerSample.
     newImage colorMap:colorMap copy.
     mask notNil ifTrue:[
-        newImage mask:(mask rotated:degrees)
+	newImage mask:(mask rotated:degrees)
     ].
 
     w := width - 1.
     h := height - 1.
 
     d = 90 ifTrue:[
-        0 to:h do:[:row |
-            c2 := h-row.
-            self valuesAtY:row from:0 to:w do:[:col :pixel |
-                newImage atX:c2 y:col putValue:pixel.
-            ]
-        ]
+	0 to:h do:[:row |
+	    c2 := h-row.
+	    self valuesAtY:row from:0 to:w do:[:col :pixel |
+		newImage atX:c2 y:col putValue:pixel.
+	    ]
+	]
     ] ifFalse:[
-        d = 180 ifTrue:[
-            0 to:h do:[:row |
-                r2 := h - row.
-                self valuesAtY:row from:0 to:w do:[:col :pixel |
-                    newImage atX:(w-col) y:r2 putValue:pixel.
-                ]
-            ].
-        ] ifFalse:[
-            "/ d = 270
-            0 to:h do:[:row |
-                self valuesAtY:row from:0 to:w do:[:col :pixel |
-                    newImage atX:row y:(w-col) putValue:pixel.
-                ]
-            ]
-        ].
+	d = 180 ifTrue:[
+	    0 to:h do:[:row |
+		r2 := h - row.
+		self valuesAtY:row from:0 to:w do:[:col :pixel |
+		    newImage atX:(w-col) y:r2 putValue:pixel.
+		]
+	    ].
+	] ifFalse:[
+	    "/ d = 270
+	    0 to:h do:[:row |
+		self valuesAtY:row from:0 to:w do:[:col :pixel |
+		    newImage atX:row y:(w-col) putValue:pixel.
+		]
+	    ]
+	].
     ].
 
     ^ newImage
@@ -8308,7 +8533,7 @@
     "return a new image from the old one, by applying a pixel processor
      on the pixel colors.
      (read `Behond photography, by Gerard J. Holzmann;
-           ISBM 0-13-074410-7)
+	   ISBM 0-13-074410-7)
      See blurred / oilPointed as examples ...)"
 
     |w  "{Class: SmallInteger }"
@@ -8331,13 +8556,13 @@
     h := height - 1.
 
     0 to:h do:[:y |
-        0 to:w do:[:x |
-            newImage atX:x y:y put:(pixelFunctionBlock
-                                                value:self
-                                                value:(self atX:x y:y)
-                                                value:x
-                                                value:y)
-        ]
+	0 to:w do:[:x |
+	    newImage atX:x y:y put:(pixelFunctionBlock
+						value:self
+						value:(self atX:x y:y)
+						value:x
+						value:y)
+	]
     ].
     ^ newImage
 
@@ -8349,13 +8574,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.
     "
 
     "Modified: 10.4.1997 / 16:35:10 / cg"
@@ -8365,7 +8590,7 @@
     "return a new image from the old one, by applying a pixel processor
      on the pixel values.
      (read `Behond photography, by Gerard J. Holzmann;
-           ISBM 0-13-074410-7)
+	   ISBM 0-13-074410-7)
      See blurred / oilPointed as examples ...)"
 
     |newImage newBits newBytesPerRow|
@@ -8394,27 +8619,27 @@
      w := i width - 1.
      h := i height - 1.
      (i withPixelFunctionAppliedToValues:[: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 valueAtX: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 valueAtX:tx y:ty)
+			  ]
+			].
+			max := 0.
+			b contents keysAndValuesDo:[:pixel :n |
+			    n > max ifTrue:[
+				p := pixel.
+				max := n
+			    ]
+			].
+			p
+		     ]) inspect.
     "
 
     "fisheye effect:
@@ -8430,25 +8655,25 @@
      R := w2.
      white := i valueFromColor:Color white.
      (i withPixelFunctionAppliedToValues:[: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 valueAtX: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 valueAtX:nX y:nY
+			    ]
+			]
+		     ]) inspect.
     "
     "fisheye effect:
 
@@ -8463,25 +8688,25 @@
      R := w2.
      white := i valueFromColor:Color white.
      (i withPixelFunctionAppliedToValues:[: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 valueAtX: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 valueAtX:nX y:nY
+			    ]
+			]
+		     ]) inspect.
     "
 
     "Created: 1.4.1997 / 23:22:11 / cg"
@@ -8495,7 +8720,7 @@
      (instead of the default InspectorView)."
 
     (width notNil and:[height notNil]) ifTrue:[
-        ^ ImageInspectorView
+	^ ImageInspectorView
     ].
     ^ super inspectorClass
 
@@ -8527,7 +8752,7 @@
     monoDeviceForm := nil.
     fullColorDeviceForm := nil.
     mask notNil ifTrue:[
-        mask release.
+	mask release.
     ].
     Lobby unregister:self.
 
@@ -8572,19 +8797,19 @@
     ((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 atX:x-dX y:y-dY putValue:pixelValue.
-        ]
+	"/ can loop over values
+	anImage valuesFromX:srcX  y:srcY 
+			toX:srcX+w-1 y:srcY+h-1  
+			 do:[:x :y :pixelValue |
+	    self atX:x-dX y:y-dY putValue: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 atX: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 atX:x-dX y:y-dY put:clr.
+	]
     ]
 
     "
@@ -8635,9 +8860,9 @@
     aStream nextPutAll:'); samplesPerPixel:('. samplesPerPixel storeOn:aStream. 
     aStream nextPutAll:'); bits:('. bytes storeOn:aStream. aStream nextPutAll:') '.
     colorMap notNil ifTrue:[
-        aStream nextPutAll:'; colorMap:('.
-        colorMap storeOn:aStream.
-        aStream nextPutAll:')'.
+	aStream nextPutAll:'; colorMap:('.
+	colorMap storeOn:aStream.
+	aStream nextPutAll:')'.
     ].
     aStream nextPutAll:'; yourself'
 
@@ -8658,55 +8883,55 @@
     maxBitsPerPixel := 0.
 
     aDevice supportedImageFormats do:[:entry |
-        |deviceImageDepth deviceImageBitsPerPixel|
-
-        deviceImageDepth := entry at:#depth.
-        deviceImageBitsPerPixel := entry at:#bitsPerPixel.
-
-        deviceImageBitsPerPixel > maxBitsPerPixel ifTrue:[
-            maxInfo := entry.
+	|deviceImageDepth deviceImageBitsPerPixel|
+
+	deviceImageDepth := entry at:#depth.
+	deviceImageBitsPerPixel := entry at:#bitsPerPixel.
+
+	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
 
@@ -8720,27 +8945,27 @@
      for fromImage:/fromSubImake:"
 
     samplesPerPixel == 3 ifTrue:[
-        photometric := #rgb
+	photometric := #rgb
     ] ifFalse:[
-        photometric := anImage photometric.
-        photometric == #palette ifTrue:[
-            colorMap := anImage colorMap copy.
-            "
-             must compress the colormap, if source image has higher depth
-             than myself. 
-            "
-            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
-                "
-                colorMap := anImage usedColors asArray.
-                colorMap size > (1 bitShift:self bitsPerPixel) ifTrue:[
-                    'Image [warning]: possibly too many colors in image' errorPrintCR
-                ]
-            ]
-        ]
+	photometric := anImage photometric.
+	photometric == #palette ifTrue:[
+	    colorMap := anImage colorMap copy.
+	    "
+	     must compress the colormap, if source image has higher depth
+	     than myself. 
+	    "
+	    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
+		"
+		colorMap := anImage usedColors asArray.
+		colorMap size > (1 bitShift:self bitsPerPixel) ifTrue:[
+		    'Image [warning]: possibly too many colors in image' errorPrintCR
+		]
+	    ]
+	]
     ].
 
     "Created: 20.9.1995 / 00:58:42 / claus"
@@ -8758,51 +8983,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
@@ -8831,44 +9056,44 @@
     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:[
-        n := colorMap size.
-        1 to:n do:[:i |
-            (clr := colorMap at:i) isNil ifTrue:[
-                "/ an unused color
-                val := 0.
-            ] ifFalse:[
-                val := range * clr brightness
-            ].
-            greyArray at:i put:val
-        ].
+	n := colorMap size.
+	1 to:n do:[:i |
+	    (clr := colorMap at:i) isNil ifTrue:[
+		"/ an unused color
+		val := 0.
+	    ] ifFalse:[
+		val := range * clr brightness
+	    ].
+	    greyArray at:i put:val
+	].
     ] 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
 
@@ -8907,16 +9132,16 @@
     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
-               width:width height:height
-                   x:0 y:0
-                into:(f id) 
-                   x:0 y:0 
-               width:width height:height 
-                with:(f gcId).
+	       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"
@@ -8928,7 +9153,7 @@
 
 "/    monoBits invert.
     ^ (Form width:width height:height fromArray:monoBits on: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"
@@ -8948,12 +9173,12 @@
     f initGC.
 
     aDevice drawBits:bits depth:depth
-               width:width height:height
-                   x:0 y:0
-                into:(f id) 
-                   x:0 y:0 
-               width:width height:height 
-                with:(f gcId).
+	       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"
@@ -9020,12 +9245,12 @@
     |blueBits|
 
     samplesPerPixel >= 3 ifTrue:[
-        "/ assume that the red bits are the leftMost bits
-
-        blueBits := bitsPerSample at:3.
-        blueBits == 0 ifTrue:[^ 0].
-
-        ^ pixel bitAnd:(1 bitShift:blueBits)-1
+	"/ assume that the red bits are the leftMost bits
+
+	blueBits := bitsPerSample at:3.
+	blueBits == 0 ifTrue:[^ 0].
+
+	^ pixel bitAnd:(1 bitShift:blueBits)-1
     ].
 
     self subclassResponsibility
@@ -9043,14 +9268,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
@@ -9099,36 +9324,36 @@
 
     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.
-        ^ 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
-        ].
-        ^ colorMap at:(pixelValue + 1)
+	pixelValue >= colorMap size ifTrue:[
+	    ^ Color black
+	].
+	^ colorMap at:(pixelValue + 1)
     ].
 
     p == #rgb ifTrue:[
-        r := self redComponentOf:pixelValue.
-        g := self greenComponentOf:pixelValue.
-        b := self blueComponentOf:pixelValue.
-        ^ Color red:r green:g blue:b
+	r := self redComponentOf:pixelValue.
+	g := self greenComponentOf:pixelValue.
+	b := self blueComponentOf:pixelValue.
+	^ Color red:r green:g blue:b
     ].
 
     self error:'invalid photometric'
@@ -9145,13 +9370,13 @@
     |blueBits greenBits|
 
     samplesPerPixel >= 3 ifTrue:[
-        "/ assume that the red bits are the leftMost bits
-
-        greenBits := bitsPerSample at:2.
-        greenBits == 0 ifTrue:[^ 0].
-        blueBits := bitsPerSample at:3.
-
-        ^ (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.
+
+	^ (pixel bitShift:blueBits negated) bitAnd:(1 bitShift:greenBits)-1
     ].
 
     self subclassResponsibility
@@ -9170,15 +9395,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
@@ -9222,7 +9447,7 @@
     "return the kind of pixel-value container in rowAt:/rowAt:put: methods"
 
     depth > 8 ifTrue:[
-        ^ Array
+	^ Array
     ].
     ^ ByteArray
 
@@ -9239,20 +9464,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
@@ -9269,15 +9494,15 @@
     |redBits greenBits blueBits|
 
     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.
-
-        ^ (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.
+
+	^ (pixel bitShift:(greenBits + blueBits) negated)
+	   bitAnd:(1 bitShift:redBits)-1
     ].
 
     self subclassResponsibility
@@ -9297,19 +9522,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
@@ -9324,16 +9549,16 @@
     |usedValues max|
 
     photometric == #rgb ifTrue:[
-        "/ too many to be returned here (think of the mass of
-        "/ data to be returned by a 24bit image ... ;-)
-
-        self error:'query not allowed for this image'.
-        ^ nil
+	"/ too many to be returned here (think of the mass of
+	"/ data to be returned by a 24bit image ... ;-)
+
+	self error:'query not allowed for this image'.
+	^ nil
     ].
 
     usedValues := self usedValues asArray.
     photometric == #palette ifTrue:[
-        ^ usedValues collect:[:val | (colorMap at:val+1)]
+	^ usedValues collect:[:val | (colorMap at:val+1)]
     ].
 
     "/ (photometric == #blackIs0 or:[photometric == #whiteIs0])
@@ -9379,39 +9604,39 @@
     |pixel maxPixel redBits greenBits blueBits r g b|
 
     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:[
-        pixel := colorMap indexOf:color.
-        pixel == 0 ifTrue:[
-            "
-             the color to be stored is not in the images colormap
-            "
-            ^ nil
-        ].
-        ^ pixel - 1
+	pixel := colorMap indexOf:color.
+	pixel == 0 ifTrue:[
+	    "
+	     the color to be stored 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.
+	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
-        ]
+	    "/ 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
+	]
     ].
 
     self error:'format not supported'.
@@ -9449,7 +9674,7 @@
     suffix := aFileName asFilename suffix.
     readerClass := FileFormats at:suffix ifAbsent:nil.
     readerClass notNil ifTrue:[
-        ^ self saveOn:aFileName using:readerClass
+	^ self saveOn:aFileName using:readerClass
     ].
 
     "/
@@ -9499,9 +9724,9 @@
 
      anImage := Image fromFile:'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.
      ]
     "
 
@@ -9561,52 +9786,52 @@
     device := aDrawable graphicsDevice.
 
     (aDrawable isForm and:[aDrawable depth == 1]) ifTrue:[
-        "/ a monochrome bitmap ?
-        visType := #StaticGray.
-        depth := 1.
+	"/ a monochrome bitmap ?
+	visType := #StaticGray.
+	depth := 1.
     ] ifFalse:[
-        "
-         get some attributes of the display device
-        "
-        visType := device visualType.
-        depth := device depth.
+	"
+	 get some attributes of the display device
+	"
+	visType := device visualType.
+	depth := device depth.
     ].
 
     "/ kludge for 15bit XFree server
     depth == 15 ifTrue:[
-        depth := 16
+	depth := 16
     ].
 
     (visType == #StaticGray) ifTrue:[
-        (device blackpixel == 0) ifTrue:[
-            photometric := #blackIs0
-        ] ifFalse:[
-            photometric := #whiteIs0
-        ].
-        samplesPerPixel := 1.
-        bitsPerPixel := depth.
-        bitsPerSample := Array with:bitsPerPixel.
+	(device blackpixel == 0) ifTrue:[
+	    photometric := #blackIs0
+	] ifFalse:[
+	    photometric := #whiteIs0
+	].
+	samplesPerPixel := 1.
+	bitsPerPixel := depth.
+	bitsPerSample := Array with:bitsPerPixel.
     ] ifFalse:[
-        ((visType == #PseudoColor) or:[(visType == #StaticColor) or:[visType == #GrayScale]]) ifTrue:[
-            photometric := #palette.
-            samplesPerPixel := 1.
-            bitsPerPixel := depth.
-            bitsPerSample := Array with:bitsPerPixel.
-        ] ifFalse:[
-            ((visType == #TrueColor) or:[visType == #DirectColor]) ifTrue:[
-                photometric := #rgb.
-                samplesPerPixel := 3.
+	((visType == #PseudoColor) or:[(visType == #StaticColor) or:[visType == #GrayScale]]) ifTrue:[
+	    photometric := #palette.
+	    samplesPerPixel := 1.
+	    bitsPerPixel := depth.
+	    bitsPerSample := Array with:bitsPerPixel.
+	] ifFalse:[
+	    ((visType == #TrueColor) or:[visType == #DirectColor]) ifTrue:[
+		photometric := #rgb.
+		samplesPerPixel := 3.
 "/                bitsPerPixel := depth.
 "/                bitsPerSample := Array with:device bitsRed
 "/                                       with:device bitsGreen
 "/                                       with:device bitsBlue
-                bitsPerPixel := 24.
-                bitsPerSample := #(8 8 8).
-            ] ifFalse:[
-                self error:'screen visual not supported'.
-                ^ nil
-            ]
-        ]
+		bitsPerPixel := 24.
+		bitsPerSample := #(8 8 8).
+	    ] ifFalse:[
+		self error:'screen visual not supported'.
+		^ nil
+	    ]
+	]
     ].
 
     "
@@ -9624,13 +9849,13 @@
     "
     spaceBitsPerPixel := bitsPerPixel.
     (bitsPerPixel > 8) ifTrue:[
-        spaceBitsPerPixel := 16.
-        (bitsPerPixel > 16) ifTrue:[
-            spaceBitsPerPixel := 32.
-            (bitsPerPixel > 32) ifTrue:[
-                spaceBitsPerPixel := bitsPerPixel.
-            ]
-        ]
+	spaceBitsPerPixel := 16.
+	(bitsPerPixel > 16) ifTrue:[
+	    spaceBitsPerPixel := 32.
+	    (bitsPerPixel > 32) ifTrue:[
+		spaceBitsPerPixel := bitsPerPixel.
+	    ]
+	]
     ].
 
     bytesPerLine := (w * spaceBitsPerPixel + 31) // 32 * 4.
@@ -9640,9 +9865,9 @@
      get the pixels
     "
     aDrawable isForm ifTrue:[
-        info := device getBitsFromPixmapId:aDrawable id x:x y:y width:w height:h into:inData. 
+	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. 
     ].
 
     "
@@ -9651,15 +9876,15 @@
     byteOrder := info at:#byteOrder.
     bitsPerPixelIn := info at:#bitsPerPixel.
     byteOrder ~~ #msbFirst ifTrue:[
-        bitsPerPixelIn == 16 ifTrue:[
-            "/ must swap bytes
-            inData swapBytes
-        ] ifFalse:[
-            bitsPerPixelIn == 32 ifTrue:[
-                "/ must swap longs
-                inData swapLongs
-            ]
-        ]
+	bitsPerPixelIn == 16 ifTrue:[
+	    "/ must swap bytes
+	    inData swapBytes
+	] ifFalse:[
+	    bitsPerPixelIn == 32 ifTrue:[
+		"/ must swap longs
+		inData swapLongs
+	    ]
+	]
     ].
 
     "
@@ -9671,91 +9896,91 @@
 
     ((bytesPerLine ~~ bytesPerLineIn) 
     or:[bitsPerPixelIn ~~ bitsPerPixel]) ifTrue:[
-        tmpData := inData.
-        inData := ByteArray uninitializedNew:(bytesPerLine * height).
-
-        srcRow := 1.
-        dstRow := 1.
-
-        bitsPerPixelIn ~~ bitsPerPixel ifTrue:[
-            "/ for now, only 32 -> 24 is supported
-
-            maskR := (1 bitShift:device bitsRed) - 1.
-            maskG := (1 bitShift:device bitsGreen) - 1.
-            maskB := (1 bitShift:device bitsBlue) - 1.
-            shR := device shiftRed negated.
-            shG := device shiftGreen negated.
-            shB := device shiftBlue negated.
-            shR2 := (8 - device bitsRed).
-            shG2 := (8 - device bitsGreen).
-            shB2 := (8 - device bitsBlue).
-
-            ((bitsPerPixelIn == 32) and:[bitsPerPixel == 24]) ifTrue:[
-                "/ 'reformatting 32->24...' printNL.
-                1 to:h do:[:hi |
-                    srcIndex := srcRow.
-                    dstIndex := dstRow.
-
-                    1 to:w do:[:wi |
-                        word := tmpData doubleWordAt:srcIndex MSB:true.
-                        r := (word bitShift:shR) bitAnd:maskR.
-                        g := (word bitShift:shG) bitAnd:maskG.
-                        b := (word 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:[bitsPerPixel == 24]) ifTrue:[
-                    "/ 'reformatting 16->24...' printNL.
-                    1 to:h do:[:hi |
-                        srcIndex := srcRow.
-                        dstIndex := dstRow.
-
-                        1 to:w do:[:wi |
-                            word := tmpData wordAt:srcIndex MSB:true.
-                            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 , ' -> ' ,
-                                                        bitsPerPixel printString) errorPrintCR.
-                    ^ 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 ~~ bitsPerPixel ifTrue:[
+	    "/ for now, only 32 -> 24 is supported
+
+	    maskR := (1 bitShift:device bitsRed) - 1.
+	    maskG := (1 bitShift:device bitsGreen) - 1.
+	    maskB := (1 bitShift:device bitsBlue) - 1.
+	    shR := device shiftRed negated.
+	    shG := device shiftGreen negated.
+	    shB := device shiftBlue negated.
+	    shR2 := (8 - device bitsRed).
+	    shG2 := (8 - device bitsGreen).
+	    shB2 := (8 - device bitsBlue).
+
+	    ((bitsPerPixelIn == 32) and:[bitsPerPixel == 24]) ifTrue:[
+		"/ 'reformatting 32->24...' printNL.
+		1 to:h do:[:hi |
+		    srcIndex := srcRow.
+		    dstIndex := dstRow.
+
+		    1 to:w do:[:wi |
+			word := tmpData doubleWordAt:srcIndex MSB:true.
+			r := (word bitShift:shR) bitAnd:maskR.
+			g := (word bitShift:shG) bitAnd:maskG.
+			b := (word 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:[bitsPerPixel == 24]) ifTrue:[
+		    "/ 'reformatting 16->24...' printNL.
+		    1 to:h do:[:hi |
+			srcIndex := srcRow.
+			dstIndex := dstRow.
+
+			1 to:w do:[:wi |
+			    word := tmpData wordAt:srcIndex MSB:true.
+			    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 , ' -> ' ,
+							bitsPerPixel printString) errorPrintCR.
+		    ^ 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
+	]
     ].
     bytes := inData.
 
@@ -9764,28 +9989,28 @@
     ((visType == #StaticGray) 
     or:[visType == #TrueColor
     or:[visType == #DirectColor]]) ifTrue:[
-        "
-         were done, the pixel values are the rgb/grey values
-        "
+	"
+	 were done, the pixel values are the rgb/grey values
+	"
     ] ifFalse:[
-        "
-         what we have now 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)
-            ]
-        ].
-        colorMap := map.
+	"
+	 what we have now 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)
+	    ]
+	].
+	colorMap := map.
     ].
 
     "Modified: 19.3.1997 / 13:45:01 / cg"
@@ -9794,13 +10019,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"
 !
@@ -9812,13 +10037,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 new) fromScreen:((0 @ 0) corner:(100 @ 100)) on:Display
@@ -9838,18 +10063,18 @@
      (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 cid rootView|
 
     doGrab ifTrue:[
-        curs := Cursor sourceForm:(Image fromFile:'bitmaps/Camera.xbm')
-                         maskForm:(Image fromFile:'bitmaps/Camera_m.xbm')
-                          hotSpot:16@16.
-        curs notNil ifTrue:[
-            cid := (curs on:aDevice) id
-        ].
+	curs := Cursor sourceForm:(Image fromFile:'bitmaps/Camera.xbm')
+			 maskForm:(Image fromFile:'bitmaps/Camera_m.xbm')
+			  hotSpot:16@16.
+	curs notNil ifTrue:[
+	    cid := (curs on:aDevice) id
+	].
     ].
 
     "
@@ -9857,23 +10082,23 @@
     "
     rootView := aDevice rootView.
     doGrab ifTrue:[
-        aDevice setActivePointerGrab:rootView.
-        aDevice grabPointerIn:rootView id
-                   withCursor:cid 
-                   pointerMode:#async 
-                   keyboardMode:#sync 
-                   confineTo:nil.
+	aDevice setActivePointerGrab:rootView.
+	aDevice grabPointerIn:rootView id
+		   withCursor:cid 
+		   pointerMode:#async 
+		   keyboardMode:#sync 
+		   confineTo:nil.
     ].
 
     "
      get the pixels
     "
     [
-        self from:rootView in:aRectangle.
+	self from:rootView in:aRectangle.
     ] valueNowOrOnUnwindDo:[
-        doGrab ifTrue:[
-            aDevice ungrabPointer.
-        ]
+	doGrab ifTrue:[
+	    aDevice ungrabPointer.
+	]
     ]
 
     "Created: 26.3.1997 / 10:36:30 / cg"
@@ -9895,49 +10120,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 := Array 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 := Array 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 := Array 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.
@@ -9956,6 +10181,6 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.180 1997-04-22 23:04:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.181 1997-04-23 09:04:42 cg Exp $'
 ! !
 Image initialize!