eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Depth2Image':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Depth2Image


Inheritance:

   Object
   |
   +--Image
      |
      +--Depth2Image

Package:
stx:libview
Category:
Graphics-Images
Version:
rev: 1.61 date: 2018/03/27 13:41:04
user: cg
file: Depth2Image.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

Description:


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.


Related information:

    Depth1Image
    Depth4Image
    Depth8Image
    Depth16Image
    Depth24Image
    ImageReader

Class protocol:

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


Instance protocol:

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

o  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
o  anyImageAsTrueColorFormOn: aDevice
return a true-color device-form for the receiver.
Supports true color devices with depths: 8, 16, 24 and 32

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  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  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
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  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
o  magnifyRowFrom: srcBytes offset: srcStart into: dstBytes offset: dstStart factor: mX
magnify a single pixel row - can only magnify by integer factors

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: colorValue
given a pixel value, return the corresponding color.
Pixel values start with 0.

o  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

o  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



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Wed, 24 Apr 2024 13:25:42 GMT