eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Depth32Image':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Depth32Image


Inheritance:

   Object
   |
   +--Image
      |
      +--Depth32Image

Package:
stx:libview
Category:
Graphics-Images
Version:
rev: 1.43 date: 2018/04/23 19:54:22
user: cg
file: Depth32Image.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

Description:


this class represents 32 bit (eg. rgb+alpha) images.

Only the minimum protocol is implemented here; much more is
needed for higher performance operations on depth32 images.

with #rgb, #rgba, #rgbx, photometrics 
pixels are internally stored byte-wise in rgba order.
(i.e. r at low-address byte, a at high-address byte). 
For rgb, a zero is always retrieved as alpha; 255 for rgbx.

When reading pixel values, photometric argb is returned as aarrggbb,
photometric rgb is returned as 00rrggbb,
photometric rgba is returned as rrggbb00,
both on LSB and on MSB machines.
(i.e. blue in lower bits of the returned 32bit integer, alpha in the high bits for argb,
 and in the low bits for rgba)
Thus, pixelValues and rgbValues are identical, simulating MSB on all
architectures.
(this should be transparent, if you use the rgbValueAt
 accessors; however, some old code uses pixelValueAt:, assuming that the
returned pixel value is rrggbb - which it would not be without this hack).

This also makes depth24Image's rgbValues compatible with depth32Image's rgbValues.

For argb and xrgb formats, alpha (or dummy alpha) is in the first byte 
(which are the high bits, as we present pixel values always MSB).


Related information:

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


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 pixelValue.
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.
With rgba photometric, the pixel value contains r/g/b/a in lsb order
(i.e. r at low, a at high bits);
with argb, alpha is in the low byte

o  pixelAtX: x y: y put: aPixelValue
set the pixel at x/y to aPixelValue.
The interpretation of the pixelValue depends on the photometric.
Pixels start at x=0 , y=0 for upper left pixel, end at
x = width-1, y=height-1 for lower right pixel.
With rgba photometric, the pixel value contains r/g/b/a in lsb order
(i.e. r at low, a at high bits);
with argb, alpha is in the low byte

o  rowAt: y putAll: pixelArray startingAt: startIndex
store a single rows bits from bits in the pixelArray argument;
The interpretation of the pixel values depends on the photometric.
Notice: row coordinate starts at 0.

converting rgb images
o  computeAlphaValuesFromMask: aMaskImage
convert a mask into alpha values;
masked pixels get an alpha value of 0, unmasked of 255

o  rgbImageAsTrueColorFormOn: aDevice
return a truecolor form from the rgba or argb-picture.

image manipulations
o  negative
Modified (format): / 22-08-2017 / 17:13:38 / cg

initialization
o  initialize

magnification
o  hardAntiAliasedMagnifiedBy: scaleArg
return a new image magnified by scalePoint, aPoint.
This interpolates pixels and is therefore much slower,
but generates nicer looking magnifications.

o  magnifyRowFrom: srcBytes offset: srcStart into: dstBytes offset: dstStart factor: mX
magnify a single pixel row - can only magnify by integer factors

queries
o  alphaBitsOf: pixel
given a pixel-value, return the alpha component as byteValue (0..255)

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

o  alphaMaskForPixelValue
return the mask used with translation from pixelValues to alphaBits.
Determines the number of bits of alpha

o  alphaShiftForPixelValue
return the shift amount used with translation from pixelValues to alphaBits.
That is the number of bits to shift the alpha value into the pixel value.

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  hasAlphaChannel
could be #rgb in 32 bits...

o  numAlphaBits
(comment from inherited method)
alpha in low bits

o  numBlueBits
(comment from inherited method)
alpha in low bits

o  numGreenBits
(comment from inherited method)
alpha in low bits

o  numRedBits
(comment from inherited method)
alpha in low bits

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
alpha in low byte

o  valueFromRedBits: redBits greenBits: greenBits blueBits: blueBits alphaBits: alphaBits
alpha in low byte



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Thu, 15 Nov 2018 12:48:42 GMT