|
Class: Depth4Image
Object
|
+--Image
|
+--Depth4Image
- Package:
- stx:libview
- Category:
- Graphics-Images
- Version:
- rev:
1.68
date: 2021/09/20 23:17:29
- user: cg
- file: Depth4Image.st directory: libview
- module: stx stc-classLibrary: libview
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.
copyrightCOPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
queries
-
defaultPhotometric
-
return the default photometric pixel interpretation
-
imageDepth
-
return the depth of images represented by instances of
this class - here we return 4
accessing-pixels
-
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
-
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
-
rowAt: y into: aPixelBuffer
-
fill aBuffer with pixel values retrieved from a single row.
Notice: row coordinate starts with 0.
converting images
-
anyImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
grayImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the grey-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
paletteImageAsTrueColorFormOn: aDevice
-
return a true-color device-form for the palette-image receiver.
Supports true color devices with depths: 8, 16, 24 and 32
-
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
-
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.
-
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
-
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
-
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
-
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
-
bitsPerPixel
-
return the number of bits per pixel
-
bitsPerRow
-
return the number of bits in one scanline of the image
-
bytesPerRow
-
return the number of bytes in one scanline of the image
-
colorFromValue: pixelValue
-
given a pixel value, return the corresponding color.
Pixel values start with 0.
-
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):
|