eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Depth1Image':

Home

everywhere
www.exept.de
for:
[back]

Class: Depth1Image


Inheritance:

   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

Description:


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.


Related information:

    Depth2Image
    Depth4Image
    Depth8Image
    Depth16Image
    Depth24Image
    ImageReader

Class protocol:

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


Instance protocol:

accessing-pixels
o  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

o  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
o  asFormOn: aDevice
convert a monochrome image to a device form

o  greyImageAsFormOn: aDevice
convert a greyscale image to a device form

o  greyImageAsMonoFormOn: aDevice
convert to a monochrome form - thats easy

o  paletteImageAsMonoFormOn: aDevice
convert a palette image to a b&w monochrome device form

o  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
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 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
o  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.

o  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
o  anyImageAsFormOn: aDevice
convert a monochrome image to a device form

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  rgbFromValue: pixelValue
given a pixel value, return the corresponding 24bit rgbValue (rrggbb, red is MSB).
Pixel values start with 0.

o  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

o  usedValues
return a collection of color values used in the receiver.

o  valueFromColor: aColor
given a color, return the corresponding pixel value.
Non-representable colors return nil.



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