
Class: Depth32Image
Object

+Image

+Depth32Image
 Package:
 stx:libview
 Category:
 GraphicsImages
 Version:
 rev:
1.47
date: 2019/07/22 12:08:43
 user: cg
 file: Depth32Image.st directory: libview
 module: stx stcclassLibrary: libview
 Author:
 Claus Gittinger
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 bytewise in rgba order.
(i.e. r at lowaddress byte, a at highaddress 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).
Depth1Image
Depth2Image
Depth4Image
Depth8Image
Depth16Image
Depth24Image
ImageReader
queries

defaultPhotometric

return the default photometric pixel interpretation

imageDepth

return the depth of images represented by instances of
this class  here we return 32
accessingpixels

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 = width1, y=height1 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 = width1, y=height1 for lower right pixel.

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 = width1, y=height1 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

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 = width1, y=height1 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

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.

valueFromColor: aColor

get a color's pixel value.

valueFromRGB: anRGBValue

get the pixel value corresponding to an RGB value.
converting rgb images

computeAlphaValuesFromMask: aMaskImage

convert a mask into alpha values;
masked pixels get an alpha value of 0, unmasked of 255

rgbImageAsTrueColorFormOn: aDevice

return a truecolor form from the rgba or argbpicture.
image manipulations

negative

Modified (format): / 22082017 / 17:13:38 / cg
initialization

initialize

magnification

hardAntiAliasedMagnifiedBy: scaleArg

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

magnifyRowFrom: srcBytes offset: srcStart into: dstBytes offset: dstStart factor: mX

magnify a single pixel row  can only magnify by integer factors
queries

alphaBitsOf: pixel

given a pixelvalue, return the alpha component as byteValue (0..255)

alphaComponentOf: pixel

given a pixelvalue, return the alpha component in percent (0..100)

alphaMaskForPixelValue

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

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.

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

blueBitsOf: pixel

given a pixelvalue, return the blue component as byteValue (0..255)

blueComponentOf: pixel

given a pixelvalue, 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 pixelvalue, return the green component as byteValue (0..255)

greenComponentOf: pixel

given a pixelvalue, 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

hasAlphaChannel

could be #rgb in 32 bits...

numAlphaBits

always 8  even if ignored

numBlueBits

(comment from inherited method)
alpha in low bits

numGreenBits

(comment from inherited method)
alpha in low bits

numRedBits

(comment from inherited method)
alpha in low bits

redBitsOf: pixel

given a pixelvalue, return the red component as byteValue (0..255)

redComponentOf: pixel

given a pixelvalue, 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

given the rgb bits, each in 0..maxXXXValue (i.e. according to
r/g/b channels number of bits, return the corresponding pixel value.
For now, only useful with RGB images

valueFromRedBits: redBits greenBits: greenBits blueBits: blueBits alphaBits: alphaBits

alpha in low byte
