(C) 2004-2007 George "Mirage" Bakhtadze The source code may be used under either MPL 1.1 or LGPL 2.1 license. See included license.txt file
Unit contains basic 2D types and routines
procedure BufferCopy(const SBuf, DBuf: Pointer; const BufLineLength, BpP: Integer; const Rect: BaseTypes.TRect); |
procedure BufferCut(const SBuf, DBuf: Pointer; const SrcLineLength, DestLineLength, BpP: Integer; const Rect: BaseTypes.TRect); |
function BufferCutAsRGBA(const SBuf, DBuf: Pointer; const SrcLineLength, DestLineLength, SrcFormat: Integer; const Rect: BaseTypes.TRect): Boolean; |
procedure BufferPaste(const SBuf, DBuf: Pointer; const SrcLineLength, DestLineLength, BpP: Integer; const Rect: BaseTypes.TRect); |
function BufferRGBABlend(const SBuf, DBuf, ABuf: Pointer; const SrcLineLength, DestLineLength, DestFormat: Integer; const Rect: BaseTypes.TRect): Boolean; |
function BufferRGBACombine(const SBuf, DBuf: Pointer; const SrcLineLength, DestLineLength, DestFormat: Integer; const Rect: BaseTypes.TRect): Boolean; |
function BufferRGBAPaste(const SBuf, DBuf: Pointer; const SrcLineLength, DestLineLength, DestFormat: Integer; const Rect: BaseTypes.TRect): Boolean; |
procedure BufferSwap(const SBuf, DBuf: Pointer; const SrcLineLength, DestLineLength, BpP: Integer; const Rect: BaseTypes.TRect); |
function ColorToVCLColor(Color: BaseTypes.TColor): Integer; |
function ConvertFromProcessing(Format, Size:Integer; Src: Pointer; var PaletteSize: Integer; Palette: PPalette; Dest: Pointer): Boolean; |
function ConvertImage(SrcFormat, DestFormat, TotalPixels: Integer; Src: Pointer; PaletteSize: Integer; Palette: PPalette; Dest: Pointer): Boolean; |
function ConvertToProcessing(Format, Size:Integer; Src: Pointer; PaletteSize: Integer; Palette: PPalette; Dest: Pointer): Boolean; |
function CreateThumbnail(SrcFormat, SrcWidth: Integer; const SrcRect: BaseTypes.TRect; Src: Pointer; PaletteSize: Integer; Palette: PPalette; DestFormat, Width, Height: Integer; Dest: Pointer): Boolean; |
function GetIntensity(Color: BaseTypes.TColor): Integer; |
function GetSuggestedMipLevelsInfo(Width, Height, Format: Integer; out Levels: TImageLevels): Integer; |
function ImageBellFilter(Value: Single): Single; |
function ImageBoxFilter(Value: Single): Single; |
function ImageHermiteFilter(Value: Single): Single; |
function ImageLanczos3Filter(Value: Single): Single; |
function ImageMitchellFilter(Value: Single): Single; |
function ImageSplineFilter(Value: Single): Single; |
function ImageTriangleFilter(Value: Single): Single; |
function LoadBitmap(const Stream: TStream; var Header: TImageHeader): Boolean; overload; |
function LoadBitmap(const Stream: TStream; out LineSize: Integer; out Width: Integer; out Height: Integer; out BitsPerPixel: Integer; out PaletteSize: Cardinal; out Palette: PPalette; out Data: Pointer): Boolean; overload; |
function LoadBitmapHeader(const Stream: TStream; out Header: TImageHeader): Boolean; |
function LoadIDF(const Stream: TStream; var IDFHeader: TIDFHeader; var Buffer: Pointer; var TotalSize: Integer): Boolean; |
function LoadIDFBuffers(const Stream: TStream; var IDFHeader: TIDFHeader; var Buffers: TPointerArray; var TotalSize: Integer): Boolean; |
function ResizeImage(Filter: TImageResizeFilter; FilterValue: Single; Format:Integer; Src: PImageBuffer; const SrcArea: BaseTypes.TRect; SrcLineLength: Integer; const Dest: PImageBuffer; const DestArea: BaseTypes.TRect; DestLineLength: Integer): Boolean; |
function SaveIDF(const Stream: TStream; const IDFHeader: TIDFHeader; const Buffers: array of Pointer): Boolean; |
procedure StretchARGBImage(Filter: TImageFilterFunction; const Radius: Single; Src: PImageBuffer; const SrcArea: BaseTypes.TRect; SrcLineLength: Integer; const Dest: PImageBuffer; const DestArea: BaseTypes.TRect; DestLineLength: Integer); |
function SwapRB(Color: BaseTypes.TColor): BaseTypes.TColor; |
function VCLColorToColor(Color: Integer): BaseTypes.TColor; |
Copies a rectangular area from one buffer to the top of another assuming width of destination buffer equal to width of the rectangle
Copies a rectangular area from one buffer to the top of another changing its format to ARGB and returns True if success
Copies a rectangular area from the top of one buffer to specified Rect of another assuming width of source buffer equal to width of the rectangle
Blends a rectangular area from the top of RGBA buffer with specified Rect of another buffer with the specified format using a separate 8-bit alpha-channel in ABuf and returns True if success
Combines a rectangular area from the top of RGBA buffer with specified Rect of another buffer with the specified format and returns True if success
Copies a rectangular area from the top of RGBA buffer to specified Rect of another buffer with the specified format and returns True if success
Swaps contents of a rectangular area of one buffer with the contents of another assuming width of destination buffer equal to width of the rectangle
Converts the specified number of pixels from ProcessingFormat to any known format. Returns False if input format is unknown or cannot be converted.
Converts the specified number of pixels from any known format to another known format. Returns False if input format is unknown or cannot be converted.
Converts the specified number of pixels from any known format to ProcessingFormat. Returns False if input format is unknown or cannot be converted.
Creates in Dest a thumbnail image of the given size and format from a rectangular area of original image. Returns True if success or False if conversion to Format is unsupported.
Returns the number of mip levels (including 0-th) which an image with the specified dimensions should have and fills in the levels info
Loads a .bmp file and returns True if success. All image parameters are placed in Header.
Loads a .bmp file and returns True if success.
Loads a .bmp file header and positions Stream at raw data start. Returns True if sucess.
Stretches a rectangular area of an ARGB image to a rectangular area of another ARGB image
TBitmapFileHeader = packed record bfType: Word; bfSize: Cardinal; bfReserved1, bfReserved2: Word; bfOffBits: Cardinal; end; |
TBitmapInfoHeader = packed record biSize: Cardinal; biWidth, biHeight: Longint; biPlanes: Word; biBitCount: Word; biCompression: Cardinal; biSizeImage: Cardinal; biXPelsPerMeter, biYPelsPerMeter: Longint; biClrUsed: Cardinal; biClrImportant: Cardinal; end; |
TImageFilterFunction = function (Value: Single): Single; |
TImageHeader = record Format: Integer; LineSize: Integer; Width, Height: Integer; BitsPerPixel, ImageSize: Integer; ImageOrigin: TImageOrigin; PaletteSize: Cardinal; Palette: PPalette; Data: Pointer; end; |
TImageLevel = record Width, Height: Integer; Size, Offset: Integer; end; |
TImageLevels = array[0..MaxMipLevels-1] of TImageLevel; |
Image mip level record. Width, Height - level dimensions, Size - size of level data in bytes, Offset - offset of level data on bytes from top level data