Definitions of several special types (including Raw Image) to be used for graphics
A raw image can contain RGBA or monochrome pixels.
ricfNone indicates an uninitialized image.
The LSB/MSB-first byte order of pixel data.
The first pixel in a raw image line can be the left or right pixel of the displaye image.
Bit 0 represents first pixel[?]
Bit 0 represents highest pixel[?]
The alignment of raw image scanlines.
Scanlines can begin inside a byte.
Scanlines start at a byte boundary.
Scanlines start at a 16 bit boundary.
Scanlines start at a 32 bit (DWORD) boundary.
Scanlines start at a 64 bit (QWORD) boundary.
The first stored line of pixels can represent the logical top or bottom of the displayed image.
First scanline at the top
First scanline at the bottom
Descriptor object for the image format of devices and raw (uncompressed) image data
This effectivley is a record with some attached methods. More related procedures exist outside the object. [where?]

The object describes the presence and exact storage of the RGBA image and mask pixels, of a device or image. The color information is stored in aligned scanlines.

Note: palettes, BitOrder and ByteOrder seem not to be implemented yet. The meaning of the PaletteXXX values and of BitOrder is undefined, so far.

xxxBitsPerPixel and xxxPrecisionMask applies to color data. For masked images, the pixels and the mask are two different arrays, containing different elements.
An initialized image can contain color (RGBA) or monochrome pixels.
ricfNone
indicates an uninitialized image.
Number of used bits per pixel
The color and pixel storage can be subject to alignment, so that the logical color Depth can be less than the physical BitsPerPixel.

[What if a palette is used?]
Width of the image in pixels
Height of the image in pixels.
Number of entries in the color palette. 0 when no palette is present.
[unusable by definition]
The LSB/MSB-first byte order of color data.
[Not yet implemented]
The first stored line of pixels can represent the logical top or bottom of the displayed image.
Number of bits stored per pixel
BitsPerPixel
can be greater than the logical (used) Depth.
Alignment of the scanlines.
Bits per pixel in the Red channel
Bit offset of the Red channel in color data.
Bits per pixel in the Green channel
Bit offset of the Green channel in color data.
Bits per pixel in the Blue channel
Bit offset of the Blue channel in color data.
Bits per pixel in the Alpha channel
Bit offset of the Alpha channel in color data.
Pointer to
An uncompressed graphics image (bitmap)
This object hold the pixels, mask and color palette of the image, as well as a detailed description of the storage format of these parts.

This object currently is subject to refactoring, don't use it in application code.
Description
record for the Raw Image
Data
- a pointer to the actual data of the image
DataSize
- pointer to the size of the image
Mask
- pointer to the Mask for use with the image
MaskSize
- pointer to the size of the mask
Palette
- pointer to the palette of colours for this image
PaletteSize
- pointer to the size of the palette
PRawImage
- pointer to a TRawImage
Record describing a position in Raw Image data
Byte is the byte offset, Bit the bit number/offset in that byte.
PRawImagePosition
- pointer to a TRawImagePosition
GetBitsPerLine
- returns the number of bits per line (as a pointer)
Bits per mask pixel, 0 when no mask is present.
A pixel Mask (currently) has a logical depth of 1 bit per pixel, but a pixel can occupy an entire byte[?]

As opposed to the Alpha (transparency) channel, a Mask is stored in its own array. [of bits or bytes?]

A Mask value of 1 means that the pixel is masked (transparent); a value of 0 means the pixel value is shown (opaque).
The bit offset of the mask bit [if stored in a byte?]
Alignment of Mask lines.
Bit order of the Mask.
Bits per palette index, stored in the pixel data[?]
When a palette is used, [I suppose that] the color description fields apply to the palette colors, while pixel data contains the palette index. Then Depth applies to the size of the palette colors, and the pixel data is described by PaletteBitsPerIndex and PaletteShift[?]
[palettes are not yet implemented]
[useless by definition]
Alignment of [what?]
The wording suggests that the PaletteXYZ fields apply to the pixel data (palette indices), not to the palette itself. A palette is not organized in lines...
Bit order of the palette indices[?]
Byte order of the palette indices[?]
Initialize the image descriptor to all zeroes.
A constructor cannot be used here, it would break compatibility with a record.
Init for an unmasked 24 bit RGB image (LSB Blue).

Init_BPP24_B8G8R8_BIO_TTB - initiator for specified format

    { pf24bit:

     Format=ricfRGBA HasPalette=false Depth=24 PaletteColorCount=0
     BitOrder=riboBitsInOrder ByteOrder=DefaultByteOrder
     LineOrder=riloTopToBottom
     BitsPerPixel=24 LineEnd=rileDWordBoundary
     RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0
    }

Init for a masked 24 bit RGB image (LSB Blue)

Init_BPP24_B8G8R8_M1_BIO_TTB - initiator for specfied format

    { pf24bit:

     Format=ricfRGBA HasPalette=false Depth=24 PaletteColorCount=0
     BitOrder=riboBitsInOrder ByteOrder=DefaultByteOrder
     LineOrder=riloTopToBottom
     BitsPerPixel=24 LineEnd=rileDWordBoundary
     RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0
     Masked
    }

Init for an unmasked 32 bit RGB image (LSB blue)

Init_BPP32_B8G8R8_BIO_TTB - initiator for specified format

    { pf32bit:

     Format=ricfRGBA HasPalette=false Depth=24 PaletteColorCount=0
     BitOrder=riboBitsInOrder ByteOrder=DefaultByteOrder
     LineOrder=riloTopToBottom
     BitsPerPixel=32 LineEnd=rileDWordBoundary
     RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0
     No alpha
     No mask
    }

Init for a masked 32 bit RGB image (LSB blue)

Init_BPP32_B8G8R8_M1_BIO_TTB - initiator for specified format

    { pf32bit:

     Format=ricfRGBA HasPalette=false Depth=24 PaletteColorCount=0
     BitOrder=riboBitsInOrder ByteOrder=DefaultByteOrder
     LineOrder=riloTopToBottom
     BitsPerPixel=32 LineEnd=rileDWordBoundary
     RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0
     no alpha
     with mask
    }

Init for an unmasked 32 bit RGBA image (LSB blue)

Init_BPP32_B8G8R8A8_BIO_TTB - initiator for specified format

    { pf32bit:

     Format=ricfRGBA HasPalette=false Depth=32 PaletteColorCount=0
     BitOrder=riboBitsInOrder ByteOrder=DefaultByteOrder
     LineOrder=riloTopToBottom
     BitsPerPixel=32 LineEnd=rileDWordBoundary
     RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0
     alpha
     no mask
    }

Init for a masked 32 bit RGBA image (LSB blue)

Init_BPP32_B8G8R8A8_M1_BIO_TTB - initiator for specified format

    { pf32bit:

     Format=ricfRGBA HasPalette=false Depth=32 PaletteColorCount=0
     BitOrder=riboBitsInOrder ByteOrder=DefaultByteOrder
     LineOrder=riloTopToBottom
     BitsPerPixel=32 LineEnd=rileDWordBoundary
     RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0
     alpha
     masked
    }

Returns an monochrome image descriptor constructed from the Mask
Returns an monochrome image descriptor constructed from the Alpha channel
The number of bytes per scanline.
The number of bits per scanline.
The number of bytes per Mask scanline.
The number of bits per Mask scanline.
The image descriptor as a string.
Compares with the given description, returns True if it's equal.
Init
- initiator for the object. Don't use a contructor here, it will break compatibility with a record
CreateData
- method to create the data for the record
Destroys the allocated Data, Mask and Palette arrays.
ReleaseData
- frees the resources when finished with th edata
ExtractRect
- find the position of the bounding rectangle from the raw data
PerformEffect
- applies a specified special effect to the data of the Raw Image
ReadBits
- reads the bit values for the raw image data at a given position
Reads the R, G, B and Alpha channel values at a given position in pixel data.
Read the Mask value at the given position in the image data. Returns AMask=True if the pixel is transparent.
The position in the Mask data typically differs from the position in the color data.
Writes ABits into Data at the given position.
WriteChannels
- writes the specified channel values at the nominated position
IsMasked
- returns True if the specified pixels are masked
IsTransparent
- returns True if the specified pixels are transparent
IsEqual
- returns True if the current and specified images are equal
TRawImageLineStarts
- contains a list of the start positions of the lines in the Raw Image
Positions
- the array of start positions
Init
- initiator for the object. Don't use a constructor here, it will break compatibility with a record
GetPosition
- returns the position specified by x, y coordinates as a TRawImagePosition
PRawImageLineStarts
- pointer to TRawImageLineStarts
GetBytesPerLine
- returns the number of bytes per line (as a pointer)
CopyImageData
- copies data from ASource to ADestination, returning True if successful
Scanlines start at a 128 bit boundary.
Image formats supported by a device, or present in image data[?]
Read color bits.
AData is the pointer to the pixel data. APosition is the position of a pixel within AData. ABitsPerPixel is the size of a stored pixel. APrec and AShift select the field (color channel or palette index).

The bits are extracted into the low order bits of the result (ABits).
Write color or mask data, from the high bits of ABits.
ReadBits returns the value in the low order bits