|
|
Class: Depth1Image
Object
|
+--Image
|
+--Depth1Image
|
+--ImageMask
- Package:
- stx:libview
- Category:
- Graphics-Images
- Version:
- rev:
1.57
date: 2009/11/05 14:37:53
- user: stefan
- file: Depth1Image.st directory: libview
- module: stx stc-classLibrary: libview
- Author:
- Claus Gittinger
this class represents bilevel (1 bit / pixel) images.
It mainly consists of methods which are already implemented in Image,
but reimplemented here for more performance. If you plan to do heavy
image processing on bilevel images, you may want to add more
specialized methods here.
#blackIs0 / #whiteIs0 and #palette formats are supported here.
Depth2Image
Depth4Image
Depth8Image
Depth16Image
Depth24Image
ImageReader
queries
-
imageDepth
-
return the depth of images represented by instances of
this class - here we return 1
accessing-pixels
-
pixelAtX: x y: y
-
retrieve a pixelValue at x/y; return a number.
The interpretation of the returned value depends on the photometric
and the colormap. See also Image>>atX:y:)
Pixels start at 0@0 for upper left pixel, end at
(width-1)@(height-1) for lower right pixel
-
pixelAtX: x y: y put: aPixelValue
-
set a pixels value at x/y to aPixelValue.
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel
converting
-
asFormOn: aDevice
-
convert a monochrome image to a device form
-
greyImageAsFormOn: aDevice
-
convert a greyscale image to a device form
-
greyImageAsMonoFormOn: aDevice
-
convert to a monochrome form - thats easy
-
paletteImageAsMonoFormOn: aDevice
-
convert a palette image to a b&w monochrome device form
-
paletteImageAsTrueColorFormOn: aDevice
-
since all devices must support monochrome images, and
a 2-entry colormap is implemented by ST/X's drawForm methods,
we can do this on all color devices as a palette image.
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
-
perform aBlock for each pixelValue 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.
magnification
-
hardMagnifiedBy: scalePoint
-
return a new image magnified by scalePoint, aPoint.
This is the general magnification method, handling non-integral values.
It is slower than the integral magnification method.
-
magnifyRowFrom: srcBytes offset: srcStart into: dstBytes offset: dstStart factor: mX
-
magnify a single pixel row - can only magnify by integer factors.
This method has been specially tuned for magnification by 2 and 4.
private
-
anyImageAsFormOn: aDevice
-
convert a monochrome image to a device form
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.
-
rgbFromValue: pixelValue
-
given a pixel value, return the corresponding 24bit rgbValue (rrggbb, red is MSB).
Pixel values start with 0.
-
usedColors
-
return a collection of colors used in the receiver.
For depth1 images, we return the colorMap here, assuming all
pixels are used ...
... which is not really true - it could be all-white or all-black
-
usedValues
-
return a collection of color values used in the receiver.
-
valueFromColor: aColor
-
given a color, return the corresponding pixel value.
Non-representable colors return nil.
|