eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Depth8Image':

Home

everywhere
www.exept.de
for:
[back]

Class: Depth8Image


Inheritance:

   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

Description:


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.


Related information:

    Depth1Image
    Depth2Image
    Depth4Image
    Depth16Image
    Depth24Image
    ImageReader

Class protocol:

queries
o  defaultPhotometric

o  imageDepth
return the depth of images represented by instances of
this class - here we return 8


Instance protocol:

accessing-pixels
o  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

o  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

o  rowAt: y into: aPixelBuffer startingAt: startIndex
fill aPixelBuffer with pixel values from a single row.
Notice: row coordinate starts at 0.

o  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
o  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
o  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.

o  anyImageAsTrueColorFormOn: aDevice
return a true-color device-form for the receiver.
Supports true color devices with depths: 8, 16, 24 and 32

o  asGray8FormOn: aDevice
return an 8-bit greyForm from the 8-bit receiver image.
Redefined, since only a translation has to be done here.

o  asGrayFormOn: aDevice
get a gray device form.
Redefined, since we can do it with simple translate,
if the depth matches my depth.

o  greyImageAsPseudoFormOn: aDevice
return a pseudoForm from the gray picture. The main work is
in color reduction, when not all colors can be aquired.

o  greyImageAsTrueColorFormOn: aDevice
return a true-color device-form for the grey-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32

o  paletteImageAsPseudoFormOn: aDevice
return a pseudoForm from the palette picture. The main work is
in color reduction, when not all colors can be aquired.

o  paletteImageAsTrueColorFormOn: aDevice
return a true-color device-form for the palette-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32

o  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
o  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).

o  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.

o  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
o  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.

o  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.

o  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.

o  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
o  hardMagnifiedBy: scalePoint
return a new image magnified by scalePoint, aPoint.
This is the general magnification method, handling non-integral values

o  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
o  dither1PlaneUsingMap: map on: aDevice
a helper for dithering palette and greyscale images

o  dither2PlaneUsingMap: map on: aDevice
a helper for dithering palette and greyscale images

queries
o  bitsPerPixel
return the number of bits per pixel

o  bitsPerRow
return the number of bits in one scanline of the image

o  bytesPerRow
return the number of bytes in one scanline of the image

o  colorFromValue: pixelValue
given a pixel value, return the corresponding color.
Pixel values start with 0.

o  realUsedValues
return a collection of color values used in the receiver.

o  usedValues
return a collection of color values used in the receiver.



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 08:54:00 GMT