Tricks of the Windows Game Programming Gurus:Advanced DirectDraw and Bitmapped Graphics

All ITKnowledge Source Code Search Tips Advanced Search |

| Tricks of the Windows Game Programming Gurus by Andre LaMothe Sams, Macmillan Computer Publishing ISBN: 0672313618 Pub Date: 09/27/99

Search this book:

Previous | Table of Contents | Next

`dwFlags` determines the valid members of the next parameter, which is a `DDBLTFX` structure. Within `DDBLTFX`, special behaviors such as scaling, rotation, and so on can be controlled, as well as color key information. The valid flags for `dwFlags` are shown in Table 7.3.

Table 7.3 Control Flags for `dwFlags` Parameter of `Blt()`

Value | Description
--- | ---

General Flags
`DDBLT_COLORFILL` | Uses the `dwFillColor` member of the `DDBLTFX` structure as the RGB color that fills the destination rectangle on the destination surface.
`DDBLT_DDFX` | Uses the `dwDDFX` member of the `DDBLTFX` structure to specify the effects to use for this blit.
`DDBLT_DDROPS` | Uses the `dwDDROP` member of the `DDBLTFX` structure to specify the raster operations (ROPs) that are not part of the Win32 API.
`DDBLT_DEPTHFILL` | Uses the `dwFillDepth` member of the `DDBLTFX` structure as the depth value with which to fill the destination rectangle on the destination z-buffer surface.
`DDBLT_KEYDESTOVERRIDE` | Uses the `ddckDestColorkey` member of the `DDBLTFX` structure as the color key for the destination surface.
`DDBLT_KEYSRCOVERRIDE` | Uses the `ddckSrcColorkey` member of the `DDBLTFX` structure as the color key for the source surface.
`DDBLT_ROP` | Uses the `dwROP` member of the `DDBLTFX` structure for the ROP for this blit. These ROPs are the same as those defined in the Win32 API.
`DDBLT_ROTATIONANGLE` | Uses the `dwRotationAngle` member of the `DDBLTFX` structure as the rotation angle (specified in 1/100ths of a degree) for the surface. This only works with hardware support. The HEL (Hardware Emulation Layer) can’t do rotation—bummer!
Color Key Flags
`DDBLT_KEYDEST` | Uses the color key associated with the destination surface.
`DDBLT_KEYSRC` | Uses the color key associated with the source surface.
Behavior Flags
`DDBLT_ASYNC` | Performs this blit asynchronously through the FIFO (First In, First Out) in the order received. If no room is available in the FIFO hardware, the call fails. Fast, but risky; error logic is needed to use this flag properly.
`DDBLT_WAIT` | Waits until the blit can be performed and doesn’t return the error `DDERR_WASSTILLDRAWING` if the blitter was busy.

`lpDDBltFx` is a structure containing special blitter-relating information about the blit you’re requesting. The data structure follows.

    typedef struct _DDBLTFX

     {

     DWORD dwSize;  // the size of this structure in bytes

     DWORD dwDDFX;  // type of blitter fx

     DWORD dwROP;   // Win32 raster ops that are supported

     DWORD dwDDROP; // DirectDraw raster ops that are supported

     DWORD dwRotationAngle; // angle for rotations

     DWORD dwZBufferOpCode;      // z-buffer fields (advanced)

     DWORD dwZBufferLow;         // advanced..

     DWORD dwZBufferHigh;        // advanced..

     DWORD dwZBufferBaseDest;    // advanced..

     DWORD dwZDestConstBitDepth; // advanced..

     union

     {

     DWORD               dwZDestConst;       // advanced..

     LPDIRECTDRAWSURFACE lpDDSZBufferDest;   // advanced..

     };

     DWORD dwZSrcConstBitDepth;              // advanced..

     union

     {

     DWORD               dwZSrcConst;        // advanced..

     LPDIRECTDRAWSURFACE lpDDSZBufferSrc;    // advanced..

     };

     DWORD dwAlphaEdgeBlendBitDepth;  // alpha stuff (advanced)

     DWORD dwAlphaEdgeBlend;          // advanced..

     DWORD dwReserved;                // advanced..

     DWORD dwAlphaDestConstBitDepth;  // advanced..

     union

     {

     DWORD               dwAlphaDestConst;   // advanced..

     LPDIRECTDRAWSURFACE lpDDSAlphaDest;     // advanced..

     };

     DWORD dwAlphaSrcConstBitDepth;         // advanced..

     union

     {

     DWORD               dwAlphaSrcConst;   // advanced..

     LPDIRECTDRAWSURFACE lpDDSAlphaSrc;     // advanced..

     };

     union // these are very important

     {

     DWORD dwFillColor; // color word used for fill

     DWORD dwFillDepth; // z filling (advanced)

     DWORD dwFillPixel; // color fill word for RGB(alpha) fills

     LPDIRECTDRAWSURFACE lpDDSPattern;

     };

     // these are very important

     DDCOLORKEY ddckDestColorkey; // destination color key

     DDCOLORKEY ddckSrcColorkey;  // source color key

    } DDBLTFX,FAR* LPDDBLTFX;

(Note that I’ve boldfaced useful fields.)

(Note that I’ve boldfaced the most useful flags.)

If you’re losing your mind, that’s fantastic—it shows that you’re following me <BG>. Now, take a look at BltFast():

    HRESULT BltFast(

      DWORD dwX, // x-position of blit on destination

      DWORD dwY, // y-position of blit on destination

      LPDIRECTDRAWSURFACE4 lpDDSrcSurface, // source surface

      LPRECT lpSrcRect, // source RECT to blit from

      DWORD dwTrans);   // type of transfer

Previous | Table of Contents | Next

Copyright © Macmillan Computer Publishing, Inc.

Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.