// in GraphType
type
TRawImageDescription = object
Format: TRawImageColorFormat;
Width: cardinal;
Height: cardinal;
Depth: Byte; // used bits per pixel
BitOrder: TRawImageBitOrder;
ByteOrder: TRawImageByteOrder;
LineOrder: TRawImageLineOrder;
LineEnd: TRawImageLineEnd;
BitsPerPixel: Byte; // bits per pixel. can be greater than Depth.
RedPrec: Byte; // red or gray precision. bits for red
RedShift: Byte; // bitshift. Direction: from least to most significant
GreenPrec: Byte;
GreenShift: Byte;
BluePrec: Byte;
BlueShift: Byte;
AlphaPrec: Byte;
AlphaShift: Byte;
// The next values are only valid, if there is a mask (MaskBitsPerPixel > 0)
// Masks are always separate with a depth of 1 bpp. One pixel can occupy
// one byte at most
// a value of 1 means that pixel is masked
// a value of 0 means the pixel value is shown
MaskBitsPerPixel: Byte; // bits per mask pixel, usually 1, 0 when no mask
MaskShift: Byte; // the shift (=position) of the mask bit
MaskLineEnd: TRawImageLineEnd;
MaskBitOrder: TRawImageBitOrder;
// The next values are only valid, if there is a palette (PaletteColorCount > 0)
PaletteColorCount: Word; // entries in color palette. 0 when no palette.
PaletteBitsPerIndex: Byte; // bits per palette index, this can be larger than the colors used
PaletteShift: Byte; // bitshift. Direction: from least to most significant
PaletteLineEnd: TRawImageLineEnd;
PaletteBitOrder: TRawImageBitOrder;
PaletteByteOrder: TRawImageByteOrder;
// don't use a constructor here, it will break compatibility with a record
procedure Init;
// 1-bit mono format
procedure Init_BPP1(AWidth, AHeight: integer);
// 16-bits formats
procedure Init_BPP16_R5G6B5(AWidth, AHeight: integer);
// Formats in RGB order
procedure Init_BPP24_R8G8B8_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP24_R8G8B8_BIO_TTB_UpsideDown(AWidth, AHeight: integer);
procedure Init_BPP32_A8R8G8B8_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP32_R8G8B8A8_BIO_TTB(AWidth, AHeight: integer);
// Formats in Windows pixels order: BGR
procedure Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP24_B8G8R8_M1_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP32_B8G8R8_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP32_B8G8R8_M1_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP32_B8G8R8A8_BIO_TTB(AWidth, AHeight: integer);
procedure Init_BPP32_B8G8R8A8_M1_BIO_TTB(AWidth, AHeight: integer);
function GetDescriptionFromMask: TRawImageDescription;
function GetDescriptionFromAlpha: TRawImageDescription;
//returns indices of channels in four-element array
procedure GetRGBIndices(out Ridx, Gidx, Bidx, Aidx:Byte);
function BytesPerLine: PtrUInt;
function BitsPerLine: PtrUInt;
function MaskBytesPerLine: PtrUInt;
function MaskBitsPerLine: PtrUInt;
function AsString: string;
function IsEqual(ADesc: TRawImageDescription): Boolean;
end;
PRawImageDescription = ^TRawImageDescription;