Table of Contents

Class PixelFormatExtensions

Namespace
Stride.Graphics
Assembly
Stride.dll

Extensions to PixelFormat.

public static class PixelFormatExtensions
Inheritance
PixelFormatExtensions

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

format PixelFormat

The pixel format

Returns

int

The size in bits

BlockHeight(PixelFormat)

public static int BlockHeight(this PixelFormat format)

Parameters

format PixelFormat

Returns

int

BlockSize(PixelFormat)

public static int BlockSize(this PixelFormat format)

Parameters

format PixelFormat

Returns

int

BlockWidth(PixelFormat)

public static int BlockWidth(this PixelFormat format)

Parameters

format PixelFormat

Returns

int

ComputePitch(PixelFormat, int, int, out int, out int)

public static void ComputePitch(this PixelFormat fmt, int width, int height, out int rowPitch, out int slicePitch)

Parameters

fmt PixelFormat
width int
height int
rowPitch int
slicePitch int

HasAlpha(PixelFormat)

Returns true if the PixelFormat has an Alpha channel.

public static bool HasAlpha(this PixelFormat fmt)

Parameters

fmt PixelFormat

The format to check for an Alpha channel.

Returns

bool

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

fmt PixelFormat

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

Returns

bool

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

format PixelFormat

the sRGB format

Returns

bool

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

format PixelFormat

the non-sRGB format

Returns

bool

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

format PixelFormat

The format.

Returns

bool

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

fmt PixelFormat

The format to check for compressed.

Returns

bool

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

fmt PixelFormat

The FMT.

Returns

bool

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

fmt PixelFormat

The DXGI Format.

Returns

bool

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

format PixelFormat

The format.

Returns

bool

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

fmt PixelFormat

The PixelFormat.

Returns

bool

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

fmt PixelFormat

The PixelFormat.

Returns

bool

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

format PixelFormat

A format to validate

Returns

bool

True if the PixelFormat is valid.

IsVideo(PixelFormat)

Determines whether the specified PixelFormat is video.

public static bool IsVideo(this PixelFormat fmt)

Parameters

fmt PixelFormat

The PixelFormat.

Returns

bool

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

format PixelFormat

The pixel format.

Returns

int

The size in bits

SizeInBytes(PixelFormat)

Calculates the size of a PixelFormat in bytes.

public static int SizeInBytes(this PixelFormat format)

Parameters

format PixelFormat

The dxgi format.

Returns

int

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

format PixelFormat

The non sRGB format.

Returns

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

format PixelFormat

The non sRGB format.

Returns

PixelFormat

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