DirectX SDK

Blitting with BltFast

[C++]

When using IDirectDrawSurface7::BltFast, you supply a valid rectangle in the source surface from which the pixels are to be copied (or NULL to specify the entire surface), and an x-coordinate and y-coordinate in the destination surface. The source rectangle must be able to fit in the destination surface with its top left corner at that point, or the call will fail with a return value of DDERR_INVALIDRECT. BltFast cannot be used on surfaces that have an attached clipper.

No stretching, mirroring, or other effects can be performed when using BltFast.

BltFast Example

The following example copies pixels from an off-screen surface, lpDDSOffOne, to the primary surface, lpDDSPrimary. The flags ensure that the operation will take place as soon as the blitter is free, and that transparent pixels in the source image will not be copied. (For more information on the meaning of these flags, see Blit Timing and Transparent Blitting .)

lpDDSPrimary->BltFast(
        100, 200,    // Upper left xy of destination
        lpDDSOffOne, // Source surface
        NULL,        // Source rectangle = entire surface
        DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY );
[Visual Basic]

When using DirectDrawSurface7.BltFast, you supply a valid rectangle in the source surface from which the pixels are to be copied (or an empty RECT type to specify the entire surface), and an x-coordinate and y-coordinate in the destination surface. The source rectangle must be able to fit in the destination surface with its top left corner at that point, or the call will fail and raise an error value of DDERR_INVALIDRECT. BltFast cannot be used on surfaces that have an attached clipper.

No stretching, mirroring, or other effects can be performed when using BltFast.

BltFast Example

The following example copies pixels from an off-screen surface, DDSOffOne, to the primary surface, DDSPrimary. The flags ensure that the operation will take place as soon as the blitter is free, and that transparent pixels in the source image will not be copied. (For more information on the meaning of these flags, see Blit Timing and Transparent Blitting.)

DDSPrimary.BltFast(
        100, 200,    // Upper left xy of destination
        DDSOffOne,   // Source surface
        SrcRect,     // Source rectangle, empty RECT = entire surface
        DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY )