Device.GetFrontBufferData(Int32,Surface) Method (Microsoft.DirectX.Direct3D)

Generates a copy of a device's front buffer and places it in a system memory buffer provided by the application.

Definition

Visual Basic Public Sub GetFrontBufferData( _
    ByVal swapChain As Integer, _
    ByVal buffer As Surface _
)
C# public void GetFrontBufferData(
    int swapChain,
    Surface buffer
);
C++ public:
void GetFrontBufferData(
    int swapChain,
    Surfacebuffer
);
JScript public function GetFrontBufferData(
    swapChain : int,
    buffer : Surface
);

Parameters

swapChain System.Int32
Unsigned integer that specifies the swap chain.
buffer Microsoft.DirectX.Direct3D.Surface
[in, out] A Surface class that receives a copy of the front buffer's contents. The data is returned in successive rows with no intervening space, proceeding from the highest vertical row on the device's output to the lowest.

For windowed mode, the size of the destination surface should be the desktop size. For full-screen mode, the size of the destination surface should be the screen size.

Remarks

The param_Surface_buffer parameter is filled with a representation of the front buffer, converted to the standard 32-bits-per-pixel format A8R8G8B8.

This method is the only way to capture an antialiased screen shot.

The method is slow by design, and therefore should not be used in a performance-critical path.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

DeviceLostException

The device is lost but cannot be reset at this time. Therefore, rendering is not possible.