pixel accessing methods cleaned up
authorClaus Gittinger <cg@exept.de>
Thu, 24 Apr 1997 18:05:36 +0200
changeset 1660 67a3a6eab23a
parent 1659 a38cf5be1aa8
child 1661 5b4c1f6ab871
pixel accessing methods cleaned up many loops rewritten to make use of #rowAt: and #rowAt:putAll:
Image.st
--- a/Image.st	Thu Apr 24 18:03:30 1997 +0200
+++ b/Image.st	Thu Apr 24 18:05:36 1997 +0200
@@ -52,18 +52,21 @@
     The data held keeps all information which was originally present, 
     even if the display-device has lower resolution.
     Therefore, it is possible to process and manipulate images without loosing 
-    color information - even on low color resolution displays.
-
-    Usually, you get a device specific representation of the image by
-    sending the 
-	'on:aDevice' 
-    message to it, which will create a (possibly dithered) device-form, 
+    color information.
+
+    Images may be created manually (by providing a pixel array),
+    by screen capture or by reading a file (using an ImageReader).
+    This gives a device independent image.
+    For display, a device representation is required, which can be
+    aquired by sending the 
+        'onDevice:aDevice' 
+    message to the image. This 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 
@@ -74,7 +77,7 @@
     This is in contrast to the ST-80 way, where all of this info is in the colorMap
     (and using specialized colorMaps for b&w / greyScale images).
     This may change in future versions for more application compatibility.
- 
+
     To convert pictures from/to external file-formats, image readers are used
     which have the file-format knowledge built in. 
     There are readers for most common formats available 
@@ -83,7 +86,7 @@
     File formats are handled by subclasses of ImageReader, which understand
     a specific format. You can add more readers, by adding an association
     such as ('.jpg' -> JPEGReader) to the class variable 'FileFormats' 
-    (see the classes #initialize method, which dsets up some default, and the
+    (see the classes #initialize method, which sets up some default, and the
     patches/display.rc files, which add more).
 
     Some algorithms used here (especially dithering & color allocation) are
@@ -99,89 +102,126 @@
        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
-					    (which are stored as instVarAt:put: expressions)
+        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 #palette;
+                                            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.
+                                            (not yet implemented)
+
+        mask                <ImageMask>     an optional mask;
+                                            if non-nil, only pixels for which the
+                                            corresponding mask bit is non-zero
+                                            are drawn.
+
+        maskedPixelsAre0    <Boolean>       a hint for image processors and drawers
+                                            if true, masked pixels are known to be
+                                            zero in the pixel bytes.
+
+        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.
+
+        ImageNotFoundQuerySignal
+                            <QuerySignal>   raised, if an image could not be loaded
+                                            from a file. The parameter is the images
+                                            fileName. 
+                                            A handler may return a replacement
+                                            image or proceed with nil.
+                                            If unhandled, a nil is returned from the
+                                            image creation.
+
+        BadImageFormatQuerySignal
+                            <QuerySignal>   raised, if an image could not be loaded
+                                            from a file due to a file error or
+                                            unsupported format. 
+                                            A handler may return a replacement
+                                            image or proceed with nil.
+                                            If unhandled, a nil is returned from the
+                                            image creation.
+
+        ImageSaveErrorSignal
+                            <Signal>        parent of errors below.
+
+        FileCreationErrorSignal
+                            <Signal>        file could not be created when saving an
+                                            image.
+
+        CannotRepresentImageSignal
+                            <Signal>        the specified ImageReader cannot represent
+                                            the given image.
+
+        InformationLostQuerySignal
+                            <Signal>        the specified ImageReader can represent
+                                            the given image, but some information
+                                            (typically color resolution) is lost.
+                                            If unhandled, the save proceeds as usual.
+
 
     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.
+        support alpha masks
+        cleanup the dithering & conversion code
 
     [See also:]
-	Form Icon ImageReader
+        Form Icon ImageReader
 
     [author:]
-	Claus Gittinger
+        Claus Gittinger
 "
+
 !
 
 examples
@@ -1924,71 +1964,85 @@
 !Image methodsFor:'accessing - pixels'!
 
 at:aPoint
-    "retrieve the pixel at aPoint; return a color.
+    "WARNING: for now, this returns a pixels color 
+     (backward compatibility with ST/X)
+     In the future, this will return a pixel value (ST-80 compatibility)
+     Use #colorAt: - for future compatibility.
+
+     retrieve the pixel at aPoint; return a color.
      Pixels start at 0@0 for upper left pixel, end at
      (width-1)@(height-1) for lower right pixel.
      You should not use this method for image-processing, its
      very slow ...
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
-    ^ self atX:aPoint x y:aPoint y
+    'Image [warning]: the Image>>at: will change semantics soon' infoPrintCR.
+    ^ self colorAtX:(aPoint x) y:(aPoint y)
+
+    "Modified: 24.4.1997 / 17:31:40 / cg"
 !
 
 at:aPoint put:aColor
-    "set the pixel at aPoint to aColor.
+    "WARNING: for now, this expects a pixels color 
+     (backward compatibility with ST/X)
+     In the future, this will expect a pixel value (ST-80 compatibility)
+     Use #colorAt:put: - for future compatibility.
+
+     set the pixel at aPoint to aColor.
      Pixels start at 0@0 for the upper left pixel, end at
      (width-1)@(height-1) for lower right pixel.
      You should not use this method for image-processing, its
      very slow ...
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
+    'Image [warning]: the Image>>at:put: will change semantics soon' infoPrintCR.
     ^ self atX:aPoint x y:aPoint y put:aColor
+
+    "Modified: 24.4.1997 / 17:31:59 / cg"
 !
 
 atPoint:aPoint
     "ST-80 compatibility: return the pixelValue at:aPoint."
 
-    ^ self valueAtX:aPoint x y:aPoint y
+    ^ self pixelAtX:aPoint x y:aPoint y
+
+    "Modified: 24.4.1997 / 16:18:44 / cg"
 !
 
 atPoint:aPoint put:aPixelValue
     "ST-80 compatibility: set the pixelValue at:aPoint."
 
-    ^ self atX:aPoint x y:aPoint y putValue:aPixelValue
-
-    "Created: 6.3.1997 / 15:24:14 / cg"
+    ^ self pixelAtX:aPoint x y:aPoint y put:aPixelValue
+
+    "Modified: 24.4.1997 / 17:17:59 / cg"
 !
 
 atX:x y:y
-    "retrieve a pixel at x/y; return a color.
+    "WARNING: for now, this returns a pixels color 
+     (backward compatibility with ST/X)
+     In the future, this will return a pixel value (ST-80 compatibility)
+     Use #colorAt: - for future compatibility.
+
+     Retrieve a pixel at x/y; return a color.
      Pixels start at 0@0 for upper left pixel, end at
      (width-1)@(height-1) for lower right pixel.
      You should not use this method for image-processing, its
      very slow ...
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
-    |pixel maxPixel|
-
-    pixel := self valueAtX:x y:y.
-    photometric == #blackIs0 ifTrue:[
-	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)).
-    ].
-    photometric == #palette ifTrue:[
-	^ colorMap at:(pixel + 1)
-    ].
-
-    ^ self colorFromValue:pixel
-
-    "Modified: 8.6.1996 / 10:53:22 / cg"
+    'Image [warning]: the Image>>atX:y: will change semantics soon' infoPrintCR.
+    ^ self colorAtX:x y:y
+
+    "Modified: 24.4.1997 / 17:28:37 / cg"
 !
 
 atX:x y:y put:aColor
-    "set the pixel at x/y to aColor.
+    "WARNING: for now, this expects a pixels color 
+     (backward compatibility with ST/X)
+     In the future, this will expect a pixel value (ST-80 compatibility)
+     Use #colorAt:put: - for future compatibility.
+
+     set the pixel at x/y to aColor.
      Pixels start at 0@0 for the upper left pixel, end at
      (width-1)@(height-1) for the lower right pixel.
      This method checks if the color can be stored in the image.
@@ -1996,33 +2050,10 @@
      You should not use this method for image-processing, it is very slow ...
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
-    |pixel maxPixel|
-
-    photometric == #whiteIs0 ifTrue:[
-	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
-	]
-    ].
-    self atX:x y:y putValue:pixel.
-
-    "Modified: 7.6.1996 / 19:17:48 / cg"
+    'Image [warning]: the Image>>atX:y:put: will change semantics soon' infoPrintCR.
+    ^ self colorAtX:x y:y put:aColor
+
+    "Modified: 24.4.1997 / 17:30:48 / cg"
 !
 
 atX:x y:y putValue:aPixelValue
@@ -2035,7 +2066,10 @@
      very slow ...
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
-    ^ self subclassResponsibility
+    self obsoleteMethodWarning:'use #pixelAtX:y:put:'.
+    ^ self pixelAtX:x y:y put:aPixelValue.
+
+    "Modified: 24.4.1997 / 17:15:45 / cg"
 !
 
 bits
@@ -2047,49 +2081,72 @@
     ^ bytes
 !
 
+colorAt:aPoint
+    "retrieve a pixel at x/y; return a color.
+     Pixels start at 0@0 for upper left pixel, end at
+     (width-1)@(height-1) for lower right pixel.
+     You should not use this method for image-processing, its
+     very slow ...
+     (it is meant to access individual pixels - for example, in a bitmap editor)"
+
+    ^ self colorAtX:(aPoint x) y:(aPoint y)
+
+    "Created: 24.4.1997 / 17:02:31 / cg"
+!
+
+colorAtX:x y:y
+    "retrieve a pixel at x/y; return a color.
+     Pixels start at 0@0 for upper left pixel, end at
+     (width-1)@(height-1) for lower right pixel.
+     You should not use this method for image-processing, its
+     very slow ...
+     (it is meant to access individual pixels - for example, in a bitmap editor)"
+
+    |pixel|
+
+    pixel := self pixelAtX:x y:y.
+    ^ self colorFromValue:pixel
+
+    "Modified: 24.4.1997 / 16:18:53 / cg"
+    "Created: 24.4.1997 / 17:00:52 / cg"
+!
+
+colorAtX:x y:y put:aColor
+    "set the pixel at x/y to aColor.
+     Pixels start at 0@0 for the upper left pixel, end at
+     (width-1)@(height-1) for the lower right pixel.
+     This method checks if the color can be stored in the image.
+     (i.e. if the receiver is a palette image, the color must be present in there).
+     You should not use this method for image-processing, it is very slow ...
+     (it is meant to access individual pixels - for example, in a bitmap editor)"
+
+    |pixel|
+
+    pixel := self valueFromColor:aColor.
+    self pixelAtX:x y:y put:pixel.
+
+    "Modified: 24.4.1997 / 17:36:20 / cg"
+!
+
 data
     "for backward compatibility - will vanish"
 
+    self obsoleteMethodWarning:'use #bits'.
     ^ bytes
+
+    "Modified: 24.4.1997 / 17:37:57 / cg"
 !
 
 data:aByteArray
     "for backward compatibility - will vanish"
 
+    self obsoleteMethodWarning.
     bytes := aByteArray
-!
-
-rowAt:rowIndex putAll:pixelArray
-    "replace a single rows bits from bits in the argument;
-     Notice: row indexing starts at 0.
-     This is a slow fallBack method, which works with any depth;
-     concrete image subclasses should redefine this for more performance."
-
-    |w "{ Class: SmallInteger }"|
-
-    w := width-1.
-    0 to:w do:[:col |
-	self atX:col y:rowIndex putValue:(pixelArray at:(col + 1))
-    ].
-    ^ pixelArray
-
-    "Created: 6.3.1997 / 15:24:09 / cg"
-!
-
-valueAt:aPoint
-    "retrieve the pixelValue at aPoint; return an integer number.
-     Pixels start at 0@0 for upper left pixel, end at
-     width-1@height-1 for lower right pixel.
-     The returned numbers interpretation depends on the photometric
-     and the colormap. (see also Image>>at: and Image>>atX:y:)
-     You should not use this method for image-processing, its
-     very slow ...
-     (it is meant to access individual pixels - for example, in a bitmap editor)"
-
-    ^ self valueAtX:aPoint x y:aPoint y
-!
-
-valueAtX:x y:y
+
+    "Modified: 24.4.1997 / 17:38:18 / cg"
+!
+
+pixelAtX:x y:y
     "retrieve the pixelValue at aPoint; return an integer number.
      Pixels start at 0/0 for upper left pixel, and end at
      width-1@height-1 for lower right pixel.
@@ -2100,6 +2157,150 @@
      (it is meant to access individual pixels - for example, in a bitmap editor)"
 
     ^ self subclassResponsibility
+
+    "Created: 24.4.1997 / 16:06:56 / cg"
+!
+
+pixelAtX:x y:y put:aPixelValue
+    "set the pixel at x/y to aPixelValue.
+     The interpretation of the pixelValue depends on the photometric
+     and the colormap. (see also: Image>>atX:y:put:)
+     Pixels start at 0@0 for the upper left pixel, end at
+     (width-1) @ (height-1) for the lower right pixel.
+     You should not use this method for image-processing, its
+     very slow ...
+     (it is meant to access individual pixels - for example, in a bitmap editor)"
+
+    ^ self subclassResponsibility
+
+    "Created: 24.4.1997 / 17:05:11 / cg"
+!
+
+rowAt:rowIndex
+    "retrieve an array filled with pixel values from
+     a single row.
+     Notice: row indexing starts at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    |pixelArray|
+
+    pixelArray := self pixelArraySpecies new:width.
+    self rowAt:rowIndex into:pixelArray startingAt:1.
+    ^ pixelArray
+
+    "
+     |i|
+
+     i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+     (i rowAt:0) inspect
+    "
+    "
+     |i|
+
+     i := Image fromFile:'bitmaps/SBrowser.xbm'.
+     (i rowAt:0) inspect
+    "
+
+    "Modified: 24.4.1997 / 15:51:24 / cg"
+!
+
+rowAt:rowIndex into:aPixelBuffer
+    "fill aBuffer with pixel values retrieved from a single row.
+     Notice: row indexing starts at 0."
+
+    ^ self rowAt:rowIndex into:aPixelBuffer startingAt:1
+
+    "Created: 24.4.1997 / 15:44:46 / cg"
+    "Modified: 24.4.1997 / 15:51:35 / cg"
+!
+
+rowAt:rowIndex into:aPixelBuffer startingAt:startIndex
+    "fill aBuffer with pixel values retrieved from a single row.
+     Notice: row indexing starts at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    |w "{ Class: SmallInteger }"|
+
+    w := width-1.
+    0 to:w do:[:col |
+        aPixelBuffer at:(col + startIndex) put:(self pixelAtX:col y:rowIndex)
+    ].
+
+    "Created: 24.4.1997 / 15:05:21 / cg"
+    "Modified: 24.4.1997 / 16:52:43 / cg"
+!
+
+rowAt:rowIndex putAll:pixelArray
+    "store a single rows pixels from bits in the argument;
+     Notice: row indexing starts at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    ^ self rowAt:rowIndex putAll:pixelArray startingAt:1
+
+    "Modified: 24.4.1997 / 15:51:58 / cg"
+!
+
+rowAt:rowIndex putAll:pixelArray startingAt:startIndex
+    "store a single rows pixels from bits in the pixelArray argument;
+     return the pixelArray.
+     Notice: row indexing starts at 0.
+     This is a slow fallBack method, which works with any depth;
+     concrete image subclasses should redefine this for more performance."
+
+    |w "{ Class: SmallInteger }"|
+
+    w := width-1.
+    0 to:w do:[:col |
+        self pixelAtX:col y:rowIndex put:(pixelArray at:(col + startIndex))
+    ].
+    ^ pixelArray
+
+    "Modified: 24.4.1997 / 17:05:57 / cg"
+!
+
+valueAt:aPoint
+    "WARNING: for now, this returns a pixels value 
+     (backward compatibility with ST/X)
+     In the future, this will return a color (ST-80 compatibility)
+     Use #pixelAt: - for future compatibility.
+
+     Retrieve the pixelValue at aPoint; return an integer number.
+     Pixels start at 0@0 for upper left pixel, end at
+     width-1@height-1 for lower right pixel.
+     The returned numbers interpretation depends on the photometric
+     and the colormap. (see also Image>>at: and Image>>atX:y:)
+     You should not use this method for image-processing, its
+     very slow ...
+     (it is meant to access individual pixels - for example, in a bitmap editor)"
+
+    'Image [warning]: the Image>>valueAt: will change semantics soon' infoPrintCR.
+    ^ self pixelAtX:aPoint x y:aPoint y
+
+    "Modified: 24.4.1997 / 17:28:16 / cg"
+!
+
+valueAtX:x y:y
+    "WARNING: for now, this returns a pixels value 
+     (backward compatibility with ST/X)
+     In the future, this will return a color (ST-80 compatibility)
+     Use #pixelAt: - for future compatibility.
+
+     Retrieve the pixelValue at aPoint; return an integer number.
+     Pixels start at 0/0 for upper left pixel, and end at
+     width-1@height-1 for lower right pixel.
+     The returned numbers interpretation depends on the photometric
+     and the colormap. (see also Image>>at: and Image>>atX:y:)
+     You should not use this method for image-processing of
+     big images, its very slow ... 
+     (it is meant to access individual pixels - for example, in a bitmap editor)"
+
+    'Image [warning]: the Image>>valueAtX:y: will change semantics soon' infoPrintCR.
+    ^ self pixelAtX:x y:y
+
+    "Modified: 24.4.1997 / 17:12:49 / cg"
 ! !
 
 !Image methodsFor:'accessing - private'!
@@ -3948,15 +4149,51 @@
      source pixels is very slow). If this method is used heavily, you
      may want to redefine it in concrete subclasses for common source images."
 
+    |map clr rowPixels mappedRowPixels|
+
     width := anImage width.
     height := anImage height.
-    bytes := ByteArray uninitializedNew:(self bytesPerRow * height).
     bitsPerSample := self bitsPerSample.
     samplesPerPixel := self samplesPerPixel.
     self colormapFromImage:anImage.
     self mask:anImage mask.
+
+    self depth = anImage depth ifTrue:[
+        bytes := anImage bits copy.
+        ^ self.
+    ].
+
+    bytes := ByteArray uninitializedNew:(self bytesPerRow * height).
+
+    self depth >= anImage depth ifTrue:[
+        anImage depth <= 12 ifTrue:[
+
+            "/ if my depth is greater, all colors can be represented,
+            "/ and the loop can be done over pixel values ...
+
+            colorMap isNil ifTrue:[
+                map := Array new:(1 bitShift:anImage depth).
+                1 to:map size do:[:i |
+                    clr := anImage colorFromValue:(i - 1).
+                    map at:i put:(self valueFromColor:clr).
+                ].
+                mappedRowPixels := self pixelArraySpecies new:width.
+            ].
+            0 to:height-1 do:[:row |
+                rowPixels := anImage rowAt:row into:mappedRowPixels startingAt:1.
+                map notNil ifTrue:[
+                    1 to:width do:[:i |
+                        mappedRowPixels at:i put:(map at:(rowPixels at:i)+1)
+                    ].
+                ].
+                self rowAt:row putAll:mappedRowPixels
+            ].
+            ^ self
+        ].
+    ].
+
     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
     ].
 
     "
@@ -3974,8 +4211,27 @@
      i24 inspect.
     "
 
-    "Created: 20.9.1995 / 00:59:03 / claus"
-    "Modified: 25.2.1997 / 17:47:02 / cg"
+    "
+     |i i24|
+
+     i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+     Transcript showCR:(
+        Time millisecondsToRun:[
+            i24 := Depth24Image fromImage:i.
+        ]
+     ).
+     i24 inspect.
+    "
+    "
+     |i i24|
+
+     i := Image fromFile:'bitmaps/gifImages/garfield.gif'.
+     MessageTally spyOn:[
+        i24 := Depth24Image fromImage:i.
+     ]
+    "
+
+    "Modified: 24.4.1997 / 15:40:25 / cg"
 !
 
 fromSubImage:anImage in:aRectangle
@@ -4004,19 +4260,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 pixelAtX:x-x0 y:y-y0 put: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 putColor:clr.
+        ]
     ].
 
     "
@@ -4034,7 +4290,7 @@
 
     "Created: 20.9.1995 / 01:06:02 / claus"
     "Modified: 20.9.1995 / 10:15:37 / claus"
-    "Modified: 10.6.1996 / 18:30:17 / cg"
+    "Modified: 24.4.1997 / 17:25:48 / cg"
 !
 
 monochromeOn:aDevice
@@ -4224,10 +4480,10 @@
      blueShift  "{ Class: SmallInteger }"
      greenShift "{ Class: SmallInteger }"
      form bestFormat usedDeviceDepth usedDeviceBitsPerPixel imageBits 
-     destIndex  "{ Class: SmallInteger }"
      greyValue  "{ Class: SmallInteger }"
-     endRow     "{ Class: SmallInteger }"
-     endCol     "{ Class: SmallInteger }"|
+     h          "{ Class: SmallInteger }"
+     w          "{ Class: SmallInteger }"
+     pixelArray newPixelArray i|
 
     "/ this is a slow fallback method; this ought to be
     "/ redefined in DepthxImage for more performance.
@@ -4235,8 +4491,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,84 +4510,66 @@
     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.
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
 
-    "/ 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.
-	    ]
-	]
-    ] 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.
-		]
-	    ]
-	]
-    ].
-
-    imageBits isNil ifTrue:[            
-	'Image [warning]: unimplemented trueColor depth on greyImageAsTrueColorFormOn:' errorPrintCR.
-	^ self asMonochromeFormOn:aDevice
-    ].
-
-    form :=
+    "/ the temporary helper image is only needed to allow
+    "/ the rowAt:putAll: calls below.
+
+    i := Image implementorForDepth:usedDeviceBitsPerPixel.
+    i width:width.
+    i height:height.
+    imageBits := ByteArray new:(i bytesPerRow * height).
+    i bits:imageBits.
+
+    "/ now, walk over the image and replace
+    "/ colorMap indices by color values in the bits array
+
+    h := height - 1.
+    w := width - 1.
+    pixelArray := self pixelArraySpecies new:width.
+    newPixelArray := i pixelArraySpecies new:width.
+
+    0 to:h do:[:y |
+        self rowAt:y into:pixelArray.
+        0 to:w do:[:x |
+            greyValue := pixelArray at:(x+1).
+            newPixelArray at:(x+1) put:(colorValues at:greyValue + 1).
+        ].
+        i rowAt:y putAll:newPixelArray.
+    ].
+
     form := Form width:width height:height depth:usedDeviceDepth on:aDevice.
     form isNil ifTrue:[^ nil].
     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
 
     "Created: 20.10.1995 / 22:05:10 / cg"
-    "Modified: 10.1.1997 / 17:53:05 / cg"
+    "Modified: 24.4.1997 / 16:52:32 / cg"
 ! !
 
 !Image methodsFor:'converting palette images'!
@@ -4414,7 +4652,7 @@
      colorValues 
      scaleRed scaleGreen scaleBlue redShift greenShift blueShift
      form imageBits bestFormat usedDeviceDepth usedDeviceBitsPerPixel 
-     destIndex n|
+     n i pixelArray newPixelArray|
 
     "/ this is a slow fallback method; this ought to be
     "/ redefined in DepthxImage for more performance.
@@ -4438,89 +4676,53 @@
     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.
     usedDeviceDepth := bestFormat at:#depth.
     usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
 
-    "/ for now, only support some depths
-
-    usedDeviceBitsPerPixel == 16 ifTrue:[
-	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).
-		]
-	    ]
-	]
-    ].
-    n isNil ifTrue:[            
-	'Image [warning]: unimplemented trueColor depth in paletteImageAsTrueColorFormOn: ' errorPrint. usedDeviceBitsPerPixel errorPrintCR.
-	^ self asMonochromeFormOn:aDevice
-    ].
-    imageBits := ByteArray uninitializedNew:n.
-
+    "/ the temporary helper image is only needed to allow
+    "/ the rowAt:putAll: calls below.
+
+    i := Image implementorForDepth:usedDeviceBitsPerPixel.
+    i width:width.
+    i height:height.
+    imageBits := ByteArray new:(i bytesPerRow * height).
+    i bits:imageBits.
+
+    "/ now, walk over the image and replace
+    "/ colorMap indices by color values in the bits array
+
+    h := height - 1.
     w := width - 1.
-    h := height - 1.
-    dstIdx := 1.
+    pixelArray := self pixelArraySpecies new:width.
+    newPixelArray := i pixelArraySpecies new:width.
+
     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.
-			]
-		    ]
-		]
-	    ]
-	]
+        self rowAt:y into:pixelArray.
+        0 to:w do:[:x |
+            pixel := pixelArray at:(x+1).
+            newPixelArray at:(x+1) put:(colorValues at:pixel + 1).
+        ].
+        i rowAt:y putAll:newPixelArray.
     ].
 
     form := Form width:width height:height depth:usedDeviceDepth on:aDevice.
@@ -4528,13 +4730,13 @@
     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
 
-    "Modified: 16.4.1997 / 16:01:13 / cg"
+    "Modified: 24.4.1997 / 16:51:57 / cg"
 ! !
 
 !Image methodsFor:'converting rgb images'!
@@ -7189,14 +7391,15 @@
     yI := y.
     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 pixelAtX:xRun y:yRun put:aPixelValue
+        ]
     ]
 
     "Created: 22.4.1997 / 14:02:14 / cg"
-    "Modified: 22.4.1997 / 14:03:51 / cg"
+    "Modified: 24.4.1997 / 17:24:58 / cg"
 ! !
 
 !Image methodsFor:'enumerating'!
@@ -7273,7 +7476,12 @@
 !
 
 valuesAtY:y from:x1 to:x2 do:aBlock
-    "perform aBlock for each pixelValue from x1 to x2 in row y.
+    "WARNING: for now, this enumerates pixel values 
+     (backward compatibility with ST/X)
+     In the future, this will enumerate colors 
+     Use #pixelAtT:from:to:do: - for future compatibility.
+
+     perform aBlock for each pixelValue from x1 to x2 in row y.
      Notice, that x and y coordinates start at 0@0 for the upper left corner.
      The block is passed the x coordinate and the pixelValue at each pixel.
      (see also Image>>atY:from:to:do:).
@@ -7287,11 +7495,11 @@
     xStart := x1.
     xEnd := x2.
     xStart to:xEnd do:[:xRun |
-	aBlock value:xRun value:(self valueAtX:xRun y:y)
+        aBlock value:xRun value:(self pixelAtX:xRun y:y)
     ]
 
-    "Modified: 17.5.1996 / 12:03:59 / cg"
     "Created: 7.6.1996 / 19:09:51 / cg"
+    "Modified: 24.4.1997 / 16:55:38 / cg"
 !
 
 valuesFromX:xStart y:yStart toX:xEnd y:yEnd do:aBlock
@@ -7324,23 +7532,29 @@
      To be redefined by subclasses for better performance."
 
     |w  "{Class: SmallInteger }"
-     h  "{Class: SmallInteger }"|
-
-    w := width - 1.
+     h  "{Class: SmallInteger }"
+     newPixel newPixelRow pixelRow|
+
+    w := width.
     h := height - 1.
 
+    newPixelRow := Array new:width.
+    pixelRow := self pixelArraySpecies new:width.
+
     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)
-	]
-    ].
-
-    "Created: 10.4.1997 / 16:26:17 / cg"
-    "Modified: 10.4.1997 / 16:30:28 / cg"
+        self rowAt:y into:pixelRow.
+        1 to:w do:[:col |
+            newPixel := pixelFunctionBlock
+                            value:self
+                            value:(pixelRow at:col)
+                            value:(col-1)
+                            value:y.
+            newPixelRow at:col put:newPixel.
+        ].
+        newImage rowAt:y putAll:newPixelRow
+    ].
+
+    "Modified: 24.4.1997 / 16:18:31 / cg"
 !
 
 colorMapProcessing:aBlock
@@ -7456,16 +7670,19 @@
 
     |w  "{Class: SmallInteger }"
      h  "{Class: SmallInteger }"
-     c2 r2|
+     c2 r2 pixelArray|
 
     w := width - 1.
     h := height - 1.
 
+    pixelArray := self pixelArraySpecies new:width.
+
     degrees = 90 ifTrue:[
         0 to:h do:[:row |
+            self rowAt:row into:pixelArray startingAt:1.
             c2 := h-row.
-            self valuesAtY:row from:0 to:w do:[:col :pixel |
-                destinationImage atX:c2 y:col putValue:pixel.
+            0 to:w do:[:col |
+                destinationImage pixelAtX:c2 y:col put:(pixelArray at:(col+1)).
             ]
         ].
         ^ self.
@@ -7473,9 +7690,10 @@
 
     degrees = 180 ifTrue:[
         0 to:h do:[:row |
+            self rowAt:row into:pixelArray startingAt:1.
             r2 := h - row.
-            self valuesAtY:row from:0 to:w do:[:col :pixel |
-                destinationImage atX:(w-col) y:r2 putValue:pixel.
+            0 to:w do:[:col |
+                destinationImage pixelAtX:(w-col) y:r2 put:(pixelArray at:(col+1)).
             ]
         ].
         ^ self
@@ -7483,42 +7701,40 @@
 
     "/ degrees = 270
     0 to:h do:[:row |
-        self valuesAtY:row from:0 to:w do:[:col :pixel |
-            destinationImage atX:row y:(w-col) putValue:pixel.
+        self rowAt:row into:pixelArray startingAt:1.
+        0 to:w do:[:col |
+            destinationImage pixelAtX:row y:(w-col) put:(pixelArray at:(col+1)).
         ]
     ]
 
     "Created: 23.4.1997 / 14:36:45 / cg"
-    "Modified: 23.4.1997 / 14:46:48 / cg"
+    "Modified: 24.4.1997 / 17:26:26 / cg"
 !
 
 flipHorizontal
-    "inplace horizontal flip"
-
-    |w  "{Class: SmallInteger }"
-     h  "{Class: SmallInteger }"
-     c2 "{Class: SmallInteger }" 
-     value |
-
-    w := width - 1.
+    "destructively inplace horizontal flip"
+
+    |h  "{Class: SmallInteger }"
+     pixelArray|
+
     h := height - 1.
 
+    pixelArray := self pixelArraySpecies new:width.
+
     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.
-	]
-    ].
+        self rowAt:row into:pixelArray.
+        pixelArray reverse.
+        self rowAt:row putAll:pixelArray.
+    ].
+
     mask notNil ifTrue:[
-	mask flipHorizontal
-    ].
-    "flush device info"
+        mask flipHorizontal
+    ].
+
+    "/ flush device info
     self restored
 
-    "Modified: 27.2.1997 / 13:08:21 / cg"
+    "Modified: 24.4.1997 / 16:27:28 / cg"
 !
 
 flipVertical
@@ -7567,7 +7783,7 @@
      h         "{ Class: SmallInteger }"
      newImage newBits bitsPerPixel newBytesPerRow newMask
      value 
-     srcRow|
+     srcRow pixelArray|
 
     mX := scalePoint x.
     mY := scalePoint y.
@@ -7582,38 +7798,46 @@
     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"
 
     w := newWidth - 1.
     h := newHeight - 1.
+    pixelArray := newImage pixelArraySpecies new:newWidth.
 
     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 pixelAtX:(col // mX) y:srcRow.
+            pixelArray at:(col+1) put:value.
+        ].
+        newImage rowAt:row putAll:pixelArray.
     ].
 
     ^ newImage
 
-    "((Image fromFile:'bitmaps/claus.gif') magnifiedBy:0.5@0.5)"
-
-    "Modified: 27.6.1996 / 17:46:05 / cg"
+    "
+     |i|
+     i := Image fromFile:'bitmaps/gifImages/claus.gif'.
+     Time millisecondsToRun:[
+         i hardMagnifiedBy:0.5@0.5
+     ]  
+    "
+
+    "Modified: 24.4.1997 / 16:56:49 / cg"
 !
 
 hardRotated:degrees
@@ -8314,7 +8538,7 @@
                                         didFetchInRow = 1;
 #endif
                                         __pix = (*valAt.ilc_func)(self,
-                                                              @symbol(valueAtX:y:),
+                                                              @symbol(pixelAtX:y:),
                                                               nil, &valAt,
                                                               __MKSMALLINT(__srcX),
                                                               __MKSMALLINT(__srcY));
@@ -8329,7 +8553,7 @@
 
                             if (__pix != __MKSMALLINT(0)) {
                                 (*atPutVal.ilc_func)(newImage,
-                                                      @symbol(atX:y:putValue:),
+                                                      @symbol(pixeAtX:y:put:),
                                                       nil, &atPutVal,
                                                       __MKSMALLINT(__dstX),
                                                       __MKSMALLINT(__dstY),
@@ -8377,7 +8601,7 @@
 "/
 "/                    "/ inside ?
 "/                    (srcY >= 0 and:[srcY < height]) ifTrue:[
-"/                        pix := self valueAtX:srcX y:srcY
+"/                        pix := self pixelAtX:srcX y:srcY
 "/                    ] ifFalse:[
 "/                        pix := blackPixel.        
 "/                    ].
@@ -8385,7 +8609,7 @@
 "/                    pix := blackPixel.        
 "/                ].
 "/                pix ~~ blackPixel ifTrue:[
-"/                    newImage atX:dstX y:dstY putValue:pix.        
+"/                    newImage pixelAtX:dstX y:dstY put:pix.        
 "/                ]
 "/            ].
 "/        ].
@@ -8978,19 +9202,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 pixelAtX:x-dX y:y-dY put:pixelValue.
+        ]
     ] ifFalse:[
-	"/ must loop over colors - horribly slow
-	anImage colorsFromX:srcX  y:srcY 
-			toX:srcX+w-1 y:srcY+h-1  
-			 do:[:x :y :clr |
-	    self 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.
+        ]
     ]
 
     "
@@ -9008,7 +9232,7 @@
 
     "Created: 20.9.1995 / 10:14:01 / claus"
     "Modified: 20.9.1995 / 10:25:31 / claus"
-    "Modified: 18.1.1997 / 17:22:45 / cg"
+    "Modified: 24.4.1997 / 17:27:14 / cg"
 !
 
 subImageIn:aRectangle
@@ -9627,12 +9851,13 @@
 pixelArraySpecies
     "return the kind of pixel-value container in rowAt:/rowAt:put: methods"
 
-    depth > 8 ifTrue:[
-	^ Array
+    self depth > 8 ifTrue:[
+        ^ Array
     ].
     ^ ByteArray
 
     "Created: 6.3.1997 / 15:24:05 / cg"
+    "Modified: 24.4.1997 / 15:34:34 / cg"
 !
 
 realColorMap
@@ -10376,6 +10601,6 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.185 1997-04-24 11:32:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.186 1997-04-24 16:05:36 cg Exp $'
 ! !
 Image initialize!