?? ddraw.h
字號:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*==========================================================================;
*
* File: ddraw.h
* Content: DirectDraw include file
*
***************************************************************************/
#pragma once
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
// Other components use this define to tell if they have the DirectDraw
// defintitions presents or if they have to re-define stuff.
#define __DDRAW_INCLUDED__
/*
* GUIDS used by DirectDraw objects
*/
DEFINE_GUID(IID_IDirectDraw, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5);
DEFINE_GUID(IID_IDirectDrawSurface, 0x0b0e83e4,0xf37f,0x11d2,0x8b,0x15,0x00,0xc0,0x4f,0x68,0x92,0x92);
DEFINE_GUID(IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
DEFINE_GUID(IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
DEFINE_GUID(IID_IDirectDrawColorControl, 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8);
DEFINE_GUID(IID_IDirectDrawGammaControl, 0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E);
/*
* Forward interface declerations
*/
struct IDirectDraw;
struct IDirectDrawSurface;
struct IDirectDrawPalette;
struct IDirectDrawClipper;
struct IDirectDrawColorControl;
struct IDirectDrawGammaControl;
typedef struct IDirectDraw *LPDIRECTDRAW;
typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE;
typedef struct IDirectDrawPalette *LPDIRECTDRAWPALETTE;
typedef struct IDirectDrawClipper *LPDIRECTDRAWCLIPPER;
typedef struct IDirectDrawColorControl *LPDIRECTDRAWCOLORCONTROL;
typedef struct IDirectDrawGammaControl *LPDIRECTDRAWGAMMACONTROL;
/*
* DirectDraw Structures
*/
/*
* DDCOLORKEY
*/
typedef struct _DDCOLORKEY
{
DWORD dwColorSpaceLowValue; // low boundary of color space that is to
// be treated as Color Key, inclusive
DWORD dwColorSpaceHighValue; // high boundary of color space that is
// to be treated as Color Key, inclusive
} DDCOLORKEY, * LPDDCOLORKEY;
/*
* DDARGB
* Generic pixel format with 8-bit RGB and alpha components
*/
typedef struct _DDARGB
{
BYTE blue;
BYTE green;
BYTE red;
BYTE alpha;
} DDARGB, *LPDDARGB;
/*
* DDBLTFX
*/
typedef struct _DDBLTFX
{
DWORD dwSize; // size of structure
DWORD dwROP; // Win32 raster operations
DWORD dwFillColor; // color in RGB or Palettized (Brush value for Win32 ROPs)
DDCOLORKEY ddckDestColorkey; // DestColorkey override
DDCOLORKEY ddckSrcColorkey; // SrcColorkey override
} DDBLTFX, * LPDDBLTFX;
/*
* DDALPHABLTFX
*/
typedef struct _DDALPHABLTFX
{
DWORD dwSize; // size of structure
DDARGB ddargbScaleFactors; // Constant scaling factors
DWORD dwFillColor; // color in ARGB or Palettized
} DDALPHABLTFX, * LPDDALPHABLTFX;
/*
* DDSCAPS
* Caps bits defined below.
*/
typedef struct _DDSCAPS
{
DWORD dwCaps;
} DDSCAPS, * LPDDSCAPS;
/*
* DDCAPS
*/
#define DD_ROP_SPACE (256/32) // space required to store ROP array
typedef struct _DDCAPS
{
DWORD dwSize; // size of the DDCAPS structure
// Surface capabilities
DWORD dwVidMemTotal; // total amount of video memory
DWORD dwVidMemFree; // amount of free video memory
DWORD dwVidMemStride; // video memory stride (0 if linear)
DDSCAPS ddsCaps; // surface caps
DWORD dwNumFourCCCodes; // number of four cc codes
// Palette capabilities
DWORD dwPalCaps; // palette capabilities
// Hardware blitting capabilities
DWORD dwBltCaps; // driver specific capabilities
DWORD dwCKeyCaps; // color key blitting capabilities
DWORD dwAlphaCaps; // alpha blitting capabilities
DWORD dwRops[DD_ROP_SPACE]; // ROPS supported
// Overlay capabilities
DWORD dwOverlayCaps; // general overlay capabilities.
DWORD dwMaxVisibleOverlays; // maximum number of visible overlays
DWORD dwCurrVisibleOverlays; // current number of visible overlays
DWORD dwAlignBoundarySrc; // source rectangle alignment
DWORD dwAlignSizeSrc; // source rectangle byte size
DWORD dwAlignBoundaryDest; // dest rectangle alignment
DWORD dwAlignSizeDest; // dest rectangle byte size
DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
// Miscalenous capabilies
DWORD dwMiscCaps;
} DDCAPS, * LPDDCAPS;
/*
* DDPIXELFORMAT
*/
typedef struct _DDPIXELFORMAT
{
DWORD dwSize; // size of structure
DWORD dwFlags; // pixel format flags
DWORD dwFourCC; // (FOURCC code)
union
{
DWORD dwRGBBitCount; // how many bits per pixel
DWORD dwYUVBitCount; // how many bits per pixel
DWORD dwAlphaBitDepth; // how many bits for alpha channels
};
union
{
DWORD dwRBitMask; // mask for red bit
DWORD dwYBitMask; // mask for Y bits
};
union
{
DWORD dwGBitMask; // mask for green bits
DWORD dwUBitMask; // mask for U bits
};
union
{
DWORD dwBBitMask; // mask for blue bits
DWORD dwVBitMask; // mask for V bits
};
union
{
DWORD dwRGBAlphaBitMask; // mask for alpha channel
};
} DDPIXELFORMAT, * LPDDPIXELFORMAT;
/*
* DDPIXELFORMAT dwFlags values.
*/
#define DDPF_ALPHAPIXELS 0x00000001
#define DDPF_ALPHA 0x00000002
#define DDPF_FOURCC 0x00000004
#define DDPF_PALETTEINDEXED 0x00000020
#define DDPF_RGB 0x00000040
#define DDPF_ALPHAPREMULT 0x00008000
#define DDPF_VALID (DDPF_ALPHAPIXELS | \
DDPF_ALPHA | \
DDPF_FOURCC | \
DDPF_PALETTEINDEXED | \
DDPF_RGB | \
DDPF_ALPHAPREMULT)
/*
* DDSURFACEDESC
*/
typedef struct _DDSURFACEDESC
{
DWORD dwSize; // size of the DDSURFACEDESC structure
DWORD dwFlags; // determines what fields are valid
DWORD dwHeight; // height of surface to be created
DWORD dwWidth; // width of input surface
LONG lPitch; // bytes to next line down (return value only)
LONG lXPitch; // bytes to next pixel right (return value only)
DWORD dwBackBufferCount; // number of back buffers requested
DWORD dwRefreshRate; // refresh rate (used when display mode is described)
LPVOID lpSurface; // pointer to the associated surface memory
DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use
DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface
DDSCAPS ddsCaps; // direct draw surface capabilities
DWORD dwSurfaceSize; // Surface size, in bytes
} DDSURFACEDESC, * LPDDSURFACEDESC;
/*
* DDSURFACEDESC dwFlags values.
*/
#define DDSD_CAPS 0x00000001
#define DDSD_HEIGHT 0x00000002
#define DDSD_WIDTH 0x00000004
#define DDSD_PITCH 0x00000008
#define DDSD_XPITCH 0x00000010
#define DDSD_BACKBUFFERCOUNT 0x00000020
#define DDSD_LPSURFACE 0x00000800
#define DDSD_PIXELFORMAT 0x00001000
#define DDSD_CKDESTOVERLAY 0x00002000
#define DDSD_CKDESTBLT 0x00004000
#define DDSD_CKSRCOVERLAY 0x00008000
#define DDSD_CKSRCBLT 0x00010000
#define DDSD_REFRESHRATE 0x00040000
#define DDSD_SURFACESIZE 0x00080000
#define DDSD_VALID (DDSD_CAPS | \
DDSD_HEIGHT | \
DDSD_WIDTH | \
DDSD_PITCH | \
DDSD_XPITCH | \
DDSD_BACKBUFFERCOUNT | \
DDSD_LPSURFACE | \
DDSD_PIXELFORMAT | \
DDSD_CKDESTOVERLAY | \
DDSD_CKDESTBLT | \
DDSD_CKSRCOVERLAY | \
DDSD_CKSRCBLT | \
DDSD_REFRESHRATE | \
DDSD_SURFACESIZE)
#define DDSD_ENUM_VALID (DDSD_CAPS | \
DDSD_HEIGHT | \
DDSD_WIDTH | \
DDSD_PIXELFORMAT)
/*
* DDOVERLAYFX
*/
typedef struct _DDOVERLAYFX
{
DWORD dwSize; // size of structure
DWORD dwAlphaConstBitDepth; // Bit depth used to specify alpha constant.
DWORD dwAlphaConst; // Constant to use as alpha channel.
DDCOLORKEY dckDestColorkey; // DestColorkey override
DDCOLORKEY dckSrcColorkey; // DestColorkey override
} DDOVERLAYFX, * LPDDOVERLAYFX;
/*
* DDGAMMARAMP
*/
typedef struct _DDGAMMARAMP
{
WORD red[256];
WORD green[256];
WORD blue[256];
} DDGAMMARAMP, * LPDDGAMMARAMP;
/*
* This is the structure within which DirectDraw returns data about the current graphics driver and chipset
*/
#define MAX_DDDEVICEID_STRING 512
typedef struct _DDDEVICEIDENTIFIER
{
/*
* These elements are for presentation to the user only. They should not be used to identify particular
* drivers, since this is unreliable and many different strings may be associated with the same
* device, and the same driver from different vendors.
*/
wchar_t szDriver[MAX_DDDEVICEID_STRING];
wchar_t szDescription[MAX_DDDEVICEID_STRING];
/*
* This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
* on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
* drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
*
* This version has the form:
* wProduct = HIWORD(liDriverVersion.HighPart)
* wVersion = LOWORD(liDriverVersion.HighPart)
* wSubVersion = HIWORD(liDriverVersion.LowPart)
* wBuild = LOWORD(liDriverVersion.LowPart)
*/
LARGE_INTEGER liDriverVersion;
/*
* These elements can be used to identify particular chipsets. Use with extreme caution.
* dwVendorId Identifies the manufacturer. May be zero if unknown.
* dwDeviceId Identifies the type of chipset. May be zero if unknown.
* dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown.
* dwRevision Identifies the revision level of the chipset. May be zero if unknown.
*/
DWORD dwVendorId;
DWORD dwDeviceId;
DWORD dwSubSysId;
DWORD dwRevision;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -