Packed Record TBGRAPixel

Unit

Declaration

type TBGRAPixel = packed record

Description

Each pixel is a sequence of 4 bytes containing blue, green, red and alpha channel. Values range from 0 to 255, color is in sRGB colorspace. The alpha value of 0 is transparent and 255 is opaque. In the bitmap data, when the pixel is fully transparent, the RGB values are supposed to be set to zero.

Overview

Fields

Public blue: byte;
Public green: byte;
Public red: byte;
Public alpha: byte;

Methods

Public function EqualsExactly(constref AColor: TBGRAPixel): boolean;
Public function ToColor: TColor;
Public function ToFPColor: TFPColor;
Public function ToGrayscale(AGammaCorrection: boolean = true): TBGRAPixel;
Public function ToString: string;
Public procedure FromColor(AColor: TColor; AAlpha: Byte = 255);
Public procedure FromFPColor(AColor: TFPColor);
Public procedure FromRGB(ARed,AGreen,ABlue: Byte; AAlpha: Byte = 255);
Public procedure FromString(AStr: string);
Public procedure ToRGB(out ARed,AGreen,ABlue,AAlpha: Byte); overload;
Public procedure ToRGB(out ARed,AGreen,ABlue: Byte); overload;
Public class Operator := (Source: TColor): TBGRAPixel;
Public class Operator := (Source: TBGRAPixel): TColor;

Properties

Public property Intensity: word read GetClassIntensity write SetClassIntensity;
Public property Lightness: word read GetClassLightness write SetClassLightness;

Description

Fields

Public blue: byte;

Channels if ordered BGRA ordered

Public green: byte;

Channels if ordered BGRA ordered

Public red: byte;

Channels if ordered BGRA ordered

Public alpha: byte;

Channels if ordered BGRA ordered

Methods

Public function EqualsExactly(constref AColor: TBGRAPixel): boolean;

Check whether all channels are equal (this is generally not necessary to use this fonction unless the RGB value of a transparent color matter)

Public function ToColor: TColor;

Converts to TColor

Public function ToFPColor: TFPColor;

Converts to TFPColor (16-bit per channel)

Public function ToGrayscale(AGammaCorrection: boolean = true): TBGRAPixel;

Compute grayscale equivalent

Public function ToString: string;

Converts to a CSS string representation

Public procedure FromColor(AColor: TColor; AAlpha: Byte = 255);

Sets the pixel with given TColor

Public procedure FromFPColor(AColor: TFPColor);

Sets the pixel with given TFPColor (16-bit per channel)

Public procedure FromRGB(ARed,AGreen,ABlue: Byte; AAlpha: Byte = 255);

Sets the pixel with given RGB values

Public procedure FromString(AStr: string);

Sets the pixel according to a color name or CSS expression

Public procedure ToRGB(out ARed,AGreen,ABlue,AAlpha: Byte); overload;

Extras RGBA channels

Public procedure ToRGB(out ARed,AGreen,ABlue: Byte); overload;

Extras RGB channels

Public class Operator := (Source: TColor): TBGRAPixel;

Assign a TColor to a TBGRAPixel

Public class Operator := (Source: TBGRAPixel): TColor;

Assign a TBGRAPixel to a TColor

Properties

Public property Intensity: word read GetClassIntensity write SetClassIntensity;

Intensity of the color (how much channels are saturated)

Public property Lightness: word read GetClassLightness write SetClassLightness;

Lightness of the color (the resulting lightness of combined channels)