Class ExtensionMethods
Extension methods.
Namespace: Evergine.Common.Graphics
Assembly: Evergine.Common.dll
Syntax
public static class ExtensionMethods
Methods
GetBlockSize(PixelFormat)
Returns the block size for GPU-compressed textrure formats. If the foramt is not GPU-compressed, it returns (1, 1).
Declaration
public static (uint, uint) GetBlockSize(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | Pixel format. |
Returns
| Type | Description |
|---|---|
| (uint, uint) | Size in bits. |
GetBlockSizeBytes(PixelFormat)
Return the size in bytes for a block of the given format.
Declaration
public static uint GetBlockSizeBytes(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to query. |
Returns
| Type | Description |
|---|---|
| uint | Read summary. |
GetSizeInBytes(PixelFormat, uint, uint, uint, uint)
Gets format size in bits.
Declaration
public static uint GetSizeInBytes(this PixelFormat format, uint width = 1, uint height = 1, uint depth = 1, uint rowAlignment = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | Pixel format. |
| uint | width | Width of the image. |
| uint | height | Height of the image. |
| uint | depth | Depth of the image. |
| uint | rowAlignment | The row alignment. In some graphics API such as WebGPU there is a row alignment of 256 bytes required. |
Returns
| Type | Description |
|---|---|
| uint | Size in bits. |
IsCompressed(PixelFormat)
Returns whether the PixelFormat is compressed.
Declaration
public static bool IsCompressed(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsCompressed_ASTC(PixelFormat)
Returns whether the PixelFormat is compressed using ASTC.
Declaration
public static bool IsCompressed_ASTC(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsCompressed_BC(PixelFormat)
Returns whether the PixelFormat is compressed using BC.
Declaration
public static bool IsCompressed_BC(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsCompressed_ETC(PixelFormat)
Returns whether the PixelFormat is compressed using ETC.
Declaration
public static bool IsCompressed_ETC(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsCompressed_ETC1(PixelFormat)
Returns whether the PixelFormat is compressed using ETC1.
Declaration
public static bool IsCompressed_ETC1(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsCompressed_ETC2(PixelFormat)
Returns whether the PixelFormat is compressed using ETC1.
Declaration
public static bool IsCompressed_ETC2(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsCompressed_PVRTC(PixelFormat)
Returns whether the PixelFormat is compressed using PVRTC.
Declaration
public static bool IsCompressed_PVRTC(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | The PixelFormat to check. |
Returns
| Type | Description |
|---|---|
| bool | Read summary. |
IsGammaColorSpaceFormat(PixelFormat)
Indicates if this format is in Gamma Color Space.
Declaration
public static bool IsGammaColorSpaceFormat(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | Pixel format. |
Returns
| Type | Description |
|---|---|
| bool | Indicates if it is in gamma space. |
WithGamma(PixelFormat)
Returns the equivalent format with gamma. If the format doesn't have an equivalent gamma (or already is gamma), returns the same format.
Declaration
public static PixelFormat WithGamma(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | Pixel format. |
Returns
| Type | Description |
|---|---|
| PixelFormat | Read summary. |
WithoutGamma(PixelFormat)
Returns the equivalent format without gamma. If the format doesn't have gamma, it returns the same format.
Declaration
public static PixelFormat WithoutGamma(this PixelFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| PixelFormat | format | Pixel format. |
Returns
| Type | Description |
|---|---|
| PixelFormat | Read summary. |