FMX.Types.TPixelFormat

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

TPixelFormat = (None, RGB, RGBA, BGR, BGRA, RGBA16, BGR_565, BGRA4, BGR4, BGR5_A1, BGR5, BGR10_A2, RGB10_A2, L, LA,
LA4, L16, A, R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F);

C++

enum class DECLSPEC_DENUM TPixelFormat : unsigned int { None, RGB, RGBA, BGR, BGRA, RGBA16, BGR_565, BGRA4, BGR4, BGR5_A1, BGR5, BGR10_A2, RGB10_A2, L, LA, LA4, L16, A, R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F };

Properties

Type Visibility Source Unit Parent
enum public
FMX.Types.pas
FMX.Types.hpp
FMX.Types FMX.Types

Description

Specifies how color and data are encoded for each pixel in a bitmap or a texture.

TPixelFormat defines the number of bits and the physical order of color channels used to describe one pixel.

The FMX.PixelFormats unit has been refactored and is now part of FMX.Types (FMX.Types.TPixelFormat). The values for the new TPixelFormat are different (shorter and fewer) than the values for FMX.PixelFormats.TPixelFormat.

Here is the logic to interpret the enumerations:

  • The order of letters in enumeration is the physical order of channels:
    • "R" means Red.
    • "G" means Green.
    • "B" means Blue.
    • "L" means Luminance.
    • "A" means Alpha.
  • If there is no number at the end, each component has 8 bits.
    Example: RGB means 8 bits for red, 8 bits for green, and 8 bits for blue.
  • If there is a number at the end, this number of bits corresponds to each of channels.
    Example: RGBA16 means 16 bits for each of the red, green, blue, and alpha channels, with 64 bits in total (16 + 16 + 16 + 16).
  • The total number of bits is rounded up to either 8, 16, 32, or 64 bits.
    Example: RGB (8 + 8 + 8 = 24) has 32 bits (rounded up to 32).
  • If there is "F" at the end, this is a floating-point pixel format. Otherwise, it is an integer format.
    In FireMonkey, we typically assume that all integer formats are treated as unsigned integer "normalized" formats (that is, lowest and highest integer values are mapped to 0.0 - 1.0 range in shaders).
    Exceptions to the above rules:
I) BGR_565 is a 16-bit format with 5 bits for the Blue and Red channels, and 6 bits for Green channel.
II) BGR5_A1 is a 16-bit format with 5 bits for each of the Red, Green, and Blue, and 1 bit for the Alpha channel.
III) BGR10_A2 is a 32-bit format with 10 bits for each of the Red, Green and Blue, and 2 bits for the Alpha channel.
IV) RGB10_A2 is the same as above (but the physical order of RGB channels is inverse).


To work with and convert between different pixel formats, use the following routines from FMX.Types:

See Also