Class PixelFormatExtensions
Extensions to PixelFormat.
Inheritance
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public static class PixelFormatExtensions : Object
Methods
AlphaSizeInBits(PixelFormat)
Calculate the size of the alpha channel in bits depending on the pixel format.
Declaration
[Unmanaged]
public static int AlphaSizeInBits(PixelFormat format)
Parameters
PixelFormat
format
The pixel format |
Returns
System.Int32
The size in bits |
ComputeBlockSize(PixelFormat)
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
[Unmanaged]
public static int ComputeBlockSize(PixelFormat format)
Parameters
PixelFormat
format
The PixelFormat. |
Returns
System.Int32
The block pixels count. |
ComputeComponentsCount(PixelFormat)
Computes the format components count (number of R, G, B, A channels).
Declaration
[Unmanaged]
public static int ComputeComponentsCount(PixelFormat format)
Parameters
PixelFormat
format
The PixelFormat. |
Returns
System.Int32
The components count. |
HasAlpha(PixelFormat)
Determines whether the specified PixelFormat contains alpha channel.
Declaration
[Unmanaged]
public static bool HasAlpha(PixelFormat format)
Parameters
PixelFormat
format
The Pixel Format. |
Returns
System.Boolean
|
HasStencil(PixelFormat)
Determines whether the specified PixelFormat has stencil bits.
Declaration
[Unmanaged]
public static bool HasStencil(PixelFormat format)
Parameters
PixelFormat
format
The Pixel Format. |
Returns
System.Boolean
|
IsBGRAOrder(PixelFormat)
Determines whether the specified format is in BGRA order.
Declaration
[Unmanaged]
public static bool IsBGRAOrder(PixelFormat format)
Parameters
PixelFormat
format
The format. |
Returns
System.Boolean
|
IsCompressed(PixelFormat)
Returns true if the PixelFormat is a compressed format.
Declaration
[Unmanaged]
public static bool IsCompressed(PixelFormat format)
Parameters
PixelFormat
format
The format to check for compressed. |
Returns
System.Boolean
True if the PixelFormat is a compressed format. |
IsCompressedASTC(PixelFormat)
Returns true if the PixelFormat is a compressed format from ASTC formats family (various block sizes).
Declaration
[Unmanaged]
public static bool IsCompressedASTC(PixelFormat format)
Parameters
PixelFormat
format
The format to check for compressed. |
Returns
System.Boolean
True if the PixelFormat is a compressed format from ASTC formats family. |
IsCompressedBC(PixelFormat)
Returns true if the PixelFormat is a compressed format from BC formats family (BC1, BC2, BC3, BC4, BC5, BC6H, BC7).
Declaration
[Unmanaged]
public static bool IsCompressedBC(PixelFormat format)
Parameters
PixelFormat
format
The format to check for compressed. |
Returns
System.Boolean
True if the PixelFormat is a compressed format from BC formats family. |
IsDepthStencil(PixelFormat)
Determines whether the specified PixelFormat is depth stencil.
Declaration
[Unmanaged]
public static bool IsDepthStencil(PixelFormat format)
Parameters
PixelFormat
format
The Pixel Format. |
Returns
System.Boolean
|
IsHDR(PixelFormat)
Determines whether the specified PixelFormat is HDR (either 16 or 32bits Float)
Declaration
[Unmanaged]
public static bool IsHDR(PixelFormat format)
Parameters
PixelFormat
format
The format. |
Returns
System.Boolean
|
IsInteger(PixelFormat)
Determines whether the specified format is integer data type (signed or unsigned).
Declaration
[Unmanaged]
public static bool IsInteger(PixelFormat format)
Parameters
PixelFormat
format
The PixelFormat. |
Returns
System.Boolean
True if given format contains integer data type (signed or unsigned), otherwise false. |
IsNormalized(PixelFormat)
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
[Unmanaged]
public static bool IsNormalized(PixelFormat format)
Parameters
PixelFormat
format
The PixelFormat. |
Returns
System.Boolean
True if given format contains normalized data type, otherwise false. |
IsRgbAOrder(PixelFormat)
Determines whether the specified format is in RGBA order.
Declaration
[Unmanaged]
public static bool IsRgbAOrder(PixelFormat format)
Parameters
PixelFormat
format
The format. |
Returns
System.Boolean
|
IsSRGB(PixelFormat)
Determines whether the specified PixelFormat is a sRGB format.
Declaration
[Unmanaged]
public static bool IsSRGB(PixelFormat format)
Parameters
PixelFormat
format
The PixelFormat. |
Returns
System.Boolean
|
IsTypeless(PixelFormat, Boolean)
Determines whether the specified PixelFormat is Typeless.
Declaration
[Unmanaged]
public static bool IsTypeless(PixelFormat format, bool partialTypeless = true)
Parameters
PixelFormat
format
The PixelFormat. |
System.Boolean
partialTypeless
Enable/disable partially typeless formats. |
Returns
System.Boolean
|
IsValid(PixelFormat)
Returns true if the PixelFormat is valid.
Declaration
[Unmanaged]
public static bool IsValid(PixelFormat format)
Parameters
PixelFormat
format
A format to validate |
Returns
System.Boolean
True if the PixelFormat is valid. |
IsVideo(PixelFormat)
Determines whether the specified PixelFormat is video.
Declaration
[Unmanaged]
public static bool IsVideo(PixelFormat format)
Parameters
PixelFormat
format
The PixelFormat. |
Returns
System.Boolean
|
MakeTypeless(PixelFormat)
Converts the format to typeless.
Declaration
[Unmanaged]
public static PixelFormat MakeTypeless(PixelFormat format)
Parameters
PixelFormat
format
The format. |
Returns
PixelFormat
The typeless format. |
MakeTypelessFloat(PixelFormat)
Converts the typeless format to float.
Declaration
[Unmanaged]
public static PixelFormat MakeTypelessFloat(PixelFormat format)
Parameters
PixelFormat
format
The typeless format. |
Returns
PixelFormat
The float format. |
MakeTypelessUNorm(PixelFormat)
Converts the typeless format to unorm.
Declaration
[Unmanaged]
public static PixelFormat MakeTypelessUNorm(PixelFormat format)
Parameters
PixelFormat
format
The typeless format. |
Returns
PixelFormat
The unorm format. |
SizeInBits(PixelFormat)
Calculates the size of a PixelFormat in bits.
Declaration
[Unmanaged]
public static int SizeInBits(PixelFormat format)
Parameters
PixelFormat
format
The pixel format. |
Returns
System.Int32
The size in bits |
SizeInBytes(PixelFormat)
Calculates the size of a PixelFormat in bytes.
Declaration
[Unmanaged]
public static int SizeInBytes(PixelFormat format)
Parameters
PixelFormat
format
The Pixel format. |
Returns
System.Int32
size of in bytes |
ToNonsRGB(PixelFormat)
Finds the equivalent non sRGB format to the provided sRGB format.
Declaration
[Unmanaged]
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)
Finds the equivalent sRGB format to the provided format.
Declaration
[Unmanaged]
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. |