eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Depth4Image':

Home

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

Class: Depth4Image


Inheritance:

   Object
   |
   +--Image
      |
      +--Depth4Image

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

Description:


this class represents 16-color (4 bit / pixel) images.
Most images coming from the windows world are represented as Depth4Images.
It mainly consists of methods already implemented in Image,
reimplemented here for more performance.
Pixels for even x coordinates are stored in the left (high) nibble.
Odd x pixels are in the right (low) nibble.



Related information:

    Depth1Image
    Depth2Image
    Depth8Image
    Depth16Image
    Depth24Image
    ImageReader

Class protocol:

queries
o  defaultPhotometric
return the default photometric pixel interpretation

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


Instance protocol:

accessing-pixels
o  pixelAtX: x y: y
retrieve a pixel at x/y; return a pixelValue (0..15).
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..15).
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

o  rowAt: y into: aPixelBuffer
fill aBuffer with pixel values retrieved from a single row.
Notice: row coordinate starts with 0.

converting images
o  anyImageAsTrueColorFormOn: aDevice
return a true-color device-form for 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  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 4-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 4-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 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.
Specially tuned for factor 2.

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  usedValues
return a collection of color values used in the receiver.
usage example(s):
usedValues := OrderedCollection new.
usage example(s):
1 to:16 do:[:i | (useFlags at:i) ifTrue:[usedValues add:(i-1)]].
usage example(s):
^ usedValues



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Thu, 15 Nov 2018 12:24:46 GMT