Unit PXL.Types

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

Essential types, constants and functions working with vectors, colors, pixels and rectangles that are used throughout the entire framework.

Overview

Classes, Interfaces, Objects and Records

Name Description
record TColorPair A combination of two colors, primarily used for displaying text with the first color being on top and the second being on bottom.
record TColorRect A combination of four colors, primarily used for displaying colored quads, where each color corresponds to top/left,top/right, bottom/right and bottom/left accordingly (clockwise).
record TFloatColor A special high-precision color value that has each individual component represented as 32-bit floating-point value in range of [0, 1].
record TFloatRect General-purpose floating-point rectangle POD type defined by top and left margins, width and height.
record TIntColorRec Alternative representation of TIntColor, where each element can be accessed as an individual value.
record TIntRect General-purpose integer rectangle POD type defined by top and left margins, width and height.
record TMatrix3f 3x3 transformation matrix.
record TMatrix4f 4x4 transformation matrix.
record TPoint2f 2D floating-point vector.
record TPoint2i 2D integer vector.
record TQuad Special floating-point quadrilateral defined by four vertices starting from top/left in clockwise order.
record TQuaternion 3D quaternion.
record TVector3f 3D floating-point vector.
record TVector3i 3D integer vector.
record TVector4f 4D (3D + w) floating-point vector.

Functions and Procedures

function AddPixels(const Color1, Color2: TIntColor): TIntColor;
function AverageFourPixels(const Color1, Color2, Color3, Color4: TIntColor): TIntColor;
function AveragePixels(const Color1, Color2: TIntColor): TIntColor;
function AverageSixPixels(const Color1, Color2, Color3, Color4, Color5, Color6: TIntColor): TIntColor;
function BlendFourPixels(const TopLeft, TopRight, BottomRight, BottomLeft: TIntColor; const AlphaX, AlphaY: Integer): TIntColor;
function BlendPixels(const Color1, Color2: TIntColor; const Alpha: Integer): TIntColor;
function CeilPowerOfTwo(const Value: VectorInt): VectorInt;
function ColorPair(const First, Second: TIntColor): TColorPair; overload; inline;
function ColorPair(const Color: TIntColor): TColorPair; overload; inline;
function ColorRect(const Color: TIntColor): TColorRect; overload; inline;
function ColorRect(const TopLeft, TopRight, BottomRight, BottomLeft: TIntColor): TColorRect; overload; inline;
function ColorRectH(const Left, Right: TIntColor): TColorRect; overload; inline;
function ColorRectH(const Color: TColorPair): TColorRect; overload; inline;
function ColorRectV(const Top, Bottom: TIntColor): TColorRect; overload; inline;
function ColorRectV(const Color: TColorPair): TColorRect; overload; inline;
function DisplaceRB(const Color: TIntColor): TIntColor;
procedure ExtractGrayAlpha(const SourceGray1, SourceGray2, Background1, Background2: VectorFloat; out Alpha, Gray: VectorFloat); overload;
function FloatColor(const Red, Green, Blue: VectorFloat; const Alpha: VectorFloat = 1.0): TFloatColor; overload;
function FloatColor(const Color: TIntColor): TFloatColor; overload;
function FloatRect(const Left, Top, Width, Height: VectorFloat): TFloatRect; overload;
function FloatRect(const Origin, Size: TPoint2f): TFloatRect; overload;
function FloatRectBDS(const TopLeft, BottomRight: TPoint2f): TFloatRect; overload;
function FloatRectBDS(const Left, Top, Right, Bottom: VectorFloat): TFloatRect; overload;
function FloorPowerOfTwo(const Value: VectorInt): VectorInt;
function IntColor(const Color: TIntColor; const Alpha: Integer): TIntColor; overload; inline;
function IntColor(const Color: TIntColor; const Gray, Alpha: VectorFloat): TIntColor; overload; inline;
function IntColor(const Color: TIntColor; const Alpha: VectorFloat): TIntColor; overload; inline;
function IntColor(const Color: TIntColor; const Gray, Alpha: Integer): TIntColor; overload; inline;
function IntColorAlpha(const Alpha: Integer): TIntColor; overload; inline;
function IntColorAlpha(const Alpha: VectorFloat): TIntColor; overload; inline;
function IntColorGray(const Gray: Integer; const Alpha: Integer = 255): TIntColor; overload; inline;
function IntColorGray(const Gray: VectorFloat; const Alpha: VectorFloat = 1.0): TIntColor; overload; inline;
function IntColorRGB(const Red, Green, Blue: Integer; const Alpha: Integer = 255): TIntColor; overload;
function IntRect(const Origin, Size: TPoint2i): TIntRect; overload;
function IntRect(const Left, Top, Width, Height: VectorInt): TIntRect; overload;
function IntRectBDS(const TopLeft, BottomRight: TPoint2i): TIntRect; overload;
function IntRectBDS(const Left, Top, Right, Bottom: VectorInt): TIntRect; overload;
function InvertPixel(const Color: TIntColor): TIntColor;
function IsPowerOfTwo(const Value: VectorInt): Boolean;
function Lerp(const Value1, Value2, Theta: VectorFloat): VectorFloat;
function LerpFourPixels(const TopLeft, TopRight, BottomRight, BottomLeft: TIntColor; const AlphaX, AlphaY: VectorFloat): TIntColor;
function LerpPixels(const Color1, Color2: TIntColor; const Alpha: VectorFloat): TIntColor;
function MultiplyPixels(const Color1, Color2: TIntColor): TIntColor;
function PixelToGray(const Color: TIntColor): Integer;
function PixelToGray16(const Color: TIntColor): Integer;
function PixelToGrayFloat(const Color: TIntColor): VectorFloat;
function Point2f(const X, Y: VectorFloat): TPoint2f; inline;
function Point2i(const X, Y: VectorInt): TPoint2i;
function PremultiplyAlpha(const Color: TIntColor): TIntColor;
function Quad(const TopLeftX, TopLeftY, TopRightX, TopRightY, BottomRightX, BottomRightY, BottomLeftX, BottomLeftY: VectorFloat): TQuad; overload;
function Quad(const Rect: TFloatRect): TQuad; overload;
function Quad(const Rect: TIntRect): TQuad; overload;
function Quad(const TopLeft, TopRight, BottomRight, BottomLeft: TPoint2f): TQuad; overload;
function Quad(const Left, Top, Width, Height: VectorFloat): TQuad; overload;
function Saturate(const Value, MinLimit, MaxLimit: VectorInt): VectorInt; inline;
function Saturate(const Value, MinLimit, MaxLimit: VectorFloat): VectorFloat; inline;
function SineAccelerate(const Value: VectorFloat): VectorFloat;
function SineCycle(const Value: VectorFloat): VectorFloat;
function SineDecelerate(const Value: VectorFloat): VectorFloat;
function SineSymCycle(const Value: VectorFloat): VectorFloat;
function SineTransform(const Value: VectorFloat): VectorFloat;
function SubtractPixels(const Color1, Color2: TIntColor): TIntColor;
function UnpremultiplyAlpha(const Color: TIntColor): TIntColor;
function Vector3f(const Point: TPoint2f; const Z: VectorFloat = 0.0): TVector3f; overload; inline;
function Vector3f(const X, Y, Z: VectorFloat): TVector3f; overload; inline;
function Vector3i(const Point: TPoint2i; const Z: VectorInt = 0): TVector3i; overload; inline;
function Vector3i(const X, Y, Z: VectorInt): TVector3i; overload; inline;
function Vector4f(const Point: TPoint2f; const Z: VectorFloat = 0.0; const W: VectorFloat = 1.0): TVector4f; overload; inline;
function Vector4f(const X, Y, Z: VectorFloat; const W: VectorFloat = 1.0): TVector4f; overload; inline;
function Vector4f(const Vector: TVector3f; const W: VectorFloat = 1.0): TVector4f; overload; inline;

Types

PColorPair = ˆTColorPair;
PColorRect = ˆTColorRect;
PDepthStencil = ˆTDepthStencil;
PFloatColor = ˆTFloatColor;
PFloatRect = ˆTFloatRect;
PIntColor = ˆTIntColor;
PIntColorPalette = ˆTIntColorPalette;
PIntColorRec = ˆTIntColorRec;
PIntColorValue = ˆTIntColorValue;
PIntRect = ˆTIntRect;
PMatrix3f = ˆTMatrix3f;
PMatrix4f = ˆTMatrix4f;
PPixelFormat = ˆTPixelFormat;
PPoint2f = ˆTPoint2f;
PPoint2i = ˆTPoint2i;
PQuad = ˆTQuad;
PQuaternion = ˆTQuaternion;
PVector3f = ˆTVector3f;
PVector3i = ˆTVector3i;
PVector4f = ˆTVector4f;
TAlphaFormatRequest = (...);
TDepthStencil = (...);
TIntColor = LongWord;
TIntColorPalette = array[0..255] of TIntColor;
TIntColorValue = LongWord;
TPixelFormat = (...);
TStandardNotifyEvent = procedure(const Sender: TObject) of object;

Constants

AxisWVector4: TVector4f = (X: 0.0; Y: 0.0; Z: 0.0; W: 1.0);
AxisXPoint2f: TPoint2f = (X: 1.0; Y: 0.0);
AxisXPoint2i: TPoint2i = (X: 1; Y: 0);
AxisXVector3f: TVector3f = (X: 1.0; Y: 0.0; Z: 0.0);
AxisXVector3i: TVector3i = (X: 1; Y: 0; Z: 0);
AxisXVector4: TVector4f = (X: 1.0; Y: 0.0; Z: 0.0; W: 0.0);
AxisXVector4H: TVector4f = (X: 1.0; Y: 0.0; Z: 0.0; W: 1.0);
AxisYPoint2f: TPoint2f = (X: 0.0; Y: 1.0);
AxisYPoint2i: TPoint2i = (X: 0; Y: 1);
AxisYVector3f: TVector3f = (X: 0.0; Y: 1.0; Z: 0.0);
AxisYVector3i: TVector3i = (X: 0; Y: 1; Z: 0);
AxisYVector4: TVector4f = (X: 0.0; Y: 1.0; Z: 0.0; W: 0.0);
AxisYVector4H: TVector4f = (X: 0.0; Y: 1.0; Z: 0.0; W: 1.0);
AxisZVector3f: TVector3f = (X: 0.0; Y: 0.0; Z: 1.0);
AxisZVector3i: TVector3i = (X: 0; Y: 0; Z: 1);
AxisZVector4: TVector4f = (X: 0.0; Y: 0.0; Z: 1.0; W: 0.0);
AxisZVector4H: TVector4f = (X: 0.0; Y: 0.0; Z: 1.0; W: 1.0);
ColorPairBlack: TColorPair = (First: $FF000000; Second: $FF000000);
ColorPairTranslucentBlack: TColorPair = (First: $00000000; Second: $00000000);
ColorPairTranslucentWhite: TColorPair = (First: $00FFFFFF; Second: $00FFFFFF);
ColorPairWhite: TColorPair = (First: $FFFFFFFF; Second: $FFFFFFFF);
ColorRectBlack: TColorRect = (TopLeft: $FF000000; TopRight: $FF000000; BottomRight: $FF000000; BottomLeft: $FF000000);
ColorRectTranslucentBlack: TColorRect = (TopLeft: $00000000; TopRight: $00000000; BottomRight: $00000000; BottomLeft: $00000000);
ColorRectTranslucentWhite: TColorRect = (TopLeft: $00FFFFFF; TopRight: $00FFFFFF; BottomRight: $00FFFFFF; BottomLeft: $00FFFFFF);
ColorRectWhite: TColorRect = (TopLeft: $FFFFFFFF; TopRight: $FFFFFFFF; BottomRight: $FFFFFFFF; BottomLeft: $FFFFFFFF);
FloatColorBlack: TFloatColor = (Red: 0.0; Green: 0.0; Blue: 0.0; Alpha: 1.0);
FloatColorTranslucentBlack: TFloatColor = (Red: 0.0; Green: 0.0; Blue: 0.0; Alpha: 0.0);
FloatColorTranslucentWhite: TFloatColor = (Red: 1.0; Green: 1.0; Blue: 1.0; Alpha: 0.0);
FloatColorWhite: TFloatColor = (Red: 1.0; Green: 1.0; Blue: 1.0; Alpha: 1.0);
IdentityMatrix3f: TMatrix3f = (Data: ((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)));
IdentityMatrix4f: TMatrix4f = (Data: ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0)));
IdentityQuaternion: TQuaternion = (X: 0.0; Y: 0.0; Z: 0.0; W: 1.0);
IntColorBlack = $FF000000;
IntColorTranslucentBlack = $00000000;
IntColorTranslucentWhite = $00FFFFFF;
IntColorWhite = $FFFFFFFF;
MinusInfinity2i: TPoint2i = (X: Low(VectorInt) + 1; Y: Low(VectorInt) + 1);
PlusInfinity2i: TPoint2i = (X: High(VectorInt); Y: High(VectorInt));
Undefined2i: TPoint2i = (X: Low(VectorInt); Y: Low(VectorInt));
UnityPoint2f: TPoint2f = (X: 1.0; Y: 1.0);
UnityPoint2i: TPoint2i = (X: 1; Y: 1);
UnityVector3f: TVector3f = (X: 1.0; Y: 1.0; Z: 1.0);
UnityVector3i: TVector3i = (X: 1; Y: 1; Z: 1);
UnityVector4: TVector4f = (X: 1.0; Y: 1.0; Z: 1.0; W: 1.0);
ZeroFloatRect: TFloatRect = (Left: 0.0; Top: 0.0; Width: 0.0; Height: 0.0);
ZeroIntRect: TIntRect = (Left: 0; Top: 0; Width: 0; Height: 0);
ZeroMatrix3f: TMatrix3f = (Data: ((0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0)));
ZeroMatrix4f: TMatrix4f = (Data: ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)));
ZeroPoint2f: TPoint2f = (X: 0.0; Y: 0.0);
ZeroPoint2i: TPoint2i = (X: 0; Y: 0);
ZeroVector3f: TVector3f = (X: 0.0; Y: 0.0; Z: 0.0);
ZeroVector3i: TVector3i = (X: 0; Y: 0; Z: 0);
ZeroVector4: TVector4f = (X: 0.0; Y: 0.0; Z: 0.0; W: 0.0);
ZeroVector4H: TVector4f = (X: 0.0; Y: 0.0; Z: 0.0; W: 1.0);

Description

Functions and Procedures

function AddPixels(const Color1, Color2: TIntColor): TIntColor;

Adds two 32-bit RGBA color values together clamping the resulting values if necessary.

function AverageFourPixels(const Color1, Color2, Color3, Color4: TIntColor): TIntColor;

Computes average of four given 32-bit RGBA color values.

function AveragePixels(const Color1, Color2: TIntColor): TIntColor;

Computes average of two given 32-bit RGBA color values.

function AverageSixPixels(const Color1, Color2, Color3, Color4, Color5, Color6: TIntColor): TIntColor;

Computes average of six given 32-bit RGBA color values.

function BlendFourPixels(const TopLeft, TopRight, BottomRight, BottomLeft: TIntColor; const AlphaX, AlphaY: Integer): TIntColor;

Computes resulting alpha-blended value between four 32-bit RGBA colors using linear interpolation. AlphaX and AlphaY can be in [0..255] range.

function BlendPixels(const Color1, Color2: TIntColor; const Alpha: Integer): TIntColor;

Computes alpha-blending for a pair of 32-bit RGBA colors values. Alpha can be in [0..255] range.

function CeilPowerOfTwo(const Value: VectorInt): VectorInt;

Returns the least power of two greater or equal to the specified value.

function ColorPair(const First, Second: TIntColor): TColorPair; overload; inline;

Creates two 32-bit RGBA color gradient from specified pair of values.

function ColorPair(const Color: TIntColor): TColorPair; overload; inline;

Creates two 32-bit RGBA color gradient with both values set to specified color.

function ColorRect(const Color: TIntColor): TColorRect; overload; inline;

Creates a construct of four colors having the same component in each corner.

function ColorRect(const TopLeft, TopRight, BottomRight, BottomLeft: TIntColor): TColorRect; overload; inline;

Creates a construct of four colors using individual components.

function ColorRectH(const Left, Right: TIntColor): TColorRect; overload; inline;

Creates a construct of four colors from two color values to create horizontal gradient.

function ColorRectH(const Color: TColorPair): TColorRect; overload; inline;

Creates a construct of four colors from two color pair to create horizontal gradient.

function ColorRectV(const Top, Bottom: TIntColor): TColorRect; overload; inline;

Creates a construct of four colors from two color values to create vertical gradient.

function ColorRectV(const Color: TColorPair): TColorRect; overload; inline;

Creates a construct of four colors from two color pair to create vertical gradient.

function DisplaceRB(const Color: TIntColor): TIntColor;

Switches red and blue channels in 32-bit RGBA color value.

procedure ExtractGrayAlpha(const SourceGray1, SourceGray2, Background1, Background2: VectorFloat; out Alpha, Gray: VectorFloat); overload;

Extracts alpha-channel from two grayscale samples. The sample must be rendered with the same color on two different backgrounds, preferably on black and white; the resulting colors are provided in Src1 and Src2, with original backgrounds in Bk1 and Bk2. The resulting alpha-channel and original color are computed and returned. This method is particularly useful for calculating alpha-channel when rendering GDI fonts or in tools that generate resulting images without providing alpha-channel (therefore rendering the same image on two backgrounds is sufficient to calculate its alpha-channel).

function FloatColor(const Red, Green, Blue: VectorFloat; const Alpha: VectorFloat = 1.0): TFloatColor; overload;

Creates floating-point color using specified individual components for red, green, blue and alpha channel.

function FloatColor(const Color: TIntColor): TFloatColor; overload;

Creates floating-point color from its 32-bit integer representation.

function FloatRect(const Left, Top, Width, Height: VectorFloat): TFloatRect; overload;

Creates rectangle based on top/left position, width and height.

function FloatRect(const Origin, Size: TPoint2f): TFloatRect; overload;

Creates rectangle based on top/left position and size.

function FloatRectBDS(const TopLeft, BottomRight: TPoint2f): TFloatRect; overload;

Creates rectangle based on top/left and bottom/right margin bounds.

function FloatRectBDS(const Left, Top, Right, Bottom: VectorFloat): TFloatRect; overload;

Creates rectangle based on individual margin bounds.

function FloorPowerOfTwo(const Value: VectorInt): VectorInt;

Returns the greatest power of two lesser or equal to the specified value.

function IntColor(const Color: TIntColor; const Alpha: Integer): TIntColor; overload; inline;

Creates 32-bit RGBA color with the specified color value, having its alpha-channel multiplied by the specified coefficient and divided by 255.

function IntColor(const Color: TIntColor; const Gray, Alpha: VectorFloat): TIntColor; overload; inline;

Creates 32-bit RGBA color where the original color value has its components multiplied by the given grayscale value and alpha-channel multiplied by the specified coefficient.

function IntColor(const Color: TIntColor; const Alpha: VectorFloat): TIntColor; overload; inline;

Creates 32-bit RGBA color where the specified color value has its alpha-channel multiplied by the given coefficient.

function IntColor(const Color: TIntColor; const Gray, Alpha: Integer): TIntColor; overload; inline;

Creates 32-bit RGBA color where the original color value has its components multiplied by the given grayscale value and alpha-channel multiplied by the specified coefficient, and all components divided by 255.

function IntColorAlpha(const Alpha: Integer): TIntColor; overload; inline;

Creates 32-bit RGBA color with the specified alpha-channel and each of red, green and blue components set to 255.

function IntColorAlpha(const Alpha: VectorFloat): TIntColor; overload; inline;

Creates 32-bit RGBA color with alpha-channel specified by the given coefficient (multiplied by 255) and the rest of components set to 255.

function IntColorGray(const Gray: Integer; const Alpha: Integer = 255): TIntColor; overload; inline;

Creates 32-bit RGBA color using specified grayscale and alpha values.

function IntColorGray(const Gray: VectorFloat; const Alpha: VectorFloat = 1.0): TIntColor; overload; inline;

Creates 32-bit RGBA color using specified grayscale and alpha-channel values (both multiplied by 255).

function IntColorRGB(const Red, Green, Blue: Integer; const Alpha: Integer = 255): TIntColor; overload;

Creates 32-bit RGBA color using specified individual components for red, green, blue and alpha channel.

function IntRect(const Origin, Size: TPoint2i): TIntRect; overload;

Creates rectangle based on top/left position and size.

function IntRect(const Left, Top, Width, Height: VectorInt): TIntRect; overload;

Creates rectangle based on top/left position, width and height.

function IntRectBDS(const TopLeft, BottomRight: TPoint2i): TIntRect; overload;

Creates rectangle based on top/left and bottom/right margin bounds.

function IntRectBDS(const Left, Top, Right, Bottom: VectorInt): TIntRect; overload;

Creates rectangle based on individual margin bounds.

function InvertPixel(const Color: TIntColor): TIntColor;

Inverts each of the components in the pixel, including alpha-channel.

function IsPowerOfTwo(const Value: VectorInt): Boolean;

Returns True if the specified value is a power of two or False otherwise.

function Lerp(const Value1, Value2, Theta: VectorFloat): VectorFloat;

Interpolates between two values linearly, where Theta must be specified in [0..1] range.

function LerpFourPixels(const TopLeft, TopRight, BottomRight, BottomLeft: TIntColor; const AlphaX, AlphaY: VectorFloat): TIntColor;

Computes resulting alpha-blended value between four 32-bit RGBA colors using linear interpolation. AlphaX and AlphaY can be in [0..1] range.

function LerpPixels(const Color1, Color2: TIntColor; const Alpha: VectorFloat): TIntColor;

Computes alpha-blending for a pair of 32-bit RGBA colors values using floating-point approach. For a faster alternative, use BlendPixels. Alpha can be in [0..1] range.

function MultiplyPixels(const Color1, Color2: TIntColor): TIntColor;

Multiplies two 32-bit RGBA color values together.

function PixelToGray(const Color: TIntColor): Integer;

Returns grayscale value in range of [0..255] from the given 32-bit RGBA color value. The resulting value can be considered the color's luma. The alpha-channel is ignored.

function PixelToGray16(const Color: TIntColor): Integer;

Returns grayscale value in range of [0..65535] from the given 32-bit RGBA color value. The resulting value can be considered the color's luma. The alpha-channel is ignored.

function PixelToGrayFloat(const Color: TIntColor): VectorFloat;

Returns grayscale value in range of [0..1] from the given 32-bit RGBA color value. The resulting value can be considered the color's luma. The alpha-channel is ignored.

function Point2f(const X, Y: VectorFloat): TPoint2f; inline;

Creates a TPoint2f record using the specified coordinates.

function Point2i(const X, Y: VectorInt): TPoint2i;

Creates a TPoint2i record using the specified coordinates.

function PremultiplyAlpha(const Color: TIntColor): TIntColor;

Takes 32-bit RGBA color with unpremultiplied alpha and multiplies each of red, green, and blue components by its alpha channel, resulting in premultiplied alpha color.

function Quad(const TopLeftX, TopLeftY, TopRightX, TopRightY, BottomRightX, BottomRightY, BottomLeftX, BottomLeftY: VectorFloat): TQuad; overload;

Creates quadrilateral with individually specified vertex coordinates.

function Quad(const Rect: TFloatRect): TQuad; overload;

Creates quadrilateral rectangle from specified floating-point rectangle.

function Quad(const Rect: TIntRect): TQuad; overload;

Creates quadrilateral rectangle from specified integer rectangle.

function Quad(const TopLeft, TopRight, BottomRight, BottomLeft: TPoint2f): TQuad; overload;

Creates quadrilateral with individually specified vertices.

function Quad(const Left, Top, Width, Height: VectorFloat): TQuad; overload;

Creates quadrilateral rectangle with top/left position, width and height.

function Saturate(const Value, MinLimit, MaxLimit: VectorInt): VectorInt; inline;

Ensures that the given value stays within specified range limit, clamping it if necessary.

function Saturate(const Value, MinLimit, MaxLimit: VectorFloat): VectorFloat; inline;

Ensures that the given value stays within specified range limit, clamping it if necessary.

function SineAccelerate(const Value: VectorFloat): VectorFloat;

Transforms value in range of [0, 1] using sine wave accelerating. The curve starts at 0 with almost zero acceleration, but in the end going almost linearly.

function SineCycle(const Value: VectorFloat): VectorFloat;

Transforms value in range of [0, 1] to go through full cycle (0 -> 1 -> 0). Note that the curve goes from 0 to 1 and then back to 0.

function SineDecelerate(const Value: VectorFloat): VectorFloat;

Transforms value in range of [0, 1] using sine wave decelerating. The curve starts accelerating quickly at 0, but slowly stops at 1.

function SineSymCycle(const Value: VectorFloat): VectorFloat;

Transforms value in range of [0, 1] to go full cycle through sine function (0 -> 1 -> 0 -> -1 -> 0).

function SineTransform(const Value: VectorFloat): VectorFloat;

Transforms value in range of [0, 1] using sine wave (accelerate, decelerate).

function SubtractPixels(const Color1, Color2: TIntColor): TIntColor;

Subtracts two 32-bit RGBA color values clamping the resulting values if necessary.

function UnpremultiplyAlpha(const Color: TIntColor): TIntColor;

Takes 32-bit RGBA color with premultiplied alpha channel and divides each of its red, green, and blue components by alpha, resulting in unpremultiplied alpha color.

function Vector3f(const Point: TPoint2f; const Z: VectorFloat = 0.0): TVector3f; overload; inline;

Creates TVector3f record using 2D vector and specified Z coordinate.

function Vector3f(const X, Y, Z: VectorFloat): TVector3f; overload; inline;

Creates TVector3f record using the specified coordinates.

function Vector3i(const Point: TPoint2i; const Z: VectorInt = 0): TVector3i; overload; inline;

Creates TVector3i record using 2D vector and specified Z coordinate.

function Vector3i(const X, Y, Z: VectorInt): TVector3i; overload; inline;

Creates TVector3i record using the specified coordinates.

function Vector4f(const Point: TPoint2f; const Z: VectorFloat = 0.0; const W: VectorFloat = 1.0): TVector4f; overload; inline;

Creates a TVector4f record using the specified 2D point, Z and W coordinates.

function Vector4f(const X, Y, Z: VectorFloat; const W: VectorFloat = 1.0): TVector4f; overload; inline;

Creates a TVector4f record using the specified X, Y, Z and W coordinates.

function Vector4f(const Vector: TVector3f; const W: VectorFloat = 1.0): TVector4f; overload; inline;

Creates a TVector4f record using the specified 3D vector and W coordinate.

Types

PColorPair = ˆTColorPair;

Pointer to TColorPair.

PColorRect = ˆTColorRect;

Pointer to TColorRect.

PDepthStencil = ˆTDepthStencil;

Pointer to TDepthStencil.

PFloatColor = ˆTFloatColor;

Pointer to TFloatColor.

PFloatRect = ˆTFloatRect;

Pointer to TFloatRect.

PIntColor = ˆTIntColor;

Pointer to TIntColor.

PIntColorPalette = ˆTIntColorPalette;

Pointer to TIntColorPalette.

PIntColorRec = ˆTIntColorRec;

Pointer to TIntColorRec.

PIntColorValue = ˆTIntColorValue;

Pointer to TIntColorValue.

PIntRect = ˆTIntRect;

Pointer to TIntRect.

PMatrix3f = ˆTMatrix3f;

Pointer to TMatrix3f.

PMatrix4f = ˆTMatrix4f;

Pointer to TMatrix4f.

PPixelFormat = ˆTPixelFormat;

This type is used to pass TPixelFormat by reference.

PPoint2f = ˆTPoint2f;

Pointer to TPoint2f.

PPoint2i = ˆTPoint2i;

Pointer to TPoint2i.

PQuad = ˆTQuad;

Pointer to TQuad.

PQuaternion = ˆTQuaternion;

Pointer to TQuaternion.

PVector3f = ˆTVector3f;

Pointer to TVector3f.

PVector3i = ˆTVector3i;

Pointer to TVector3i.

PVector4f = ˆTVector4f;

Pointer to TVector4f.

TAlphaFormatRequest = (...);

Defines how alpha-channel should be handled in the loaded image.

Values
  • DontCare: Alpha-channel can be handled either way.

  • NonPremultiplied: Alpha-channel in the image should not be premultiplied. Under normal circumstances, this is the recommended approach as it preserves RGB color information in its original form. However, when using mipmapping for images that have alpha-channel, Premultiplied gives more accurate results.

  • Premultiplied: Alpha-channel in the image should be premultiplied. Under normal circumstances, this is not recommended as the image would lose information after RGB components are premultiplied by alpha (and for smaller alpha values, less information is preserved). However, when using mipmapping for images that have alpha-channel, this gives more accurate results.
TDepthStencil = (...);

Support level for depth and stencil buffers.

Values
  • None: No depth or stencil buffers should be supported.

  • DepthOnly: Depth but not stencil buffers should be supported.

  • Full: Both depth and stencil buffers should be supported.
TIntColor = LongWord;

General-purpose color value that is represented as 32-bit unsigned integer, with components allocated according to TPixelFormat.A8R8G8B8 format.

TIntColorPalette = array[0..255] of TIntColor;

A fixed palette of 256 colors, typically used to emulate legacy 8-bit indexed modes.

TIntColorValue = LongWord;

Raw (untyped) color value is represented as a raw 32-bit unsigned integer, with components allocated according to TPixelFormat.A8R8G8B8 format.

TPixelFormat = (...);

Defines how individual pixels and their colors are encoded in images and textures. The order of letters in the constants defines the order of the encoded components; R stands for Red, G for Green, B for Blue, A for Alpha, L for Luminance and X for Not Used (or discarded); F at the end means floating-point format.

Values
  • Unknown: Unknown pixel format. It is usually returned when no valid pixel format is available. In some cases, it can be specified to indicate that the format should be selected by default or automatically.

  • A8R8G8B8: 32-bit RGBA pixel format. The most commonly used pixel format for storing and loading textures and images.

  • X8R8G8B8: 32-bit RGB pixel format that has no alpha-channel. Should be used for images and textures that have no transparency information in them.

  • A4R4G4B4: 16-bit RGBA pixel format with 4 bits for each channel. This format can be used as a replacement for A8R8G8B8 format in cases where memory footprint is important at the expense of visual quality.

  • X4R4G4B4: 16-bit RGB pixel format with 4 bits unused. It is basically A4R4G4B4 with alpha-channel discarded. This format is widely supported, but in typical applications it is more convenient to use R5G6B5 instead.

  • R5G6B5: 16-bit RGB pixel format. This format can be used as an alternative to A8R8G8B8 in cases where memory footprint is important at the expense of visual quality.

  • A1R5G5B5: 16-bit RGBA pixel format with one bit dedicated for alpha-channel. This format can be used for images where a transparency mask is used; that is, the pixel is either transparent or not, typical for those images where a single color is picked to be transparent. In this product, there is little need for this format because AlphaTool can be used to generate alpha channel for images with masked color, which then can be used with any other higher-quality format.

  • X1R5G5B5: 16-bit RGB pixel format with only 15 bits used for actual storage. This format was common on legacy hardware but recently it is rarely used or even supported.

  • A2R2G2B2: 8-bit RGBA pixel format that was originally supported by OpenGL in earlier implementations. This format can significantly save disk space and memory consumption (if supported in hardware) but at the expense of very low visual quality.

  • R3G3B2: 8-bit RGB pixel format. An extreme low-quality format useful only in special circumstances and mainly for storage. It is more commonly supported on ATI video cards than on Nvidia, being really scarce on newer hardware.

  • A8R3G3B2: 16-bit RGBA pixel format with uneven bit distribution among the components. It is more supported on AMD video cards and can be rarely found on newer hardware. In many cases it is more useful to use A4R4G4B4 format.

  • A2B10G10R10: 32-bit RGBA pixel format with 10 bits used for each component of red, green and blue, being a higher-quality variant of A8R8G8B8. It is more commonly supported on some video cards than its more practical cousin A2R10G10B10.

  • A16B16G16R16: 64-bit RGBA pixel format with each channel having 16 bits.

  • A8L8: 16-bit luminance pixel format. One of the best formats to be used with bitmap fonts, which is also widely supported.

  • A4L4: 8-bit luminance pixel format. This format can be used as a low quality replacement for A8L8 to represent bitmap fonts.

  • L16: 16-bit luminance pixel format that can be used to represent high-quality grayscale images and textures.

  • L8: 8-bit luminance pixel format. This format can be used for grayscale images and textures.

  • R16F: 16-bit floating-point pixel format, which has only one component. This is useful in shaders either as a render target or as a data source.

  • G16R16F: 32-bit floating-point pixel format containing two components with 16 bits each. This can be used in shaders as a data source.

  • A16B16G16R16F: 64-bit floating-point RGBA pixel format with each component having 16 bits. It can be used as a special purpose texture or a render target with shaders.

  • R32F: 32-bit floating-point pixel format, which has only one component. This format is typically used as render target for shadow mapping.

  • G32R32F: 64-bit floating-point pixel format containing two components with 32 bits each, mainly useful in shaders as a data source.

  • A32B32G32R32F: 128-bit floating-point RGBA pixel format with each component having 32 bits. It can be used as a special purpose texture or a render target with shaders.

  • A8: 8-bit alpha pixel format. This format can be used as an alpha-channel format for applications that require low memory footprint and require transparency information only. Its usefulness, however, is severely limited because it is only supported only on newer video cards and when converted in hardware to A8R8G8B8, it has zero values for red, green and blue components; in other words, it is basically a black color that also has alpha channel.

  • G16R16: 32-bit pixel format that has only green and red components 16 bits each. This format is more useful for shaders where only one or two components are needed but with extra resolution.

  • A2R10G10B10: 32-bit RGBA pixel format with 10 bits used for each component of red, green and blue, with only 2 bits dedicated to alpha channel.

  • X2R10G10B10: 32-bit RGB pixel format with 10 bits used for each component of red, green and blue, with the remaining 2 bits unused (and/or undefined).

  • A8B8G8R8: 32-bit BGRA pixel format. This is similar to A8R8G8B8 format but with red and blue components exchanged.

  • X8B8G8R8: 32-bit BGR pixel format that has no alpha-channel, similar to X8R8G8B8 but with red and blue components exchanged.

  • R8G8B8: 24-bit RGB pixel format. This format can be used for storage and it is unsuitable for rendering both on DirectX and OpenGL.

  • B8G8R8A8: 32-bit ABGR pixel format. This format is common to some MSB configurations such as Apple Carbon interface.

  • B8G8R8X8: 32-bit BGR pixel format that has no alpha-channel. This format is common to some MSB configurations such as the one used by LCL in Apple Carbon interface.

  • I8: 8-bit palette indexed format, where each value points to a list of colors, which was popular in DOS applications.

TStandardNotifyEvent = procedure(const Sender: TObject) of object;

Standard notification event used throughout the framework.

Constants

AxisWVector4: TVector4f = (X: 0.0; Y: 0.0; Z: 0.0; W: 1.0);

Predefined constant, where X = 0, Y = 0, Z = 0 and W = 1.

AxisXPoint2f: TPoint2f = (X: 1.0; Y: 0.0);

Predefined constant, where X = 1 and Y = 0.

AxisXPoint2i: TPoint2i = (X: 1; Y: 0);

Predefined constant, where X = 1 and Y = 0.

AxisXVector3f: TVector3f = (X: 1.0; Y: 0.0; Z: 0.0);

Predefined constant, where X = 1, Y = 0 and Z = 0.

AxisXVector3i: TVector3i = (X: 1; Y: 0; Z: 0);

Predefined constant, where X = 1, Y = 0 and Z = 0.

AxisXVector4: TVector4f = (X: 1.0; Y: 0.0; Z: 0.0; W: 0.0);

Predefined constant, where X = 1, Y = 0, Z = 0 and W = 0.

AxisXVector4H: TVector4f = (X: 1.0; Y: 0.0; Z: 0.0; W: 1.0);

Predefined constant, where X = 1, Y = 0, Z = 0 and W = 1.

AxisYPoint2f: TPoint2f = (X: 0.0; Y: 1.0);

Predefined constant, where X = 0 and Y = 1.

AxisYPoint2i: TPoint2i = (X: 0; Y: 1);

Predefined constant, where X = 0 and Y = 1.

AxisYVector3f: TVector3f = (X: 0.0; Y: 1.0; Z: 0.0);

Predefined constant, where X = 0, Y = 1 and Z = 0.

AxisYVector3i: TVector3i = (X: 0; Y: 1; Z: 0);

Predefined constant, where X = 0, Y = 1 and Z = 0.

AxisYVector4: TVector4f = (X: 0.0; Y: 1.0; Z: 0.0; W: 0.0);

Predefined constant, where X = 0, Y = 1, Z = 0 and W = 0.

AxisYVector4H: TVector4f = (X: 0.0; Y: 1.0; Z: 0.0; W: 1.0);

Predefined constant, where X = 0, Y = 1, Z = 0 and W = 1.

AxisZVector3f: TVector3f = (X: 0.0; Y: 0.0; Z: 1.0);

Predefined constant, where X = 0, Y = 0 and Z = 1.

AxisZVector3i: TVector3i = (X: 0; Y: 0; Z: 1);

Predefined constant, where X = 0, Y = 0 and Z = 1.

AxisZVector4: TVector4f = (X: 0.0; Y: 0.0; Z: 1.0; W: 0.0);

Predefined constant, where X = 0, Y = 0, Z = 1 and W = 0.

AxisZVector4H: TVector4f = (X: 0.0; Y: 0.0; Z: 1.0; W: 1.0);

Predefined constant, where X = 0, Y = 0, Z = 1 and W = 1.

ColorPairBlack: TColorPair = (First: $FF000000; Second: $FF000000);

Predefined constant for a pair of opaque Black colors.

ColorPairTranslucentBlack: TColorPair = (First: $00000000; Second: $00000000);

Predefined constant for a pair of translucent Black colors.

ColorPairTranslucentWhite: TColorPair = (First: $00FFFFFF; Second: $00FFFFFF);

Predefined constant for a pair of translucent White colors.

ColorPairWhite: TColorPair = (First: $FFFFFFFF; Second: $FFFFFFFF);

Predefined constant for a pair of opaque White colors.

ColorRectBlack: TColorRect = (TopLeft: $FF000000; TopRight: $FF000000; BottomRight: $FF000000; BottomLeft: $FF000000);

Predefined constant for four opaque Black colors.

ColorRectTranslucentBlack: TColorRect = (TopLeft: $00000000; TopRight: $00000000; BottomRight: $00000000; BottomLeft: $00000000);

Predefined constant for four translucent Black colors.

ColorRectTranslucentWhite: TColorRect = (TopLeft: $00FFFFFF; TopRight: $00FFFFFF; BottomRight: $00FFFFFF; BottomLeft: $00FFFFFF);

Predefined constant for four translucent White colors.

ColorRectWhite: TColorRect = (TopLeft: $FFFFFFFF; TopRight: $FFFFFFFF; BottomRight: $FFFFFFFF; BottomLeft: $FFFFFFFF);

Predefined constant for four opaque White colors.

FloatColorBlack: TFloatColor = (Red: 0.0; Green: 0.0; Blue: 0.0; Alpha: 1.0);

Predefined constant for opaque Black color.

FloatColorTranslucentBlack: TFloatColor = (Red: 0.0; Green: 0.0; Blue: 0.0; Alpha: 0.0);

Predefined constant for translucent Black color.

FloatColorTranslucentWhite: TFloatColor = (Red: 1.0; Green: 1.0; Blue: 1.0; Alpha: 0.0);

Predefined constant for translucent White color.

FloatColorWhite: TFloatColor = (Red: 1.0; Green: 1.0; Blue: 1.0; Alpha: 1.0);

Predefined constant for opaque White color.

IdentityMatrix3f: TMatrix3f = (Data: ((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)));

Predefined constant with values corresponding to Identity matrix.

IdentityMatrix4f: TMatrix4f = (Data: ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0)));

Predefined constant with values corresponding to Identity matrix.

IdentityQuaternion: TQuaternion = (X: 0.0; Y: 0.0; Z: 0.0; W: 1.0);

Identity quaternion that can be used to specify an object with no rotation.

IntColorBlack = $FF000000;

Predefined constant for opaque Black color.

IntColorTranslucentBlack = $00000000;

Predefined constant for translucent Black color.

IntColorTranslucentWhite = $00FFFFFF;

Predefined constant for translucent White color.

IntColorWhite = $FFFFFFFF;

Predefined constant for opaque White color.

MinusInfinity2i: TPoint2i = (X: Low(VectorInt) + 1; Y: Low(VectorInt) + 1);

Predefined constant for "negative infinity".

PlusInfinity2i: TPoint2i = (X: High(VectorInt); Y: High(VectorInt));

Predefined constant for "positive infinity".

Undefined2i: TPoint2i = (X: Low(VectorInt); Y: Low(VectorInt));

Predefined constant that can be interpreted as "undefined value".

UnityPoint2f: TPoint2f = (X: 1.0; Y: 1.0);

Predefined constant, where X and Y are one.

UnityPoint2i: TPoint2i = (X: 1; Y: 1);

Predefined constant, where X and Y are one.

UnityVector3f: TVector3f = (X: 1.0; Y: 1.0; Z: 1.0);

Predefined constant, where X, Y and Z are one.

UnityVector3i: TVector3i = (X: 1; Y: 1; Z: 1);

Predefined constant, where X, Y and Z are one.

UnityVector4: TVector4f = (X: 1.0; Y: 1.0; Z: 1.0; W: 1.0);

Predefined constant, where all components are one.

ZeroFloatRect: TFloatRect = (Left: 0.0; Top: 0.0; Width: 0.0; Height: 0.0);

Zero (empty) rectangle with floating-point coordinates.

ZeroIntRect: TIntRect = (Left: 0; Top: 0; Width: 0; Height: 0);

Zero (empty) rectangle with integer coordinates.

ZeroMatrix3f: TMatrix3f = (Data: ((0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0)));

Predefined constant, where all matrix values are zero.

ZeroMatrix4f: TMatrix4f = (Data: ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)));

Predefined constant, where all matrix values are zero.

ZeroPoint2f: TPoint2f = (X: 0.0; Y: 0.0);

Predefined constant, where X and Y are zero.

ZeroPoint2i: TPoint2i = (X: 0; Y: 0);

Predefined constant, where X and Y are zero.

ZeroVector3f: TVector3f = (X: 0.0; Y: 0.0; Z: 0.0);

Predefined constant, where X, Y and Z are zero.

ZeroVector3i: TVector3i = (X: 0; Y: 0; Z: 0);

Predefined constant, where X, Y and Z are zero.

ZeroVector4: TVector4f = (X: 0.0; Y: 0.0; Z: 0.0; W: 0.0);

Predefined constant, where all components are zero.

ZeroVector4H: TVector4f = (X: 0.0; Y: 0.0; Z: 0.0; W: 1.0);

Predefined constant, where X, Y and Z are zero, while W = 1.


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.