eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Depth24Image':

Home

everywhere
www.exept.de
for:
[back]

Class: Depth24Image


Inheritance:

   Object
   |
   +--Image
      |
      +--Depth24Image

Package:
stx:libview
Category:
Graphics-Images
Version:
rev: 1.92 date: 2009/11/05 14:37:51
user: stefan
file: Depth24Image.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

Description:


this class represents true-color (24 bit / pixel) images.
It mainly consists of methods already implemented in Image,
reimplemented here for more performance.

Only the #rgb format is supported here.


Related information:

    Depth1Image
    Depth2Image
    Depth4Image
    Depth8Image
    Depth16Image
    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 24


Instance protocol:

accessing-pixels
o  colorAtX: x y: y
retrieve a pixel at x/y; return a color.
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel

o  colorAtX: x y: y put: aColor
set the pixel at x/y to aColor.
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
retrieve a pixel at x/y; return a color.
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 a pixel at x/y to aPixelValue, which is 24 bits RGB.
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel

o  rgbValueAtX: x y: y
retrieve a pixels rgb value at x/y; return a 24bit rgbValue (rrggbb, red is MSB).
Pixels start at 0@0 for upper left pixel, end at (width-1)@(height-1) for lower right pixel.

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 rgb images
o  asGrayFormOn: aDevice
return a grey form from the receiver.
Redefined to use special code when converting to 8-bit
greyScale displays.

o  asThresholdGrayImageDepth: depth
return an 8-bit grey image from the rgb picture.
Pixel values are reduced to a 0..255 grey level.

o  rgbImageAsDitheredPseudoFormOn: aDevice
return a dithered pseudocolor form from the rgb-picture.
This method depends on fixColors being allocated (see Color>>getColors*)

o  rgbImageAsDitheredPseudoFormOn: aDevice colors: fixColors
return a dithered 8-bit pseudocolor form from the rgb-picture, using
arbitrary fix colors in fixColors.

o  rgbImageAsDitheredPseudoFormOn: aDevice colors: fixColors nRed: nRed nGreen: nGreen nBlue: nBlue
return a dithered pseudocolor form from the rgb-picture,
using colors from a colorCube for dithering.

o  rgbImageAsPseudoFormOn: aDevice
return a pseudocolor form from the rgb-picture.
If a colorCube is used, pass the work on to the cube-dither
code. Otherwise, allocate as many colors as possible, then
use those for dithering.
Could be improved, by searching for (& allocating)
heavily used colors and/or min-max colors first.

o  rgbImageAsTrueColorFormOn: aDevice
return a truecolor form from the rgb-picture.

o  rgbImageBitsOn: aDevice bestFormat: bestFormat
return rgb bits from the rgb-picture.

o  rgbImageBitsOn: aDevice bestFormat: bestFormat returnUsedDevicePattingIn: aValueHolder
return rgb bits from the rgb-picture.
Sorry (sigh) - this might decide to use a different padding;
this information is returned in aValueHolder

dither helpers
o  floydSteinbergDitheredDepth8BitsColors: colors map: aMapOrNil
return a floyd-steinberg dithered bitmap from the receiver picture,
which must be a depth-24 image.
This method expects an array of colors to be used for dithering
(which need not be a colorCubes colors).

o  floydSteinbergDitheredGrayBitsDepth: depth
return the bits for dithering a depth gray bitmap from the image.
Redefined to make use of knowing that pixels are 24 bit r/g/b

o  floydSteinbergDitheredMonochromeBits
return the bitmap for a dithered monochrome bitmap from the image.
Redefined to make use of knowing that pixels are 24 bit r/g/b

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 24-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 24-bit values.

o  threshold8BitGrayBits
return the bits for an 8-bit grey image from the receiver.
Special code, since this is a common case.

enumerating
o  colorsAtX: x from: yLow to: yHigh do: aBlock
perform aBlock for each pixel from y1 to y2 in col x.
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  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
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.
Notice that the pixelValue is the r/g/b value packed into an integer
(r bitShift:16) bitOr:(g bitSHift:8) bitOr:b

image manipulations
o  negative

initialization
o  initialize

magnification
o  hardAntiAliasedMagnifiedBy: scalePoint
return a new image magnified by scalePoint, aPoint.
This interpolates pixels and is therefore slower.

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

queries
o  bitsPerPixel
return the number of bits per pixel

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

o  bitsPerSample
return the number of bits per sample.
The return value is an array of bits-per-plane.

o  blueBitsOf: pixel
given a pixel-value, return the blue component as byteValue (0..255)

o  blueComponentOf: pixel
given a pixel-value, return the blue component in percent (0..100)

o  blueMaskForPixelValue
return the mask used with translation from pixelValues to blueBits

o  blueShiftForPixelValue
return the shift amount used with translation from pixelValues to blueBits

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

o  greenBitsOf: pixel
given a pixel-value, return the green component as byteValue (0..255)

o  greenComponentOf: pixel
given a pixel-value, return the green component in percent (0..100)

o  greenMaskForPixelValue
return the mask used with translation from pixelValues to redBits

o  greenShiftForPixelValue
return the shift amount used with translation from pixelValues to greenBits

o  redBitsOf: pixel
given a pixel-value, return the red component as byteValue (0..255)

o  redComponentOf: pixel
given a pixel-value, return the red component in percent (0..100)

o  redMaskForPixelValue
return the mask used with translation from pixelValues to redBits

o  redShiftForPixelValue
return the shift amount used with translation from pixelValues to redBits

o  rgbFromValue: pixelValue
given a pixel value, return the corresponding 24bit rgbValue (rrggbb, red is MSB).

o  samplesPerPixel
return the number of samples per pixel in the image.

o  valueFromRedBits: redBits greenBits: greenBits blueBits: blueBits



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