Sdílet prostřednictvím


GraphicsAdapter.CheckDeviceFormatConversion Method

Tests a device to determine whether it supports conversion from one display format to another.

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

Syntax

public bool CheckDeviceFormatConversion (
         DeviceType deviceType,
         SurfaceFormat sourceFormat,
         SurfaceFormat targetFormat
)

Parameters

  • deviceType
    Type of device to check.
  • sourceFormat
    Source adapter format.
  • targetFormat
    Target adapter format.

Return Value

true if the method succeeds; false if it fails.

Exceptions

Exception type Condition
DeviceNotSupportedException (Xbox 360) Hardware is the only device type supported on this platform.

Remarks

Using CheckDeviceFormatConversion to test for compatibility between a back buffer and the display format returns appropriate values. This means that the call reflects device capabilities. If the device cannot render to the requested back buffer format, the call still returns false. If the device can render to the format but cannot perform the color-converting presentation, the return value is also false. Applications can discover hardware support for the presentation itself by calling CheckDeviceFormatConversion. No software emulation for the color-converting presentation itself is offered.

Color conversion is restricted to certain source and target formats. The source format must be a four-character code (FOURCC) format or a valid back-buffer format, and the target format must be one of the following unsigned formats.

SurfaceFormat.Bgr555 SurfaceFormat.Bgra5551 SurfaceFormat.Bgr565
SurfaceFormat.Bgr24 SurfaceFormat.Bgr32 SurfaceFormat.Color
SurfaceFormat.Bgra1010102 SurfaceFormat.Rgba64 SurfaceFormat.Rgba1010102
SurfaceFormat.Rgba32 SurfaceFormat.Rgb32 SurfaceFormat.HalfVector4
SurfaceFormat.Vector4    

See Also

Reference

GraphicsAdapter Class
GraphicsAdapter Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista