## Further Reading

Color Keying
  A color key is typically a single uncommon color that the artist does not use for anything but transparency, but it can also be a specified range of colors. Using the IDirectDrawSurface3::SetColorKey method, you can set the color key for a surface. After the color key is set, subsequent calls to IDirectDrawSurface3::BltFast take advantage of that color key, ignoring the pixels that match it. This type of color key is known as a source color key. Because the source color key prevents "transparent" pixels from being written to the destination, the original background pixels are preserved in these places, making it look like a sprite is a non-rectangular object passing over the background. You can also use a color key that effects the destination surface (a destination color key).

  A destination color key is a color on a surface that is used for pixels that can be overwritten by a sprite. Again, the artist chooses an arbitrary color that is not used elsewhere in the image, reserving it as a portion of the image where you are allowed to blit. When you blit a sprite to the destination surface with a destination color key specified, the sprite's pixels will only be blitted to pixels on the destination that are using the destination color key. Because the normal destination pixels are preserved, it looks like the sprite passes behind the image on the destination surface. For more information, see "Transparent Blitting and Color Keys" in the "Sprite Concepts" topic of the "DirectDraw Getting Started: Basic Graphics Concepts" section of the DirectX Foundation SDK.

D3DCOLOR_MONO
  A value of the D3DRMCOLORMODEL constant that tells the system to use a monochromatic model (or ramp model). In this model, the blue component of a vertex color is used to define the brightness of a lit vertex.
D3DCOLOR_RGB
  A value of the D3DRMCOLORMODEL constant that tells the system to use a full RGB model.
D3DCOLORMODEL
  A constant that defines the color model in which the system will run.

      typedef enum _D3DCOLORMODEL {
          D3DCOLOR_MONO = 1,
          D3DCOLOR_RGB  = 2,
      } D3DCOLORMODEL;

D3DDEVICEDESC
  A structure that contains a description of the current device. For more information, see "Structures" in the DirectX Foundation Immediate Mode Reference.
D3DENUMDEVICESCALLBACK
  The prototype definition for the callback function to enumerate installed Direct3D devices. For more information, see "Callback Functions" in the DirectX Foundation Immediate Mode Reference.

      typedef HRESULT (FAR PASCAL * LPD3DENUMDEVICESCALLBACK)
        (LPGUID lpGuid,
        LPSTR lpDeviceDescription,
        LPSTR lpDeviceName,
        LPD3DDEVICEDESC lpD3DHWDeviceDesc,
        LPD3DDEVICEDESC lpD3DHELDeviceDesc,
        LPVOID lpUserArg
      );

D3DMATRIX
  A structure that describes a matrix.

      typedef struct _D3DMATRIX {
          D3DVALUE _11, _12, _13, _14;
          D3DVALUE _21, _22, _23, _24;
          D3DVALUE _31, _32, _33, _34;
          D3DVALUE _41, _42, _43, _44;
      } D3DMATRIX, *LPD3DMATRIX;

D3DPRIMCAPS
  A structure that defines the capabilities for each primitive type. Used by IDirect3DRM::CreateDeviceFromClipper and IDirect3DRM2::CreateDeviceFromClipper to set these default capabilities:

  D3DPCMPCAPS_LESSEQUAL — Pass the z-buffer comparison if the new z is less than or equal to the current z.

  D3DPMISCCAPS_CULLCCW — The driver supports counterclockwise culling through the D3DRENDERSTATE_CULLMODE state. (This applies only to triangle primitives.)

  D3DPRASTERCAPS_FOGVERTEX — The device calculates the fog value during the lighting operation, places the value into the alpha component of the D3DCOLOR value given for the specular member of the D3DTLVERTEX structure, and interpolates the fog value during rasterization.

  D3DPSHADECAPS_ALPHAFLATSTIPPLED — The device can support an alpha component for flat blended and stippled transparency, respectively (the D3DSHADE_FLAT state for the D3DSHADEMODE enumerated type). In these modes, the alpha color component for a primitive is provided as part of the color for the first vertex of the primitive.

  D3DPTADDRESSCAPS_WRAP — The device can wrap textures to addresses.

  D3DPTBLENDCAPS_COPY | D3DPTBLENDCAPS_MODULATE — The copy texture-blending mode (D3DTBLEND_COPY from the D3DTEXTUREBLEND enumerated type) and the modulate texture-blending mode (D3DTBLEND_MODULATE from the D3DTEXTUREBLEND enumerated type) are supported.

  D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_TRANSPARENCY — Perspective correction and texture transparency are supported.

  D3DPTFILTERCAPS_NEAREST — The texel (a single element of a texture) with coordinates nearest to the desired pixel value is used. This applies to both zooming in and zooming out. If either zooming in or zooming out is supported, then both must be supported.

D3DRECT
  A structure that is a rectangle definition.

      typedef struct _D3DRECT {
          union {
              LONG x1;
              LONG lX1;  //upper left x
          };
          union {
              LONG y1;
              LONG lY1;  //upper left y
          };
          union {
              LONG x2;
              LONG lX2; //lower right x
          };
          union {
              LONG y2;
              LONG lY2;  //lower right y
          };
      } D3DRECT, *LPD3DRECT;

D3DTRIANGLE
  The structure that describes the base type for all triangles. The triangle is the main rendering primitive.
D3DVALUE
  The fundamental Direct3D fractional data type.

      typedef float D3DVALUE, *LPD3DVALUE;

D3DVECTOR
  The structure that defines a vector for many Direct3D and Direct3D Retained Mode methods and structures.

      typedef struct _D3DVECTOR {
          union {
              D3DVALUE x;
              D3DVALUE dvX;
          };
          union {
              D3DVALUE y;
              D3DVALUE dvY;
          };
          union {
              D3DVALUE z;
              D3DVALUE dvZ;
          };
      } D3DVECTOR, *LPD3DVECTOR;

DirectDrawCreate
  A function that creates an instance of a DirectDraw object. For more information, see "Functions" in the DirectX Foundation DirectDraw Reference.
DirectDrawCreateClipper
  A function that creates an instance of a DirectDrawClipper object not associated with a DirectDraw object. For more information, see "Functions" in the DirectX Foundation DirectDraw Reference.
IDirect3D
  Applications use the methods of the IDirect3D2 interface to create Direct3D objects and to set up the environment. For more information, see "IDirect3D2" in the "Interfaces" topic in DirectX Foundation Immediate Mode Reference.
  IDirect3D::EnumDevices — This method enumerates all Direct3D device drivers installed on the system.
  IDirect3D::FindDevice — This method finds a device with the specified characteristics and retrieves a description of it.
IDirectDrawClipper
  Applications use the methods of the IDirectDrawClipper interface to manage clip lists. For more information, see the DirectX Foundation DirectDraw Reference.
  IDirectDrawClipper::SetHWnd — This method sets the window handle that will obtain the clipping information.
IUnknown Interface
  All Component Object Model (COM) interfaces are derived from the IUnknown interface. This interface provides control of the object's lifetime and the ability to navigate multiple interfaces. IUnknown has three methods: AddRef, which increments the object's reference count by 1 when an interface or another application binds itself to the object; QueryInterface, which queries the object about the features it supports by requesting pointers to a specific interface; Release, which decrements the object's reference count by 1. When the count reaches 0, the object is deallocated.

  IUnknown::AddRef and IUnknown::Release — These IUnknown methods maintain an object's reference count. For example, if you create a DirectPlay object (with CoCreateInstance, for example), the object's reference count is set to 1. Every time a function returns a pointer to an interface for that object, the function must call AddRef through that pointer to increment the reference count. You must match each AddRef call with a call to Release. Before the pointer can be destroyed, you must call Release through that pointer. After an object's reference count reaches 0, the object is destroyed and all interfaces to it become invalid.
  IUnknown::QueryInterface — This IUnknown method determines whether an object supports a specific interface. If an object supports the interface, QueryInterface returns a pointer to that interface. You then can use the methods contained in that interface to communicate with the object. If QueryInterface successfully returns a pointer to an interface, it implicitly calls AddRef to increment the reference count, so your application must call Release to decrement the reference count before destroying the pointer to the interface.
Mipmaps
  A mipmap is a sequence of textures, each of which is a progressively lower resolution, prefiltered representation of the same image. Each prefiltered image, or level, in the mipmap is a power of two smaller than the previous level. A high-resolution level is used for objects that are close to the viewer. Lower-resolution levels are used as the object moves farther away. Mipmapping is a computationally low-cost way of improving the quality of rendered textures. For more information, see "Mipmaps" in the "Textures" topic in the "Direct3D Immediate-Mode Essentials" section of the DirectX Foundation SDK.
Texture Map Formats
  A wide range of texture pixel formats are supported by the Microsoft® DirectX® hardware-emulation layer. The table in "Texture Map Formats" in the "Pixel Format Masks" topic in the DirectX Foundation DirectDraw Reference shows these formats.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.