![]() |
ezEngine Release 26.3
|
Comprehensive enumeration of all supported pixel formats with utility functions. More...
#include <ImageFormat.h>
Static Public Member Functions | |
| static const char * | GetName (Enum format) |
| Returns the name of the given format. | |
| static ezUInt32 | GetPlaneCount (Enum format) |
| Returns number of planes in the format, or 1 for non-planar formats. | |
| static ezUInt32 | GetBitsPerPixel (Enum format, ezUInt32 uiPlaneIndex=0) |
| Returns the number of bits per pixel of the given format. If the format's bpp is non-integral, the returned value rounded up to to the next integer. | |
| static float | GetExactBitsPerPixel (Enum format, ezUInt32 uiPlaneIndex=0) |
| Exact pixel size in bits. May be non-integral for some compressed formats. | |
| static ezUInt32 | GetBitsPerBlock (Enum format, ezUInt32 uiPlaneIndex=0) |
| Returns the block size in bits. For uncompressed formats, a block is considered a single pixel. | |
| static ezUInt32 | GetNumChannels (Enum format) |
| Number of channels (r, g, b, a, depth, stencil) supported by this format. | |
| static ezUInt32 | GetChannelMask (Enum format, ezImageFormatChannel::Enum c) |
| Bitmask of each channel of the format. This is not defined for some formats, and may return 0. | |
| static ezUInt32 | GetBitsPerChannel (Enum format, ezImageFormatChannel::Enum c) |
| Returns the number of bits for each channel of the format. | |
| static ezUInt32 | GetRedMask (Enum format) |
| If applicable, returns a bitmask for the red component of the format. | |
| static ezUInt32 | GetGreenMask (Enum format) |
| If applicable, returns a bitmask for the green component of the format. | |
| static ezUInt32 | GetBlueMask (Enum format) |
| If applicable, returns a bitmask for the blue component of the format. | |
| static ezUInt32 | GetAlphaMask (Enum format) |
| If applicable, returns a bitmask for the alpha component of the format. | |
| static ezUInt32 | GetBlockWidth (Enum format, ezUInt32 uiPlaneIndex=0) |
| Block width of a compressed format. Defaults to 1 for uncompressed formats. | |
| static ezUInt32 | GetBlockHeight (Enum format, ezUInt32 uiPlaneIndex=0) |
| Block height of a compressed format. Defaults to 1 for uncompressed formats. | |
| static ezUInt32 | GetBlockDepth (Enum format, ezUInt32 uiPlaneIndex=0) |
| Block depth of a compressed format. Defaults to 1 for uncompressed formats. | |
| static ezImageFormatDataType::Enum | GetDataType (Enum format) |
| Returns the data type represented by a format. | |
| static bool | IsCompressed (Enum format) |
| Returns true if the format is compressed. | |
| static bool | IsDepth (Enum format) |
| Returns true if the format is a depth format. | |
| static bool | IsSrgb (Enum format) |
| Returns whether the given format is an sRGB format. | |
| static bool | IsStencil (Enum format) |
| Returns true if the format is a stencil format. | |
| static Enum | AsSrgb (Enum format) |
| Returns the corresponding sRGB format if one exists; otherwise returns the unmodified format. | |
| static Enum | AsLinear (Enum format) |
| Returns the corresponding linear format if one exists; otherwise returns the unmodified format. | |
| static ezUInt32 | GetNumBlocksX (Enum format, ezUInt32 uiWidth, ezUInt32 uiPlaneIndex=0) |
| Computes the number of blocks in X direction (compressed) or pixels (if uncompressed) for a given width (in pixels). | |
| static ezUInt32 | GetNumBlocksY (Enum format, ezUInt32 uiHeight, ezUInt32 uiPlaneIndex=0) |
| Computes the number of blocks in Y direction (compressed) or pixels (if uncompressed) for a given height (in pixels). | |
| static ezUInt32 | GetNumBlocksZ (Enum format, ezUInt32 uiDepth, ezUInt32 uiPlaneIndex=0) |
| Computes the number of blocks in Z direction (compressed) or pixels (if uncompressed) for a given height (in pixels). | |
| static ezUInt64 | GetRowPitch (Enum format, ezUInt32 uiWidth, ezUInt32 uiPlaneIndex=0) |
| Computes the size in bytes of a row of blocks (compressed) or pixels (if uncompressed) of the given width. | |
| static ezUInt64 | GetDepthPitch (Enum format, ezUInt32 uiWidth, ezUInt32 uiHeight, ezUInt32 uiPlaneIndex=0) |
| Computes the size in bytes of a 2D slice of blocks (compressed) or pixels (if uncompressed) of the given width and height. | |
| static ezImageFormatType::Enum | GetType (Enum format) |
| Returns the type of the image format. | |
| static ezImageFormat::Enum | FromPixelMask (ezUInt32 uiRedMask, ezUInt32 uiGreenMask, ezUInt32 uiBlueMask, ezUInt32 uiAlphaMask, ezUInt32 uiBitsPerPixel) |
| Finds a format matching the given component masks. | |
| static ezImageFormat::Enum | GetPlaneSubFormat (ezImageFormat::Enum format, ezUInt32 uiPlaneIndex) |
| Returns the format of a subplane of a given format. | |
| static bool | IsCompatible (Enum left, Enum right) |
| Returns true if the data formats are compatible, i.e. can be copied into one another. | |
| static bool | RequiresFirstLevelBlockAlignment (Enum format) |
| Returns true if the most high-res miplevel requires block alignment. | |
Comprehensive enumeration of all supported pixel formats with utility functions.
This struct provides both format enumeration and extensive utility functions for working with different pixel formats. It handles format conversion queries, memory layout calculations, and format property inspection.
Format Categories:
Common Usage Patterns:
Block Compressed Formats: Block compressed formats store pixels in fixed-size blocks (4x4 for BC formats, variable for ASTC). This provides significant memory savings but requires special handling during processing.
Planar Formats: Planar formats like NV12 store different channels in separate memory planes. For example, NV12 has a luma (Y) plane and an interleaved chroma (UV) plane. Use GetPlaneSubFormat() to get the format description for individual planes.
|
static |
Returns the name of the given format.
The returned string is guaranteed to be stable across engine versions and thus suitable for serialization.