Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    PixelFormatExtensions Class

    Namespace: Stride.Graphics
    Assembly: Stride.dll

    Extensions to PixelFormat.

    System.Object → PixelFormatExtensions
    Derived from PixelFormatExtensions:

    public static class PixelFormatExtensions
    Name Description
    Methods
    AlphaSizeInBits(PixelFormat)

    Calculate the size of the alpha channel in bits depending on the pixel format.

    BlockHeight(PixelFormat)
    BlockSize(PixelFormat)
    BlockWidth(PixelFormat)
    ComputePitch(PixelFormat, Int32, Int32, out Int32, out Int32)
    HasAlpha(PixelFormat)

    Returns true if the PixelFormat has an Alpha channel.

    HasAlpha32Bits(PixelFormat)

    Returns true if the PixelFormat is an uncompressed 32 bit color with an Alpha channel.

    HasNonSRgbEquivalent(PixelFormat)

    Determine if the format has an equivalent non-sRGB format.

    HasSRgbEquivalent(PixelFormat)

    Determine if the format has an equivalent sRGB format.

    IsBGRAOrder(PixelFormat)

    Determines whether the specified format is in BGRA order.

    IsCompressed(PixelFormat)

    Returns true if the PixelFormat is a compressed format.

    IsHDR(PixelFormat)

    Determines whether the specified PixelFormat is HDR (either 16 or 32bits float)

    IsPacked(PixelFormat)

    Determines whether the specified PixelFormat is packed.

    IsRGBAOrder(PixelFormat)

    Determines whether the specified format is in RGBA order.

    IsSRgb(PixelFormat)

    Determines whether the specified PixelFormat is a SRGB format.

    IsTypeless(PixelFormat)

    Determines whether the specified PixelFormat is typeless.

    IsValid(PixelFormat)

    Returns true if the PixelFormat is valid.

    IsVideo(PixelFormat)

    Determines whether the specified PixelFormat is video.

    SizeInBits(PixelFormat)

    Calculates the size of a PixelFormat in bits.

    SizeInBytes(PixelFormat)

    Calculates the size of a PixelFormat in bytes.

    ToNonSRgb(PixelFormat)

    Find the equivalent non sRGB format to the provided sRGB format.

    ToSRgb(PixelFormat)

    Find the equivalent sRGB format to the provided format.

    | Improve this Doc View Source

    Methods


    AlphaSizeInBits(PixelFormat)

    Calculate the size of the alpha channel in bits depending on the pixel format.

    public static int AlphaSizeInBits(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The pixel format

    Returns
    Type Description
    System.Int32

    The size in bits


    BlockHeight(PixelFormat)

    public static int BlockHeight(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format
    Returns
    Type Description
    System.Int32

    BlockSize(PixelFormat)

    public static int BlockSize(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format
    Returns
    Type Description
    System.Int32

    BlockWidth(PixelFormat)

    public static int BlockWidth(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format
    Returns
    Type Description
    System.Int32

    ComputePitch(PixelFormat, Int32, Int32, out Int32, out Int32)

    public static void ComputePitch(this PixelFormat fmt, int width, int height, out int rowPitch, out int slicePitch)
    Parameters
    Type Name Description
    PixelFormat fmt
    System.Int32 width
    System.Int32 height
    System.Int32 rowPitch
    System.Int32 slicePitch

    HasAlpha(PixelFormat)

    Returns true if the PixelFormat has an Alpha channel.

    public static bool HasAlpha(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The format to check for an Alpha channel.

    Returns
    Type Description
    System.Boolean

    True if the PixelFormat has an Alpha channel


    HasAlpha32Bits(PixelFormat)

    Returns true if the PixelFormat is an uncompressed 32 bit color with an Alpha channel.

    public static bool HasAlpha32Bits(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The format to check for an uncompressed 32 bit color with an Alpha channel.

    Returns
    Type Description
    System.Boolean

    True if the PixelFormat is an uncompressed 32 bit color with an Alpha channel


    HasNonSRgbEquivalent(PixelFormat)

    Determine if the format has an equivalent non-sRGB format.

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

    the sRGB format

    Returns
    Type Description
    System.Boolean

    true if the format has an non-sRGB equivalent


    HasSRgbEquivalent(PixelFormat)

    Determine if the format has an equivalent sRGB format.

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

    the non-sRGB format

    Returns
    Type Description
    System.Boolean

    true if the format has an sRGB equivalent


    IsBGRAOrder(PixelFormat)

    Determines whether the specified format is in BGRA order.

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

    The format.

    Returns
    Type Description
    System.Boolean

    true if the specified format is in BGRA order; otherwise, false.


    IsCompressed(PixelFormat)

    Returns true if the PixelFormat is a compressed format.

    public static bool IsCompressed(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The format to check for compressed.

    Returns
    Type Description
    System.Boolean

    True if the PixelFormat is a compressed format


    IsHDR(PixelFormat)

    Determines whether the specified PixelFormat is HDR (either 16 or 32bits float)

    public static bool IsHDR(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The FMT.

    Returns
    Type Description
    System.Boolean

    true if the specified pixel format is HDR (floating point); otherwise, false.


    IsPacked(PixelFormat)

    Determines whether the specified PixelFormat is packed.

    public static bool IsPacked(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The DXGI Format.

    Returns
    Type Description
    System.Boolean

    true if the specified PixelFormat is packed; otherwise, false.


    IsRGBAOrder(PixelFormat)

    Determines whether the specified format is in RGBA order.

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

    The format.

    Returns
    Type Description
    System.Boolean

    true if the specified format is in RGBA order; otherwise, false.


    IsSRgb(PixelFormat)

    Determines whether the specified PixelFormat is a SRGB format.

    public static bool IsSRgb(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The PixelFormat.

    Returns
    Type Description
    System.Boolean

    true if the specified PixelFormat is a SRGB format; otherwise, false.


    IsTypeless(PixelFormat)

    Determines whether the specified PixelFormat is typeless.

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

    The PixelFormat.

    Returns
    Type Description
    System.Boolean

    true if the specified PixelFormat is typeless; otherwise, false.


    IsValid(PixelFormat)

    Returns true if the PixelFormat is valid.

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

    A format to validate

    Returns
    Type Description
    System.Boolean

    True if the PixelFormat is valid.


    IsVideo(PixelFormat)

    Determines whether the specified PixelFormat is video.

    public static bool IsVideo(this PixelFormat fmt)
    Parameters
    Type Name Description
    PixelFormat fmt

    The PixelFormat.

    Returns
    Type Description
    System.Boolean

    true if the specified PixelFormat is video; otherwise, false.


    SizeInBits(PixelFormat)

    Calculates the size of a PixelFormat in bits.

    public static int SizeInBits(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The pixel format.

    Returns
    Type Description
    System.Int32

    The size in bits


    SizeInBytes(PixelFormat)

    Calculates the size of a PixelFormat in bytes.

    public static int SizeInBytes(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The dxgi format.

    Returns
    Type Description
    System.Int32

    size of in bytes


    ToNonSRgb(PixelFormat)

    Find the equivalent non sRGB format to the provided sRGB format.

    public static PixelFormat ToNonSRgb(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The non sRGB format.

    Returns
    Type Description
    PixelFormat

    The equivalent non sRGB format if any, the provided format else.


    ToSRgb(PixelFormat)

    Find the equivalent sRGB format to the provided format.

    public static PixelFormat ToSRgb(this PixelFormat format)
    Parameters
    Type Name Description
    PixelFormat format

    The non sRGB format.

    Returns
    Type Description
    PixelFormat

    The equivalent sRGB format if any, the provided format else.


    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation