Search Results for

    Show / Hide Table of Contents

    Class ExtensionMethods

    Extension methods.

    Inheritance
    object
    ExtensionMethods
    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.

    IsDepthFormat(PixelFormat, bool)

    Return whether the format is a depth format.

    Declaration
    public static bool IsDepthFormat(this PixelFormat format, bool depthStencilFlag)
    Parameters
    Type Name Description
    PixelFormat format

    The format.

    bool depthStencilFlag

    A hint flag that suggest if the format is depth-stencil.

    Returns
    Type Description
    bool

    Whether the specified format is a depth format.

    IsDepthOrStencilFormat(PixelFormat, bool)

    Return whether the format is a depth or stencil format.

    Declaration
    public static bool IsDepthOrStencilFormat(this PixelFormat format, bool depthStencilFlag)
    Parameters
    Type Name Description
    PixelFormat format

    The format.

    bool depthStencilFlag

    A hint flag that suggest if the format is depth-stencil.

    Returns
    Type Description
    bool

    Whether the specified format is a depth or stencil format.

    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.

    IsStencilFormat(PixelFormat)

    Return whether the format is a stencil format.

    Declaration
    public static bool IsStencilFormat(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The format.

    Returns
    Type Description
    bool

    Whether the specified format is a stencil format.

    IsTypeless(PixelFormat)

    Return whether the format is typeless.

    Declaration
    public static bool IsTypeless(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The format.

    Returns
    Type Description
    bool

    Read summary.

    ToColorFormat(PixelFormat)

    Converts a depth/stencil or typeless format to the equivalent color format. If the format is not depth/stencil, it just returns the same format.

    Declaration
    public static PixelFormat ToColorFormat(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The depth stencil format.

    Returns
    Type Description
    PixelFormat

    The converted format.

    ToDepthStencilFormat(PixelFormat)

    Converts the given format to the equivalent depth-stencil format.

    Declaration
    public static PixelFormat ToDepthStencilFormat(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The format.

    Returns
    Type Description
    PixelFormat

    The converted format.

    ToTypeless(PixelFormat)

    Converts the format to typeless. If the format can't be converted (or it's already typeless), it just returns the same format.

    Declaration
    public static PixelFormat ToTypeless(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The format to convert.

    Returns
    Type Description
    PixelFormat

    The converted format.

    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.

    In this article
    Back to top
    Generated by DocFX