Class GorgonFormatInfo
Provides information for a specific DXGI Format.
Inherited Members
Namespace: Gorgon.Graphics
Assembly: Gorgon.Graphics.Imaging.dll
Syntax
public class GorgonFormatInfo
Remarks
This object will return the specifics for a DXGI Format, such as its bit depth, format grouping, and other information about the format. This is useful for determining how to handle a formatted element in a buffer at the byte level.
Constructors
| Edit this page View SourceGorgonFormatInfo(BufferFormat)
Initializes a new instance of the GorgonFormatInfo class.
Declaration
public GorgonFormatInfo(BufferFormat format)
Parameters
Type | Name | Description |
---|---|---|
BufferFormat | format | The format to evaluate. |
Remarks
If the format
parameter is set to Unknown, then the members of this object, except for Group, will be set to default values and may not be accurate.
Fields
| Edit this page View SourceUnknownFormatInfo
A default information type for the Unknown format.
Declaration
public static readonly GorgonFormatInfo UnknownFormatInfo
Field Value
Type | Description |
---|---|
GorgonFormatInfo |
Properties
| Edit this page View SourceBitDepth
Property to return the bit depth for the format.
Declaration
public int BitDepth { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
This is the number of bits in the format, not per component. For example, R8G8B8A8_UNorm would be 32 bits, and B5G6R5_UNorm would be 16 bits.
ComponentCount
Property to return the number of components for the format.
Declaration
public int ComponentCount { get; }
Property Value
Type | Description |
---|---|
int |
Format
Property to return the format that the information in this object is based on.
Declaration
public BufferFormat Format { get; }
Property Value
Type | Description |
---|---|
BufferFormat |
Group
Property to return the group for the format.
Declaration
public BufferFormat Group { get; }
Property Value
Type | Description |
---|---|
BufferFormat |
Remarks
The group for a format is typically its typeless counterpart. To be grouped with another format, the format must have the same byte ordering, and the format size must be the same as the other formats in the group.
For example, R8G8B8A8_UNorm would be a member of the group R8G8B8A8_Typeless, as would R8G8B8A8_SInt.
HasAlpha
Property to return whether the format has an alpha component.
Declaration
public bool HasAlpha { get; }
Property Value
Type | Description |
---|---|
bool |
HasDepth
Property to return whether the format has a depth component.
Declaration
public bool HasDepth { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When this value returns true, then this format can be considered valid for use as a depth buffer format (this depends on available hardware support).
HasStencil
Property to return whether the format has a stencil component.
Declaration
public bool HasStencil { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When this value returns true, then this format can be considered valid for use as a stencil buffer format (this depends on available hardware support).
IsCompressed
Property to return whether the pixel format is compressed or not.
Declaration
public bool IsCompressed { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If this value returns true, then the format is meant for use with images that contain block compressed data.
IsPacked
Property to return whether the pixel format is packed or not.
Declaration
public bool IsPacked { get; }
Property Value
Type | Description |
---|---|
bool |
IsPalettized
Property to return whether this format uses an indexed palette or not.
Declaration
public bool IsPalettized { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
For some 8 bit formats, the pixel value is an index into a larger palette of color values. For example, if the index 10 is mapped to a color value of R:64, G:32, B:128, then any pixels with the value of 10 will use that color from the palette.
IsSRgb
Property to return whether this format is an SRgb format or not.
Declaration
public bool IsSRgb { get; }
Property Value
Type | Description |
---|---|
bool |
IsTypeless
Property to return whether the format is typeless or not.
Declaration
public bool IsTypeless { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When this value returns true, then the components of the format may be interpreted in any way. If not, then the components of the format are expected to be interpreted as a known type.
SizeInBytes
Property to return the size of the format, in bytes.
Declaration
public int SizeInBytes { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceCalculateScanlines(int)
Function to compute the scan lines for a format, given a specific height.
Declaration
public int CalculateScanlines(int height)
Parameters
Type | Name | Description |
---|---|---|
int | height | The height, in pixels. |
Returns
Type | Description |
---|---|
int | The number of scan lines. |
Remarks
This will compute the number of scan lines for an image that uses the format that this information describes. If the format is IsCompressed, then this method will compute the scanline count based on the maximum size between 1 and a block size multiple of 4. If the format is not compressed, then it will just return the height value passed in.
GetPitchForFormat(int, int, PitchFlags)
Function to return pitch information for this format.
Declaration
public GorgonPitchLayout GetPitchForFormat(int width, int height, PitchFlags flags = PitchFlags.None)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the data. |
int | height | The height of the image pixel data. |
PitchFlags | flags | [Optional] Flags used to influence the row pitch. |
Returns
Type | Description |
---|---|
GorgonPitchLayout | The pitch information for the format. |
Remarks
The flags
parameter is used to compensate in cases where the original image data is not laid out correctly (such as with older DirectDraw DDS images).