Skip to content

TSdlPixelFormatDetails

Details about the format of a pixel.

Definition

Unit: Neslib.Sdl3.Video

type TSdlPixelFormatDetails = record ... end;

Properties

Name Description
ABits
AMask
AShift
BBits
BitsPerPixel
BMask
BShift
BytesPerPixel
Format
GBits
GMask
GShift
RBits
RMask
RShift

Methods

Name Description
GetRgb(Cardinal, TSdlPalette, Byte, Byte, Byte)
GetRgb(Cardinal, Byte, Byte, Byte) Get RGB values from a pixel in this format.
GetRgba(Cardinal, TSdlPalette, Byte, Byte, Byte, Byte)
GetRgba(Cardinal, Byte, Byte, Byte, Byte) Get RGBA values from a pixel in the specified format.
MapRgb(TSdlPalette, Byte, Byte, Byte)
MapRgb(Byte, Byte, Byte) Map an RGB triple to an opaque pixel value for this given pixel format.
MapRgba(TSdlPalette, Byte, Byte, Byte, Byte)
MapRgba(Byte, Byte, Byte, Byte) Map an RGBA quadruple to a pixel value for this pixel format.

Property Descriptions

ABits

property ABits: Byte read FHandle.Abits

Type: Byte


AMask

property AMask: Cardinal read FHandle.Amask

Type: Cardinal


AShift

property AShift: Byte read FHandle.Ashift

Type: Byte


BBits

property BBits: Byte read FHandle.Bbits

Type: Byte


BitsPerPixel

property BitsPerPixel: Byte read FHandle.bits_per_pixel

Type: Byte


BMask

property BMask: Cardinal read FHandle.Bmask

Type: Cardinal


BShift

property BShift: Byte read FHandle.Bshift

Type: Byte


BytesPerPixel

property BytesPerPixel: Byte read FHandle.bytes_per_pixel

Type: Byte


Format

property Format: TSdlPixelFormat read GetFormat

Type: TSdlPixelFormat


GBits

property GBits: Byte read FHandle.Gbits

Type: Byte


GMask

property GMask: Cardinal read FHandle.Gmask

Type: Cardinal


GShift

property GShift: Byte read FHandle.Gshift

Type: Byte


RBits

property RBits: Byte read FHandle.Rbits

Type: Byte


RMask

property RMask: Cardinal read FHandle.Rmask

Type: Cardinal


RShift

property RShift: Byte read FHandle.Rshift

Type: Byte


Method Descriptions

GetRgb(Cardinal, TSdlPalette, Byte, Byte, Byte)

procedure GetRgb(const APixel: Cardinal; const APalette: TSdlPalette; out AR, AG, AB: Byte); overload; inline

Parameters

APixel: Cardinal

APalette: TSdlPalette

AR: Byte

AG: Byte

AB: Byte


GetRgb(Cardinal, Byte, Byte, Byte)

Get RGB values from a pixel in this format.

This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [$ff, $ff, $ff] not [$f8, $fc, $f8]).

procedure GetRgb(const APixel: Cardinal; out AR, AG, AB: Byte); overload; inline

Parameters

APixel: Cardinal : A pixel value.

AR: Byte : Is set to the red component.

AG: Byte : Is set to the green component.

AB: Byte : Is set to the blue component.

See Also

Remarks

It is safe to call this method from any thread, as long as the palette is not modified.


GetRgba(Cardinal, TSdlPalette, Byte, Byte, Byte, Byte)

procedure GetRgba(const APixel: Cardinal; const APalette: TSdlPalette; out AR, AG, AB, AA: Byte); overload; inline

Parameters

APixel: Cardinal

APalette: TSdlPalette

AR: Byte

AG: Byte

AB: Byte

AA: Byte


GetRgba(Cardinal, Byte, Byte, Byte, Byte)

Get RGBA values from a pixel in the specified format.

This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [$ff, $ff, $ff] not [$f8, $fc, $f8]).

If the surface has no alpha component, the alpha will be returned as $ff (100% opaque).

procedure GetRgba(const APixel: Cardinal; out AR, AG, AB, AA: Byte); overload; inline

Parameters

APixel: Cardinal : A pixel value.

AR: Byte : Is set to the red component.

AG: Byte : Is set to the green component.

AB: Byte : Is set to the blue component.

AA: Byte : Is set to the alpha component.

See Also

Remarks

It is safe to call this method from any thread, as long as the palette is not modified.


MapRgb(TSdlPalette, Byte, Byte, Byte)

function MapRgb(const APalette: TSdlPalette; const AR, AG, AB: Byte): Cardinal; overload; inline

Parameters

APalette: TSdlPalette

AR: Byte

AG: Byte

AB: Byte

Returns

Cardinal


MapRgb(Byte, Byte, Byte)

Map an RGB triple to an opaque pixel value for this given pixel format.

This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.

If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque).

If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a UInt16, and similarly a UInt8 for an 8-bpp format).

function MapRgb(const AR, AG, AB: Byte): Cardinal; overload; inline

Parameters

AR: Byte : The red component of the pixel in the range 0-255.

AG: Byte : The green component of the pixel in the range 0-255.

AB: Byte : The blue component of the pixel in the range 0-255.

Returns

Cardinal: A pixel value.

See Also

Remarks

It is safe to call this method from any thread, as long as the palette is not modified.


MapRgba(TSdlPalette, Byte, Byte, Byte, Byte)

function MapRgba(const APalette: TSdlPalette; const AR, AG, AB, AA: Byte): Cardinal; overload; inline

Parameters

APalette: TSdlPalette

AR: Byte

AG: Byte

AB: Byte

AA: Byte

Returns

Cardinal


MapRgba(Byte, Byte, Byte, Byte)

Map an RGBA quadruple to a pixel value for this pixel format.

This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.

If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).

If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a UInt16, and similarly a UInt8 for an 8-bpp format).

function MapRgba(const AR, AG, AB, AA: Byte): Cardinal; overload; inline

Parameters

AR: Byte : The red component of the pixel in the range 0-255.

AG: Byte : The green component of the pixel in the range 0-255.

AB: Byte : The blue component of the pixel in the range 0-255.

AA: Byte : The alpha component of the pixel in the range 0-255.

Returns

Cardinal: A pixel value.

See Also

Remarks

It is safe to call this method from any thread, as long as the palette is not modified.