|
Class: Depth2Image
Object
|
+--Image
|
+--Depth2Image
- Package:
- stx:libview
- Category:
- Graphics-Images
- Version:
- rev:
1.64
date: 2023/05/03 12:17:32
- user: cg
- file: Depth2Image.st directory: libview
- module: stx stc-classLibrary: libview
this class represents four-color (2 bit / pixel) images
(as used mainly on the NeXT).
It mainly consists of methods already implemented in Image,
reimplemented here for more performance.
#blackIs0 / #whiteIs0 and #palette formats are supported here.
copyrightCOPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
queries
-
imageDepth
-
return the depth of images represented by instances of
this class - here we return 2
accessing-pixels
-
pixelAtX: x y: y
-
retrieve a pixel at x/y; return a pixel value (0..3).
The interpretation of the returned value depends on the photometric
and the colormap. See also Image>>atX:y:)
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel
-
pixelAtX: x y: y put: aPixelValue
-
set the pixel at x/y to aPixelValue (0..3).
The interpretation of the pixelValue depends on the photometric
and the colormap. (see also: Image>>atX:y:put:)
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel
converting images
-
anyImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
grayImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the grey-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
paletteImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the palette-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
rgbImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the rgb-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32
dither helpers
-
orderedDitheredMonochromeBitsWithDitherMatrix: ditherMatrix ditherWidth: dW
-
return the dithered monochrome bits for the receiver image;
with a constant ditherMatrix, this can be used for thresholding.
Redefined to make use of knowing that pixels are 2-bit values.
enumerating
-
colorsAtY: y from: xLow to: xHigh do: aBlock
-
perform aBlock for each pixel from x1 to x2 in row y.
The block is passed the color at each pixel.
This method allows slighly faster processing of an
image than using atX:y:, since some processing can be
avoided when going from pixel to pixel. However, for
real image processing, specialized methods should be written.
-
valuesAtY: y from: xLow to: xHigh do: aBlock
-
WARNING: this enumerates pixel values which need photometric interpretation
Do not confuse with #rgbValuesAtY:from:to:do:
Perform aBlock for each pixelValue from x1 to x2 in row y.
Notice the difference between rgbValue and pixelValue: rgbValues are always
the rgb bytes; pixelvalues depend on the photometric interpretation, and may be
indices into a colormap or be non-byte-sized rgb values.
The block is passed the x coordinate and the pixelValue at each pixel.
This method allows slighly faster processing of an
image than using valueAtX:y:, since some processing can be
avoided when going from pixel to pixel. However, for
real image processing, specialized methods should be written.
magnification
-
magnifyRowFrom: srcBytes offset: srcStart into: dstBytes offset: dstStart factor: mX
-
magnify a single pixel row - can only magnify by integer factors
queries
-
bitsPerPixel
-
return the number of bits per pixel
-
bitsPerRow
-
return the number of bits in one scanline of the image
-
bytesPerRow
-
return the number of bytes in one scanline of the image
-
colorFromValue: colorValue
-
given a pixel value, return the corresponding color.
Pixel values start with 0.
-
usedColors
-
return a collection of colors used in the receiver.
For depth2 images, we return the colorMap here, assuming all
pixels are used ...
... which is not really true - not all colors need to be
-
usedValues
-
return a collection of color values used in the receiver.
For depth2 images, we assume all pixel values are present ...
... which is not really true
|