|
|
Class: Depth8Image
Object
|
+--Image
|
+--Depth8Image
- Package:
- stx:libview
- Category:
- Graphics-Images
- Version:
- rev:
1.116
date: 2009/11/05 14:36:21
- user: stefan
- file: Depth8Image.st directory: libview
- module: stx stc-classLibrary: libview
- Author:
- Claus Gittinger
this class represents 256-color (8 bit / pixel) images (palette, greyscale ...).
It mainly consists of methods already implemented in Image,
reimplemented here for more performance.
Depth1Image
Depth2Image
Depth4Image
Depth16Image
Depth24Image
ImageReader
queries
-
defaultPhotometric
-
-
imageDepth
-
return the depth of images represented by instances of
this class - here we return 8
accessing-pixels
-
pixelAtX: x y: y
-
retrieve a pixel at x/y; return a pixelValue.
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.
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel
-
rowAt: y into: aPixelBuffer startingAt: startIndex
-
fill aPixelBuffer with pixel values from a single row.
Notice: row coordinate starts at 0.
-
rowAt: y putAll: pixelArray startingAt: startIndex
-
store a single rows bits from bits in the pixelArray argument;
Return the pixelArray.
Notice: row coordinate starts at 0.
converting
-
fromImage: anImage
-
setup the receiver from another image.
The code here is tuned for depth 1, 2 and 4 source images;
other conversions are done in the superclasses fallBack method.
converting images
-
anyImageAsPseudoFormOn: aDevice
-
return a pseudoForm from the palette picture.
The main work is in color reduction, when not all colors can be aquired.
This method works for any photometric.
-
anyImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
asGray8FormOn: aDevice
-
return an 8-bit greyForm from the 8-bit receiver image.
Redefined, since only a translation has to be done here.
-
asGrayFormOn: aDevice
-
get a gray device form.
Redefined, since we can do it with simple translate,
if the depth matches my depth.
-
greyImageAsPseudoFormOn: aDevice
-
return a pseudoForm from the gray picture. The main work is
in color reduction, when not all colors can be aquired.
-
greyImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the grey-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
paletteImageAsPseudoFormOn: aDevice
-
return a pseudoForm from the palette picture. The main work is
in color reduction, when not all colors can be aquired.
-
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
-
floydSteinbergDitheredDepth8BitsColors: colors map: aMapOrNil
-
return a floyd-steinberg dithered bitmap from the receiver picture,
which must be a depth-8 image.
This method expects an array of colors to be used for dithering
(which need not be a colorCubes colors).
-
orderedDitheredGrayBitsWithDitherMatrix: ditherMatrix ditherWidth: dW depth: depth
-
return the bitmap for a dithered depth-bitmap from the image;
with a constant ditherMatrix, this can be used for thresholding.
Redefined to make use of knowing that pixels are 8-bit values.
-
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 8-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.
-
colorsFromX: xStart y: yStart toX: xEnd y: yEnd do: aBlock
-
perform aBlock for each pixel in the rectangle
yStart..yEnd / xStart..xEnd.
The block is passed the color at each pixel.
This method allows slighly faster processing of an
image than using individual atX:y: accesses,
both since some processing can be avoided when going from pixel to pixel,
and since the color composition is done outside of the pixel loop.
However, for real high performance image processing, specialized methods
should be written which know how to deal with specific photometric interpretations.
-
valuesAtY: y from: xLow to: xHigh do: aBlock
-
perform aBlock for each pixelValue from x1 to x2 in row y.
The block is passed 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.
-
valuesFromX: xStart y: yStart toX: xEnd y: yEnd do: aBlock
-
perform aBlock for each pixel in the rectangle
yStart..yEnd / xStart..xEnd.
The block is passed the pixelValue at each pixel.
This method allows slighly faster processing of an
image than using individual valueAtX:y: accesses,
since some processing can be avoided when going from pixel to pixel..
However, for real high performance image processing, specialized methods
should be written which know how to deal with specific photometric interpretations.
image manipulations
-
hardMagnifiedBy: scalePoint
-
return a new image magnified by scalePoint, aPoint.
This is the general magnification method, handling non-integral values
-
magnifyRowFrom: srcBytes offset: srcStart into: dstBytes offset: dstStart factor: mX
-
magnify a single pixel row - can only magnify by integer factors.
Specially tuned for factors 2,3 and 4.
private
-
dither1PlaneUsingMap: map on: aDevice
-
a helper for dithering palette and greyscale images
-
dither2PlaneUsingMap: map on: aDevice
-
a helper for dithering palette and greyscale images
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: pixelValue
-
given a pixel value, return the corresponding color.
Pixel values start with 0.
-
realUsedValues
-
return a collection of color values used in the receiver.
-
usedValues
-
return a collection of color values used in the receiver.
|