Class PixelFormatExtensions
Extensions to PixelFormat.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Graphics/PixelFormatExtensions.h
Syntax
public class PixelFormatExtensions
Methods
AlphaSizeInBits(PixelFormat format)
Calculate the size of the alpha channel in bits depending on the pixel format.
Declaration
public static int32 AlphaSizeInBits(PixelFormat format)
Parameters
|
PixelFormat
format
The pixel format |
Returns
|
int32
The size in bits |
ComputeBlockSize(PixelFormat format)
Computes the amount of pixels per-axis stored in the a single block of the format (eg. 4 for BC-family). Returns 1 for uncompressed formats.
Declaration
public static int32 ComputeBlockSize(PixelFormat format)
Parameters
|
PixelFormat
format
The PixelFormat. |
Returns
|
int32
The block pixels count. |
ComputeComponentsCount(PixelFormat format)
Computes the format components count (number of R, G, B, A channels).
Declaration
public static int32 ComputeComponentsCount(PixelFormat format)
Parameters
|
PixelFormat
format
The PixelFormat. |
Returns
|
int32
The components count. |
FindDepthStencilFormat(PixelFormat format)
Declaration
public static PixelFormat FindDepthStencilFormat(PixelFormat format)
Parameters
|
PixelFormat
format
|
Returns
|
PixelFormat
|
FindShaderResourceFormat(PixelFormat format, bool sRGB)
Declaration
public static PixelFormat FindShaderResourceFormat(PixelFormat format, bool sRGB)
Parameters
|
PixelFormat
format
|
|
bool
sRGB
|
Returns
|
PixelFormat
|
FindUncompressedFormat(PixelFormat format)
Declaration
public static PixelFormat FindUncompressedFormat(PixelFormat format)
Parameters
|
PixelFormat
format
|
Returns
|
PixelFormat
|
FindUnorderedAccessFormat(PixelFormat format)
Declaration
public static PixelFormat FindUnorderedAccessFormat(PixelFormat format)
Parameters
|
PixelFormat
format
|
Returns
|
PixelFormat
|
HasAlpha(const PixelFormat format)
Determines whether the specified PixelFormat contains alpha channel.
Declaration
public static bool HasAlpha(const PixelFormat format)
Parameters
|
PixelFormat
format
The Pixel Format. |
Returns
|
bool
|
HasStencil(PixelFormat format)
Determines whether the specified PixelFormat has stencil bits.
Declaration
public static bool HasStencil(PixelFormat format)
Parameters
|
PixelFormat
format
The Pixel Format. |
Returns
|
bool
|
Init()
Initializes cache.
Declaration
public static void Init()
IsBGRAOrder(PixelFormat format)
Determines whether the specified format is in BGRA order.
Declaration
public static bool IsBGRAOrder(PixelFormat format)
Parameters
|
PixelFormat
format
The format. |
Returns
|
bool
|
IsCompressed(PixelFormat format)
Returns true if the PixelFormat is a compressed format.
Declaration
public static bool IsCompressed(PixelFormat format)
Parameters
|
PixelFormat
format
The format to check for compressed. |
Returns
|
bool
True if the PixelFormat is a compressed format. |
IsCompressedASTC(PixelFormat format)
Returns true if the PixelFormat is a compressed format from ASTC formats family (various block sizes).
Declaration
public static bool IsCompressedASTC(PixelFormat format)
Parameters
|
PixelFormat
format
The format to check for compressed. |
Returns
|
bool
True if the PixelFormat is a compressed format from ASTC formats family. |
IsCompressedBC(PixelFormat format)
Returns true if the PixelFormat is a compressed format from BC formats family (BC1, BC2, BC3, BC4, BC5, BC6H, BC7).
Declaration
public static bool IsCompressedBC(PixelFormat format)
Parameters
|
PixelFormat
format
The format to check for compressed. |
Returns
|
bool
True if the PixelFormat is a compressed format from BC formats family. |
IsDepthStencil(PixelFormat format)
Determines whether the specified PixelFormat is depth stencil.
Declaration
public static bool IsDepthStencil(PixelFormat format)
Parameters
|
PixelFormat
format
The Pixel Format. |
Returns
|
bool
|
IsHDR(PixelFormat format)
Determines whether the specified PixelFormat is HDR (either 16 or 32bits Float)
Declaration
public static bool IsHDR(PixelFormat format)
Parameters
|
PixelFormat
format
The format. |
Returns
|
bool
|
IsInteger(PixelFormat format)
Determines whether the specified format is integer data type (signed or unsigned).
Declaration
public static bool IsInteger(PixelFormat format)
Parameters
|
PixelFormat
format
The PixelFormat. |
Returns
|
bool
True if given format contains integer data type (signed or unsigned), otherwise false. |
IsNormalized(PixelFormat format)
Determines whether the specified format contains normalized data. It indicates that values stored in an integer format are to be mapped to the range [-1,1] (for signed values) or [0,1] (for unsigned values) when they are accessed and converted to floating point.
Declaration
public static bool IsNormalized(PixelFormat format)
Parameters
|
PixelFormat
format
The PixelFormat. |
Returns
|
bool
True if given format contains normalized data type, otherwise false. |
IsRgbAOrder(PixelFormat format)
Determines whether the specified format is in RGBA order.
Declaration
public static bool IsRgbAOrder(PixelFormat format)
Parameters
|
PixelFormat
format
The format. |
Returns
|
bool
|
IsSRGB(PixelFormat format)
Determines whether the specified PixelFormat is a sRGB format.
Declaration
public static bool IsSRGB(PixelFormat format)
Parameters
|
PixelFormat
format
The PixelFormat. |
Returns
|
bool
|
IsTypeless(PixelFormat format, bool partialTypeless=true)
Determines whether the specified PixelFormat is Typeless.
Declaration
public static bool IsTypeless(PixelFormat format, bool partialTypeless=true)
Parameters
|
PixelFormat
format
The PixelFormat. |
|
bool
partialTypeless
Enable/disable partially typeless formats. |
Returns
|
bool
|
IsValid(PixelFormat format)
Returns true if the PixelFormat is valid.
Declaration
public static bool IsValid(PixelFormat format)
Parameters
|
PixelFormat
format
A format to validate |
Returns
|
bool
True if the PixelFormat is valid. |
IsVideo(PixelFormat format)
Determines whether the specified PixelFormat is video.
Declaration
public static bool IsVideo(PixelFormat format)
Parameters
|
PixelFormat
format
The PixelFormat. |
Returns
|
bool
|
MakeTypeless(PixelFormat format)
Converts the format to typeless.
Declaration
public static PixelFormat MakeTypeless(PixelFormat format)
Parameters
|
PixelFormat
format
The format. |
Returns
|
PixelFormat
The typeless format. |
MakeTypelessFloat(PixelFormat format)
Converts the typeless format to float.
Declaration
public static PixelFormat MakeTypelessFloat(PixelFormat format)
Parameters
|
PixelFormat
format
The typeless format. |
Returns
|
PixelFormat
The float format. |
MakeTypelessUNorm(PixelFormat format)
Converts the typeless format to unorm.
Declaration
public static PixelFormat MakeTypelessUNorm(PixelFormat format)
Parameters
|
PixelFormat
format
The typeless format. |
Returns
|
PixelFormat
The unorm format. |
SizeInBits(PixelFormat format)
Calculates the size of a PixelFormat in bits.
Declaration
public static int32 SizeInBits(PixelFormat format)
Parameters
|
PixelFormat
format
The pixel format. |
Returns
|
int32
The size in bits |
SizeInBytes(const PixelFormat format)
Calculates the size of a PixelFormat in bytes.
Declaration
public static int32 SizeInBytes(const PixelFormat format)
Parameters
|
PixelFormat
format
The Pixel format. |
Returns
|
int32
size of in bytes |
ToNonsRGB(PixelFormat format)
Finds the equivalent non sRGB format to the provided sRGB format.
Declaration
public static PixelFormat ToNonsRGB(PixelFormat format)
Parameters
|
PixelFormat
format
The non sRGB format. |
Returns
|
PixelFormat
The equivalent non sRGB format if any, the provided format else. |
TosRGB(PixelFormat format)
Finds the equivalent sRGB format to the provided format.
Declaration
public static PixelFormat TosRGB(PixelFormat format)
Parameters
|
PixelFormat
format
The non sRGB format. |
Returns
|
PixelFormat
The equivalent sRGB format if any, the provided format else. |