|
|
Class: Depth24Image
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
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.
Depth1Image
Depth2Image
Depth4Image
Depth8Image
Depth16Image
ImageReader
queries
-
defaultPhotometric
-
return the default photometric pixel interpretation
-
imageDepth
-
return the depth of images represented by instances of
this class - here we return 24
accessing-pixels
-
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
-
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.
-
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
-
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
-
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.
-
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
-
asGrayFormOn: aDevice
-
return a grey form from the receiver.
Redefined to use special code when converting to 8-bit
greyScale displays.
-
asThresholdGrayImageDepth: depth
-
return an 8-bit grey image from the rgb picture.
Pixel values are reduced to a 0..255 grey level.
-
rgbImageAsDitheredPseudoFormOn: aDevice
-
return a dithered pseudocolor form from the rgb-picture.
This method depends on fixColors being allocated (see Color>>getColors*)
-
rgbImageAsDitheredPseudoFormOn: aDevice colors: fixColors
-
return a dithered 8-bit pseudocolor form from the rgb-picture, using
arbitrary fix colors in fixColors.
-
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.
-
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.
-
rgbImageAsTrueColorFormOn: aDevice
-
return a truecolor form from the rgb-picture.
-
rgbImageBitsOn: aDevice bestFormat: bestFormat
-
return rgb bits from the rgb-picture.
-
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
-
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).
-
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
-
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
-
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.
-
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.
-
threshold8BitGrayBits
-
return the bits for an 8-bit grey image from the receiver.
Special code, since this is a common case.
enumerating
-
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.
-
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.
-
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
-
negative
-
initialization
-
initialize
-
magnification
-
hardAntiAliasedMagnifiedBy: scalePoint
-
return a new image magnified by scalePoint, aPoint.
This interpolates pixels and is therefore slower.
-
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
queries
-
bitsPerPixel
-
return the number of bits per pixel
-
bitsPerRow
-
return the number of bits in one scanline of the image
-
bitsPerSample
-
return the number of bits per sample.
The return value is an array of bits-per-plane.
-
blueBitsOf: pixel
-
given a pixel-value, return the blue component as byteValue (0..255)
-
blueComponentOf: pixel
-
given a pixel-value, return the blue component in percent (0..100)
-
blueMaskForPixelValue
-
return the mask used with translation from pixelValues to blueBits
-
blueShiftForPixelValue
-
return the shift amount used with translation from pixelValues to blueBits
-
bytesPerRow
-
return the number of bytes in one scanline of the image
-
greenBitsOf: pixel
-
given a pixel-value, return the green component as byteValue (0..255)
-
greenComponentOf: pixel
-
given a pixel-value, return the green component in percent (0..100)
-
greenMaskForPixelValue
-
return the mask used with translation from pixelValues to redBits
-
greenShiftForPixelValue
-
return the shift amount used with translation from pixelValues to greenBits
-
redBitsOf: pixel
-
given a pixel-value, return the red component as byteValue (0..255)
-
redComponentOf: pixel
-
given a pixel-value, return the red component in percent (0..100)
-
redMaskForPixelValue
-
return the mask used with translation from pixelValues to redBits
-
redShiftForPixelValue
-
return the shift amount used with translation from pixelValues to redBits
-
rgbFromValue: pixelValue
-
given a pixel value, return the corresponding 24bit rgbValue (rrggbb, red is MSB).
-
samplesPerPixel
-
return the number of samples per pixel in the image.
-
valueFromRedBits: redBits greenBits: greenBits blueBits: blueBits
-
|