SurfaceFormat Enumeration

Defines various types of surface formats.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework.Graphics (in microsoft.xna.framework.graphics.dll)

Syntax

public enum SurfaceFormat

Members

  Member name Description
Color (Unsigned format) 32-bit ARGB pixel format with alpha, using 8 bits per channel.
Bgr565 (Unsigned format) 16-bit BGR pixel format with 5 bits for blue, 6 bits for green, and 5 bits for red.
Bgra5551 (Unsigned format) 16-bit BGRA pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha.
Bgra4444 (Unsigned format) 16-bit BGRA pixel format with 4 bits for each channel.
Dxt1 DXT1 compression texture format. The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures.
Dxt3 DXT3 compression texture format. The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures.
Dxt5 DXT5 compression texture format. The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures.
NormalizedByte2 (Signed format) 16-bit bump-map format using 8 bits each for u and v data.
NormalizedByte4 (Signed format) 32-bit bump-map format using 8 bits for each channel.
Rgba1010102 (Unsigned format) 32-bit RGBA pixel format using 10 bits for each color and 2 bits for alpha.
Rg32 (Unsigned format) 32-bit pixel format using 16 bits each for red and green.
Rgba64 (Unsigned format) 64-bit RGBA pixel format using 16 bits for each component.
Alpha8 (Unsigned format) 8-bit alpha only.
Single (IEEE format) 32-bit float format using 32 bits for the red channel.
Vector2 (IEEE format) 64-bit float format using 32 bits for the red channel and 32 bits for the green channel.
Vector4 (IEEE format) 128-bit float format using 32 bits for each channel (alpha, blue, green, red).
HalfSingle (Floating-point format) 16-bit float format using 16 bits for the red channel.
HalfVector2 (Floating-point format) 32-bit float format using 16 bits for the red channel and 16 bits for the green channel.
HalfVector4 (Floating-point format) 64-bit float format using 16 bits for each channel (alpha, blue, green, red).
HdrBlendable (Floating-point format) for high dynamic range data.

Remarks

In the XNA Framework, all two-dimensional (2D) images are represented by a range of memory called a surface. Within a surface, each element holds a color value representing a small section of the image, called a pixel. An image's detail level is defined by the number of pixels needed to represent the image and the number of bits needed for the image's color spectrum. For example, an image that is 800 pixels wide by 600 pixels high with 32 bits of color for each pixel (written as 800 x 600 x 32) is more detailed than an image that is 640 pixels wide by 480 pixels tall with 16 bits of color for each pixel (written as 640 x 480 x 16). Likewise, the more detailed image requires a larger surface to store the data. For an 800 x 600 x 32 image, the surface's array dimensions are 800 x 600, and each element holds a 32-bit value to represent its color.

All formats are listed from left to right, most-significant bit to least-significant bit. For example, ARGB formats are ordered from the most-significant bit channel A (alpha), to the least-significant bit channel B (blue). When traversing surface data, the data is stored in memory from least-significant bit to most-significant bit, which means that the channel order in memory is from least-significant bit (blue) to most-significant bit (alpha).

The default value for formats that contain undefined channels (Rg32, Alpha8, and so on) is 1. The only exception is the Alpha8 format, which is initialized to 000 for the three color channels.

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP