Class TDitheringToIndexedImage

Unit

Declaration

type TDitheringToIndexedImage = class(TObject)

Description

Handles dithering of an image

Hierarchy

Overview

Fields

Protected FBitOrder: TRawImageBitOrder;
Protected FBitsPerPixel: integer;
Protected FByteOrder: TRawImageByteOrder;
Protected FCurrentBitOrderMask: Int32or64;
Protected FCurrentData: PByte;
Protected FCurrentMaxY: Int32or64;
Protected FCurrentOutputScanline: PByte;
Protected FCurrentOutputY: Int32or64;
Protected FCurrentScanlineSize: PtrInt;
Protected FIgnoreAlpha: boolean;
Protected FLineOrder: TRawImageLineOrder;
Protected FPalette: TBGRACustomApproxPalette;
Protected FTransparentColorIndex: Int32or64;

Methods

Public constructor Create(APalette: TBGRACustomApproxPalette; AIgnoreAlpha: boolean; ABitsPerPixelForIndices: integer); overload;
Public constructor Create(APalette: TBGRACustomApproxPalette; AIgnoreAlpha: boolean; ABitsPerPixelForIndices: integer; AByteOrder: TRawImageByteOrder); overload;
Public function AllocateSpaceForIndexedData(AImage: TBGRACustomBitmap; AScanlineSize: PtrInt): pointer;
Public function ComputeMinimumScanlineSize(AWidthInPixels: integer): PtrInt;
Public function DitherImage(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap; AScanlineSize: PtrInt): Pointer; overload;
Public function DitherImage(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap): Pointer; overload;
Protected function GetScanline(Y: Int32or64): Pointer; virtual;
Protected function GetTransparentColorIndex: integer;
Public procedure DitherImageTo(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap; AData: Pointer; AScanlineSize: PtrInt); overload;
Public procedure DitherImageTo(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap; AData: Pointer); overload;
Protected procedure OutputPixelFullByte(X,Y: Int32or64; AColorIndex: Int32or64; AColor: TBGRAPixel); virtual;
Protected procedure OutputPixelSubByte(X,Y: Int32or64; AColorIndex: Int32or64; AColor: TBGRAPixel); virtual;
Protected procedure SetBitOrder(AValue: TRawImageBitOrder); virtual;
Protected procedure SetBitsPerPixel(AValue: integer); virtual;
Protected procedure SetByteOrder(AValue: TRawImageByteOrder); virtual;
Protected procedure SetIgnoreAlpha(AValue: boolean);
Protected procedure SetLineOrder(AValue: TRawImageLineOrder);
Protected procedure SetPalette(AValue: TBGRACustomApproxPalette);
Protected procedure SetTransparentColorIndex(AValue: integer);

Properties

Public property BitOrder: TRawImageBitOrder read FBitOrder write SetBitOrder;
Public property BitsPerPixel: integer read FBitsPerPixel write SetBitsPerPixel;
Public property ByteOrder: TRawImageByteOrder read FByteOrder write SetByteOrder;
Public property DefaultTransparentColorIndex: integer read GetTransparentColorIndex write SetTransparentColorIndex;
Public property IgnoreAlpha: boolean read FIgnoreAlpha write SetIgnoreAlpha;
Public property LineOrder: TRawImageLineOrder read FLineOrder write SetLineOrder;
Public property Palette: TBGRACustomApproxPalette read FPalette write SetPalette;

Description

Fields

Protected FBitOrder: TRawImageBitOrder;

This item has no description.

Protected FBitsPerPixel: integer;

This item has no description.

Protected FByteOrder: TRawImageByteOrder;

This item has no description.

Protected FCurrentBitOrderMask: Int32or64;

This item has no description.

Protected FCurrentData: PByte;

This item has no description.

Protected FCurrentMaxY: Int32or64;

This item has no description.

Protected FCurrentOutputScanline: PByte;

This item has no description.

Protected FCurrentOutputY: Int32or64;

This item has no description.

Protected FCurrentScanlineSize: PtrInt;

following variables are used during dithering

Protected FIgnoreAlpha: boolean;

This item has no description.

Protected FLineOrder: TRawImageLineOrder;

This item has no description.

Protected FPalette: TBGRACustomApproxPalette;

This item has no description.

Protected FTransparentColorIndex: Int32or64;

This item has no description.

Methods

Public constructor Create(APalette: TBGRACustomApproxPalette; AIgnoreAlpha: boolean; ABitsPerPixelForIndices: integer); overload;

This item has no description.

Public constructor Create(APalette: TBGRACustomApproxPalette; AIgnoreAlpha: boolean; ABitsPerPixelForIndices: integer; AByteOrder: TRawImageByteOrder); overload;

use platform byte order

Public function AllocateSpaceForIndexedData(AImage: TBGRACustomBitmap; AScanlineSize: PtrInt): pointer;

This item has no description.

Public function ComputeMinimumScanlineSize(AWidthInPixels: integer): PtrInt;

This item has no description.

Public function DitherImage(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap; AScanlineSize: PtrInt): Pointer; overload;

use minimum scanline size

Public function DitherImage(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap): Pointer; overload;

maybe necessary if larger than 8 bits per pixel

Protected function GetScanline(Y: Int32or64): Pointer; virtual;

This item has no description.

Protected function GetTransparentColorIndex: integer;

This item has no description.

Public procedure DitherImageTo(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap; AData: Pointer; AScanlineSize: PtrInt); overload;

use minimum scanline size

Public procedure DitherImageTo(AAlgorithm: TDitheringAlgorithm; AImage: TBGRACustomBitmap; AData: Pointer); overload;

This item has no description.

Protected procedure OutputPixelFullByte(X,Y: Int32or64; AColorIndex: Int32or64; AColor: TBGRAPixel); virtual;

This item has no description.

Protected procedure OutputPixelSubByte(X,Y: Int32or64; AColorIndex: Int32or64; AColor: TBGRAPixel); virtual;

This item has no description.

Protected procedure SetBitOrder(AValue: TRawImageBitOrder); virtual;

This item has no description.

Protected procedure SetBitsPerPixel(AValue: integer); virtual;

This item has no description.

Protected procedure SetByteOrder(AValue: TRawImageByteOrder); virtual;

This item has no description.

Protected procedure SetIgnoreAlpha(AValue: boolean);

This item has no description.

Protected procedure SetLineOrder(AValue: TRawImageLineOrder);

This item has no description.

Protected procedure SetPalette(AValue: TBGRACustomApproxPalette);

This item has no description.

Protected procedure SetTransparentColorIndex(AValue: integer);

This item has no description.

Properties

Public property BitOrder: TRawImageBitOrder read FBitOrder write SetBitOrder;

This item has no description.

Public property BitsPerPixel: integer read FBitsPerPixel write SetBitsPerPixel;

optional customization of format

Public property ByteOrder: TRawImageByteOrder read FByteOrder write SetByteOrder;

This item has no description.

Public property DefaultTransparentColorIndex: integer read GetTransparentColorIndex write SetTransparentColorIndex;

when there is no transparent color in the palette, or that IgnoreAlpha is set to True, this allows to define the index for the fully transparent color

Public property IgnoreAlpha: boolean read FIgnoreAlpha write SetIgnoreAlpha;

This item has no description.

Public property LineOrder: TRawImageLineOrder read FLineOrder write SetLineOrder;

This item has no description.

Public property Palette: TBGRACustomApproxPalette read FPalette write SetPalette;

This item has no description.