PixelFormat enum

The memory layout of the texels in a Texture.

Each name spells out the texture's components in order, the bit width of each component, and how those bits are interpreted. For example, r8g8b8a8UNormInt is a 32 bit per pixel format with four 8 bit components ordered red, green, blue, alpha, each stored as an unsigned normalized integer.

Component key:

  • r, g, b: the red, green, and blue color components.
  • a: the alpha component.
  • d: the depth component.
  • s: the stencil component.
  • UNorm: an unsigned integer that is mapped from the range [0, 2^bits - 1] onto the floating point range [0.0, 1.0] when read.
  • UInt: an unsigned integer that is read without normalization.
  • Float: an IEEE 754 floating point value.
  • SRGB: the color components are stored in the sRGB color space and are converted to and from linear space when read and written.

The block-compressed formats are named after their compression scheme (BC, ETC2, or ASTC) and block dimensions. See PixelFormatProperties for block geometry and TextureCompressionFamily for how hardware support is grouped.

Inheritance
Available extensions

Values

unknown → const PixelFormat

An invalid or unspecified format.

Used as a placeholder and never as the format of a real texture.

a8UNormInt → const PixelFormat

A single 8 bit alpha component, stored as an unsigned normalized integer.

r8UNormInt → const PixelFormat

A single 8 bit red component, stored as an unsigned normalized integer.

r8g8UNormInt → const PixelFormat

Two 8 bit components (red, green), stored as unsigned normalized integers.

r8g8b8a8UNormInt → const PixelFormat

Four 8 bit components (red, green, blue, alpha), stored as unsigned normalized integers.

This is the most common 32 bit per pixel color format and the default for GpuContext.createTexture.

r8g8b8a8UNormIntSRGB → const PixelFormat

Like r8g8b8a8UNormInt, but the color components are stored in the sRGB color space.

b8g8r8a8UNormInt → const PixelFormat

Four 8 bit components ordered blue, green, red, alpha, stored as unsigned normalized integers.

b8g8r8a8UNormIntSRGB → const PixelFormat

Like b8g8r8a8UNormInt, but the color components are stored in the sRGB color space.

r32g32b32a32Float → const PixelFormat

Four 32 bit floating point components (red, green, blue, alpha), for a total of 128 bits per pixel.

r16g16b16a16Float → const PixelFormat

Four 16 bit (half precision) floating point components (red, green, blue, alpha), for a total of 64 bits per pixel.

r32Float → const PixelFormat

A single-channel 32-bit floating-point pixel format.

s8UInt → const PixelFormat

A single 8 bit stencil component, stored as an unsigned integer.

d24UnormS8Uint → const PixelFormat

A 24 bit depth component stored as an unsigned normalized integer, packed together with an 8 bit unsigned integer stencil component.

d32FloatS8UInt → const PixelFormat

A 32 bit floating point depth component, packed together with an 8 bit unsigned integer stencil component.

bc1RGBAUNormInt → const PixelFormat

BC1 RGBA, 4x4 blocks, 8 bytes per block. Desktop BC family.

bc1RGBAUNormIntSRGB → const PixelFormat

BC1 RGBA sRGB, 4x4 blocks, 8 bytes per block. Desktop BC family.

bc3RGBAUNormInt → const PixelFormat

BC3 RGBA, 4x4 blocks, 16 bytes per block. Desktop BC family.

bc3RGBAUNormIntSRGB → const PixelFormat

BC3 RGBA sRGB, 4x4 blocks, 16 bytes per block. Desktop BC family.

bc5RGUNormInt → const PixelFormat

BC5 RG, 4x4 blocks, 16 bytes per block. Desktop BC family.

bc7RGBAUNormInt → const PixelFormat

BC7 RGBA, 4x4 blocks, 16 bytes per block. Desktop BC family.

bc7RGBAUNormIntSRGB → const PixelFormat

BC7 RGBA sRGB, 4x4 blocks, 16 bytes per block. Desktop BC family.

etc2RGB8UNormInt → const PixelFormat

ETC2 RGB8, 4x4 blocks, 8 bytes per block. Mobile ETC2 family.

etc2RGB8UNormIntSRGB → const PixelFormat

ETC2 RGB8 sRGB, 4x4 blocks, 8 bytes per block. Mobile ETC2 family.

etc2RGBA8UNormInt → const PixelFormat

ETC2 RGBA8, 4x4 blocks, 16 bytes per block. Mobile ETC2 family.

etc2RGBA8UNormIntSRGB → const PixelFormat

ETC2 RGBA8 sRGB, 4x4 blocks, 16 bytes per block. Mobile ETC2 family.

astc4x4LDR → const PixelFormat

ASTC LDR, 4x4 blocks, 16 bytes per block. Modern mobile ASTC family.

astc4x4LDRSRGB → const PixelFormat

ASTC LDR sRGB, 4x4 blocks, 16 bytes per block. Modern mobile ASTC family.

astc8x8LDR → const PixelFormat

ASTC LDR, 8x8 blocks, 16 bytes per block. Modern mobile ASTC family.

astc8x8LDRSRGB → const PixelFormat

ASTC LDR sRGB, 8x8 blocks, 16 bytes per block. Modern mobile ASTC family.

astc4x4HDR → const PixelFormat

ASTC HDR, 4x4 blocks, 16 bytes per block. Modern mobile ASTC HDR family. HDR samples are linear floating point, so there is no sRGB variant.

astc8x8HDR → const PixelFormat

ASTC HDR, 8x8 blocks, 16 bytes per block. Modern mobile ASTC HDR family. HDR samples are linear floating point, so there is no sRGB variant.

Properties

blockHeight int

Available on PixelFormat, provided by the PixelFormatProperties extension

The height, in texels, of a single block. Uncompressed formats return 1.
no setter
blockWidth int

Available on PixelFormat, provided by the PixelFormatProperties extension

The width, in texels, of a single block. Uncompressed formats return 1.
no setter
bytesPerBlock int

Available on PixelFormat, provided by the PixelFormatProperties extension

The number of bytes used to store one block. For uncompressed formats a block is a single texel, so this matches the bytes per texel.
no setter
compressionFamily TextureCompressionFamily?

Available on PixelFormat, provided by the PixelFormatProperties extension

The compression family this format belongs to. Returns null for uncompressed formats.
no setter
hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
isCompressed bool

Available on PixelFormat, provided by the PixelFormatProperties extension

Whether this is a block-compressed pixel format.
no setter
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<PixelFormat>
A constant List of the values in this enum, in order of their declaration.