Microsoft DirectX 9.0

IDirectDrawSurface::Blt

The Blt method performs a bit block transfer. This method is capable of synchronous or asynchronous blits, either video memory to video memory, video memory to system memory, system memory to video memory, or system memory to system memory. The blits can be performed using z information, alpha information, source color keys and destination color keys. Arbitrary stretching/shrinking will be performed if the source and destination rectangles are not the same size.

Normally, Blt will return immediately with an error if the blitter is busy and the blit could not be set up. The DDBLT_WAIT flag can be used to alter this behavior such that Blt will wait until the blit can be set up, or another error occurs, before returning.

Syntax

HRESULT Blt(
  LPRECT lpDestRect,
  LPDIRECTDRAWSURFACE lpDDSrcSurface,
  LPRECT lpSrcRect,
  DWORD dwFlags,
  LPDDBLTFX lpDDBltFX
  );

Parameters

lpDestRect

Points to a RECT structure that defines the upper left and lower right points of the rectangle on the destination surface which is to be blted to.

lpDDSrcSurface

Points to the IDirectDrawSurface interface of the DirectDrawSurface object. This is the source for the blit operation.

lpSrcRect

Points to a RECT structure that defines the upper left and lower right points of the rectangle on the source surface which is to be blted from.

dwFlags

Zero or more of the following values.

Value Description
DDBLT_ALPHADEST Use the alpha information in the pixel format or the alpha channel surface attached to the destination surface as the alpha channel for this blit.
DDBLT_ALPHADESTCONSTOVERRIDE Use the dwConstAlphaDest member in the DDBLTFX structure as the alpha channel for the destination surface for this blit.
DDBLT_ALPHADESTNEG The NEG suffix indicates that the destination surface becomes more transparent as the alpha value increases. (0 is opaque)
DDBLT_ALPHADESTSURFACEOVERRIDE Use the lpDDSAlphaDest member in the DDBLTFX structure as the alpha channel for the destination for this blit.
DDBLT_ALPHAEDGEBLEND Use the dwAlphaEdgeBlend member in the DDBLTFX structure as the alpha channel for the edges of the image that border the color key colors.
DDBLT_ALPHASRC Use the alpha information in the pixel format or the alpha channel surface attached to the source surface as the alpha channel for this blit.
DDBLT_ALPHASRCCONSTOVERRIDE Use the dwConstAlphaSrc member in the DDBLTFX structure as the alpha channel for the source for this blit.
DDBLT_ALPHASRCNEG The NEG suffix indicates that the source surface becomes more transparent as the alpha value increases. (0 is opaque)
DDBLT_ALPHASRCSURFACEOVERRIDE Use the lpDDSAlphaSrc member in the DDBLTFX structure as the alpha channel for the source for this blit.
DDBLT_ASYNC Do this blit asynchronously through the FIFO in the order received. If there is no room in the hardware FIFO fail the call.
DDBLT_COLORFILL Uses the dwFillColor member in the DDBLTFX structure as the RGB color to fill the destination rectangle on the destination surface.
DDBLT_DDFX Uses the dwDDFX member in the DDBLTFX structure to specify the effects to use for the blit.
DDBLT_DDROPS Uses the dwDDROPS member in the DDBLTFX structure to specify the ROPS that are not part of the Win32 API.
DDBLT_KEYDEST Use the color key associated with the destination surface.
DDBLT_KEYDESTOVERRIDE Use the dckDestColorkey member in the DDBLTFX structure as the color key for the destination surface.
DDBLT_KEYSRC Use the color key associated with the source surface.
DDBLT_KEYSRCOVERRIDE Use the dckSrcColorkey member in the DDBLTFX structure as the color key for the source surface.
DDBLT_ROP Use the dwROP member in the DDBLTFX structure for the raster operation for this blit. These ROPs are the same as the ones defined in the Win32 API.
DDBLT_ROTATIONANGLE Use the dwRotationAngle member in the DDBLTFX structure as the angle (specified in 1/100th of a degree) to rotate the surface.
DDBLT_WAIT Do not return immediately with the DDERR_WASSTILLDRAWING message if the bltter is busy -- wait until the blit can be set up or another error occurs.
DDBLT_ZBUFFER Z-buffered blit using the z-buffers attached to the source and destination surfaces and the dwZBufferOpCode member in the DDBLTFX structure as the z-buffer opcode.
DDBLT_ZBUFFERDESTCONSTOVERRIDE Z-buffered blit using the dwConstDest member and the dwZBufferOpCode member in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively for the destination.
DDBLT_ZBUFFERDESTOVERRIDE Z-buffered blit using the lpDDSDestZBuffer member and the dwZBufferOpCode member in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively for the destination.
DDBLT_ZBUFFERSRCCONSTOVERRIDE Z-buffered blit using the dwConstSrcZ member and the dwZBufferOpCode member in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively for the source.
DDBLT_ZBUFFERSRCOVERRIDE Z-buffered blit using the lpDDSSrcZBuffer member and the dwZBufferOpCode member in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively for the source.

lpDDBltFx

Pointer to a DDBLTFX structure

Return Values

Value Description
DD_OK The method succeeded.
DDERR_GENERIC Generic failure.
DDERR_INVALIDCLIPLIST DirectDraw does not support the provided clip list.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_INVALIDRECT Rectangle provided was invalid.
DDERR_NOALPHAHW Operation could not be carried out because there is no alpha accleration hardware present or available.
DDERR_NOBLTHW No blitter hardware present.
DDERR_NOCLIPLIST No clip list available.
DDERR_NODDROPSHW No DirectDraw ROP hardware.
DDERR_SURFACELOST Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.
DDERR_UNSUPPORTED Action not supported.
DDERR_NOMIRRORHW Operation could not be carried out because there is no hardware present or available.
DDERR_NORASTEROPHW Operation could not be carried out because there is no appropriate raster op hardware present or available.
DDERR_NOROTATIONHW Operation could not be carried out because there is no rotation hardware present or available.
DDERR_NOSTRETCHHW Operation could not be carried out because there is no hardware support for stretching.
DDERR_SURFACEBUSY Access to this surface is being refused because the surface is already locked by another thread.
DDERR_NOZBUFFERHW Operation could not be carried out because there is no hardware support for z-buffer blitting.

See Also