ddraw.h
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:12k
源码类别:

Windows CE

开发平台:

C/C++

  1. #define DD_OK 0
  2. typedef struct IDirectDraw *LPDIRECTDRAW;
  3. typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE;
  4. typedef struct IDirectDrawClipper *LPDIRECTDRAWCLIPPER;
  5. typedef struct IDirectDrawPalette *LPDIRECTDRAWPALETTE;
  6. static const guid IID_IDirectDraw = { 0x6C14DB80, 0xA733, 0x11CE, { 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60 }};
  7. typedef struct DDSCAPS
  8. {
  9.     DWORD dwCaps;
  10. } DDSCAPS;
  11. typedef DDSCAPS *LPDDSCAPS;
  12. typedef struct DDCAPS
  13. {
  14. DWORD dwSize;
  15. DWORD dwCaps;
  16. DWORD dwCaps2;
  17. DWORD dwCKeyCaps;
  18. DWORD dwFXCaps;
  19. DWORD dwFXAlphaCaps;
  20. DWORD dwPalCaps;
  21. DWORD dwSVCaps;
  22. DWORD dwAlphaBltConstBitDepths;
  23. DWORD dwAlphaBltPixelBitDepths;
  24. DWORD dwAlphaBltSurfaceBitDepths;
  25. DWORD dwAlphaOverlayConstBitDepths;
  26. DWORD dwAlphaOverlayPixelBitDepths;
  27. DWORD dwAlphaOverlaySurfaceBitDepths;
  28. DWORD dwZBufferBitDepths;
  29. DWORD dwVidMemTotal;
  30. DWORD dwVidMemFree;
  31. DWORD dwMaxVisibleOverlays;
  32. DWORD dwCurrVisibleOverlays;
  33. DWORD dwNumFourCCCodes;
  34. DWORD dwAlignBoundarySrc;
  35. DWORD dwAlignSizeSrc;
  36. DWORD dwAlignBoundaryDest;
  37. DWORD dwAlignSizeDest;
  38. DWORD dwAlignStrideAlign;
  39. DWORD dwRops[8];
  40. DDSCAPS ddsCaps;
  41. DWORD dwMinOverlayStretch;
  42. DWORD dwMaxOverlayStretch;
  43. DWORD dwMinLiveVideoStretch;
  44. DWORD dwMaxLiveVideoStretch;
  45. DWORD dwMinHwCodecStretch;
  46. DWORD dwMaxHwCodecStretch;
  47. DWORD dwReserved1;
  48. DWORD dwReserved2;
  49. DWORD dwReserved3;
  50. DWORD dwSVBCaps;
  51. DWORD dwSVBCKeyCaps;
  52. DWORD dwSVBFXCaps;
  53. DWORD dwSVBRops[8];
  54. DWORD dwVSBCaps;
  55. DWORD dwVSBCKeyCaps;
  56. DWORD dwVSBFXCaps;
  57. DWORD dwVSBRops[8];
  58. DWORD dwSSBCaps;
  59. DWORD dwSSBCKeyCaps;
  60. DWORD dwSSBFXCaps;
  61. DWORD dwSSBRops[8];
  62. DWORD dwReserved4;
  63. DWORD dwReserved5;
  64. DWORD dwReserved6;
  65. } DDCAPS;
  66. typedef DDCAPS *LPDDCAPS;
  67. typedef struct DDCOLORKEY
  68. {
  69.     DWORD dwColorSpaceLowValue;
  70.     DWORD dwColorSpaceHighValue;
  71. } DDCOLORKEY;
  72. typedef DDCOLORKEY *LPDDCOLORKEY;
  73. typedef struct DDOVERLAYFX
  74. {
  75.     DWORD dwSize;
  76.     DWORD dwAlphaEdgeBlendBitDepth;
  77.     DWORD dwAlphaEdgeBlend;
  78.     DWORD dwReserved;
  79.     DWORD dwAlphaDestConstBitDepth;
  80. DWORD dwAlphaDestConst;
  81.     DWORD dwAlphaSrcConstBitDepth;
  82. DWORD dwAlphaSrcConst;
  83.     DDCOLORKEY dckDestColorkey;
  84.     DDCOLORKEY dckSrcColorkey;
  85.     DWORD   dwDDFX;
  86.     DWORD dwFlags;
  87. } DDOVERLAYFX;
  88. typedef DDOVERLAYFX *LPDDOVERLAYFX;
  89. typedef struct DDPIXELFORMAT
  90. {
  91. DWORD dwSize;
  92. DWORD dwFlags;
  93. DWORD dwFourCC;
  94. DWORD dwRGBBitCount;
  95. DWORD dwRBitMask;
  96. DWORD dwGBitMask;
  97. DWORD dwBBitMask;
  98. DWORD dwRGBAlphaBitMask;
  99. } DDPIXELFORMAT;
  100. typedef DDPIXELFORMAT *LPDDPIXELFORMAT;
  101. typedef struct DDSURFACEDESC
  102. {
  103. DWORD dwSize;
  104. DWORD dwFlags;
  105. DWORD dwHeight;
  106. DWORD dwWidth;
  107. LONG lPitch;
  108. DWORD dwBackBufferCount;
  109. DWORD dwRefreshRate;
  110. DWORD dwAlphaBitDepth;
  111. DWORD dwReserved;
  112. LPVOID lpSurface;
  113. DDCOLORKEY ddckCKDestOverlay;
  114. DDCOLORKEY ddckCKDestBlt;
  115. DDCOLORKEY ddckCKSrcOverlay;
  116. DDCOLORKEY ddckCKSrcBlt;
  117. DDPIXELFORMAT ddpfPixelFormat;
  118. DDSCAPS ddsCaps;
  119. } DDSURFACEDESC;
  120. typedef DDSURFACEDESC *LPDDSURFACEDESC;
  121. #define DDPF_FOURCC 0x00000004
  122. #define DDPF_RGB 0x00000040
  123. #define DDPF_PALETTEINDEXED4 0x00000008
  124. #define DDPF_PALETTEINDEXED8 0x00000020
  125. #define DDPF_PALETTEINDEXED1 0x00000800
  126. #define DDPF_PALETTEINDEXED2 0x00001000
  127. #define DDSD_CAPS 0x00000001
  128. #define DDSD_HEIGHT 0x00000002
  129. #define DDSD_WIDTH 0x00000004
  130. #define DDSD_PITCH 0x00000008
  131. #define DDSD_PIXELFORMAT 0x00001000
  132. #define DDSD_BACKBUFFERCOUNT 0x00000020
  133. #define DDCAPS_ALIGNBOUNDARYDEST 0x00000002
  134. #define DDCAPS_ALIGNSIZEDEST 0x00000004
  135. #define DDCAPS_BLTSTRETCH 0x00000200
  136. #define DDCAPS_OVERLAY 0x00000800
  137. #define DDCAPS_OVERLAYSTRETCH 0x00004000
  138. #define DDCAPS_COLORKEY 0x00400000
  139. #define DDSCAPS_BACKBUFFER 0x00000004
  140. #define DDSCAPS_COMPLEX 0x00000008
  141. #define DDSCAPS_FLIP 0x00000010
  142. #define DDSCAPS_OVERLAY 0x00000080
  143. #define DDSCAPS_PRIMARYSURFACE 0x00000200
  144. #define DDSCAPS_VIDEOMEMORY 0x00004000
  145. #define DDFXCAPS_BLTARITHSTRETCHY 0x00000020
  146. #define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000
  147. #define DDOVERFX_ARITHSTRETCHY 0x00000001
  148. #define DDLOCK_WAIT 0x00000001
  149. #define DDBLT_ASYNC 0x00000200
  150. #define DDOVER_HIDE 0x00000200
  151. #define DDOVER_KEYDEST 0x00000400
  152. #define DDOVER_KEYDESTOVERRIDE  0x00000800
  153. #define DDOVER_KEYSRC           0x00001000
  154. #define DDOVER_KEYSRCOVERRIDE   0x00002000
  155. #define DDOVER_SHOW 0x00004000
  156. #define DDOVER_DDFX             0x00080000
  157. #define DDCKEY_DESTOVERLAY 0x00000004
  158. #define DDSCL_NORMAL 0x00000008
  159. #define DDSCL_FULLSCREEN 0x00000001
  160. #define DDSCL_EXCLUSIVE         0x00000010
  161. #define DDFLIP_WAIT 0x00000001
  162. #define DDFLIP_NOVSYNC 0x00000008
  163. #define DDERR_SURFACELOST 0x887601C2
  164. typedef struct IDirectDrawVMT
  165. {
  166.     HRESULT (STDCALL* QueryInterface)(struct IDirectDraw*, const guid*, LPVOID*);
  167.     ULONG (STDCALL* AddRef)(struct IDirectDraw*);
  168.     ULONG (STDCALL* Release)(struct IDirectDraw*);
  169.     HRESULT (STDCALL* Compact)(struct IDirectDraw*);
  170.     HRESULT (STDCALL* CreateClipper)(struct IDirectDraw*, DWORD, LPDIRECTDRAWCLIPPER*, void* );
  171.     HRESULT (STDCALL* CreatePalette)(struct IDirectDraw*, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE*, void* );
  172.     HRESULT (STDCALL* CreateSurface)(struct IDirectDraw*,  LPDDSURFACEDESC, LPDIRECTDRAWSURFACE*, void*);
  173.     HRESULT (STDCALL* DuplicateSurface)( struct IDirectDraw*, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE* );
  174.     HRESULT (STDCALL* EnumDisplayModes)( struct IDirectDraw*, DWORD, LPDDSURFACEDESC, LPVOID, void* );
  175.     HRESULT (STDCALL* EnumSurfaces)(struct IDirectDraw*, DWORD, LPDDSURFACEDESC, LPVOID, void* );
  176.     HRESULT (STDCALL* FlipToGDISurface)(struct IDirectDraw*);
  177.     HRESULT (STDCALL* GetCaps)( struct IDirectDraw*, LPDDCAPS, LPDDCAPS);
  178.     HRESULT (STDCALL* GetDisplayMode)( struct IDirectDraw*, LPDDSURFACEDESC);
  179.     HRESULT (STDCALL* GetFourCCCodes)(struct IDirectDraw*,  LPDWORD, LPDWORD );
  180.     HRESULT (STDCALL* GetGDISurface)(struct IDirectDraw*, LPDIRECTDRAWSURFACE*);
  181.     HRESULT (STDCALL* GetMonitorFrequency)(struct IDirectDraw*, LPDWORD);
  182.     HRESULT (STDCALL* GetScanLine)(struct IDirectDraw*, LPDWORD);
  183.     HRESULT (STDCALL* GetVerticalBlankStatus)(struct IDirectDraw*, LPBOOL );
  184.     HRESULT (STDCALL* Initialize)(struct IDirectDraw*, GUID*);
  185.     HRESULT (STDCALL* RestoreDisplayMode)(struct IDirectDraw*);
  186.     HRESULT (STDCALL* SetCooperativeLevel)(struct IDirectDraw*, HWND, DWORD);
  187.     HRESULT (STDCALL* SetDisplayMode)(struct IDirectDraw*, DWORD, DWORD,DWORD);
  188.     HRESULT (STDCALL* WaitForVerticalBlank)(struct IDirectDraw*, DWORD, HANDLE );
  189. } IDirectDrawVMT;
  190. typedef struct IDirectDraw
  191. {
  192. IDirectDrawVMT *VMT;
  193. } IDirectDraw;
  194. #define IDirectDraw_QueryInterface(p,a,b) (p)->VMT->QueryInterface(p,a,b)
  195. #define IDirectDraw_Release(p) (p)->VMT->Release(p)
  196. #define IDirectDraw_CreateSurface(p,a,b,c) (p)->VMT->CreateSurface(p,a,b,c)
  197. #define IDirectDraw_GetDisplayMode(p,a)         (p)->VMT->GetDisplayMode(p,a)
  198. #define IDirectDraw_SetCooperativeLevel(p,a,b)  (p)->VMT->SetCooperativeLevel(p,a,b)
  199. #define IDirectDraw_GetCaps(p,a,b)              (p)->VMT->GetCaps(p,a,b)
  200. #define IDirectDraw_GetFourCCCodes(p,a,b) (p)->VMT->GetFourCCCodes(p,a,b)
  201. #define IDirectDraw_CreateClipper(p,a,b,c) (p)->VMT->CreateClipper(p,a,b,c)
  202. typedef struct IDirectDrawSurfaceVMT
  203. {
  204.     HRESULT (STDCALL* QueryInterface)(struct IDirectDrawSurface*, void*, LPVOID*);
  205.     ULONG (STDCALL* AddRef)(struct IDirectDrawSurface*);
  206.     ULONG (STDCALL* Release)(struct IDirectDrawSurface*);
  207.     HRESULT (STDCALL* AddAttachedSurface)(struct IDirectDrawSurface*, LPDIRECTDRAWSURFACE);
  208.     HRESULT (STDCALL* AddOverlayDirtyRect)(struct IDirectDrawSurface*, LPRECT);
  209.     HRESULT (STDCALL* Blt)(struct IDirectDrawSurface*, LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, void*);
  210.     HRESULT (STDCALL* BltBatch)(struct IDirectDrawSurface*, void*, DWORD, DWORD );
  211.     HRESULT (STDCALL* BltFast)(struct IDirectDrawSurface*, DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD);
  212.     HRESULT (STDCALL* DeleteAttachedSurface)(struct IDirectDrawSurface*, DWORD,LPDIRECTDRAWSURFACE);
  213.     HRESULT (STDCALL* EnumAttachedSurfaces)(struct IDirectDrawSurface*, LPVOID,void*);
  214.     HRESULT (STDCALL* EnumOverlayZOrders)(struct IDirectDrawSurface*, DWORD,LPVOID,void*);
  215.     HRESULT (STDCALL* Flip)(struct IDirectDrawSurface*, LPDIRECTDRAWSURFACE, DWORD);
  216.     HRESULT (STDCALL* GetAttachedSurface)(struct IDirectDrawSurface*, LPDDSCAPS, LPDIRECTDRAWSURFACE*);
  217.     HRESULT (STDCALL* GetBltStatus)(struct IDirectDrawSurface*, DWORD);
  218.     HRESULT (STDCALL* GetCaps)(struct IDirectDrawSurface*, LPDDSCAPS);
  219.     HRESULT (STDCALL* GetClipper)(struct IDirectDrawSurface*, LPDIRECTDRAWCLIPPER*);
  220.     HRESULT (STDCALL* GetColorKey)(struct IDirectDrawSurface*, DWORD, LPDDCOLORKEY);
  221.     HRESULT (STDCALL* GetDC)(struct IDirectDrawSurface*, HDC*);
  222.     HRESULT (STDCALL* GetFlipStatus)(struct IDirectDrawSurface*, DWORD);
  223.     HRESULT (STDCALL* GetOverlayPosition)(struct IDirectDrawSurface*, LPLONG, LPLONG );
  224.     HRESULT (STDCALL* GetPalette)(struct IDirectDrawSurface*, LPDIRECTDRAWPALETTE*);
  225.     HRESULT (STDCALL* GetPixelFormat)(struct IDirectDrawSurface*, LPDDPIXELFORMAT);
  226.     HRESULT (STDCALL* GetSurfaceDesc)(struct IDirectDrawSurface*, LPDDSURFACEDESC);
  227.     HRESULT (STDCALL* Initialize)(struct IDirectDrawSurface*, LPDIRECTDRAW, LPDDSURFACEDESC);
  228.     HRESULT (STDCALL* IsLost)(struct IDirectDrawSurface*);
  229.     HRESULT (STDCALL* Lock)(struct IDirectDrawSurface*, LPRECT,LPDDSURFACEDESC,DWORD,HANDLE);
  230.     HRESULT (STDCALL* ReleaseDC)(struct IDirectDrawSurface*, HDC);
  231.     HRESULT (STDCALL* Restore)(struct IDirectDrawSurface*);
  232.     HRESULT (STDCALL* SetClipper)(struct IDirectDrawSurface*, LPDIRECTDRAWCLIPPER);
  233.     HRESULT (STDCALL* SetColorKey)(struct IDirectDrawSurface*, DWORD, LPDDCOLORKEY);
  234.     HRESULT (STDCALL* SetOverlayPosition)(struct IDirectDrawSurface*, LONG, LONG );
  235.     HRESULT (STDCALL* SetPalette)(struct IDirectDrawSurface*, LPDIRECTDRAWPALETTE);
  236.     HRESULT (STDCALL* Unlock)(struct IDirectDrawSurface*, LPVOID);
  237.     HRESULT (STDCALL* UpdateOverlay)(struct IDirectDrawSurface*, LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX);
  238.     HRESULT (STDCALL* UpdateOverlayDisplay)(struct IDirectDrawSurface*, DWORD);
  239.     HRESULT (STDCALL* UpdateOverlayZOrder)(struct IDirectDrawSurface*, DWORD, LPDIRECTDRAWSURFACE);
  240. } IDirectDrawSurfaceVMT;
  241. typedef struct IDirectDrawSurface
  242. {
  243. IDirectDrawSurfaceVMT *VMT;
  244. } IDirectDrawSurface;
  245. #define IDirectDrawSurface_Release(p) (p)->VMT->Release(p)
  246. #define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->VMT->Blt(p,a,b,c,d,e)
  247. #define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->VMT->GetSurfaceDesc(p,a)
  248. #define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->VMT->Lock(p,a,b,c,d)
  249. #define IDirectDrawSurface_Unlock(p,b) (p)->VMT->Unlock(p,b)
  250. #define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->VMT->UpdateOverlay(p,a,b,c,d,e)
  251. #define IDirectDrawSurface_SetColorKey(p,a,b)           (p)->VMT->SetColorKey(p,a,b)
  252. #define IDirectDrawSurface_Restore(p)                   (p)->VMT->Restore(p)
  253. #define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->VMT->GetAttachedSurface(p,a,b)
  254. #define IDirectDrawSurface_Flip(p,a,b) (p)->VMT->Flip(p,a,b)
  255. #define IDirectDrawSurface_SetClipper(p,a) (p)->VMT->SetClipper(p,a)
  256. typedef struct IDirectDrawClipperVMT
  257. {
  258.     HRESULT (STDCALL* QueryInterface)(struct IDirectDrawClipper*, void*, LPVOID*);
  259.     ULONG (STDCALL* AddRef)(struct IDirectDrawClipper*);
  260.     ULONG (STDCALL* Release)(struct IDirectDrawClipper*);
  261.     HRESULT (STDCALL* GetClipList)(struct IDirectDrawClipper*, LPRECT, LPRGNDATA, LPDWORD);
  262.     HRESULT (STDCALL* GetHWnd)(struct IDirectDrawClipper*, HWND*);
  263.     HRESULT (STDCALL* Initialize)(struct IDirectDrawClipper*, LPDIRECTDRAW, DWORD);
  264.     HRESULT (STDCALL* IsClipListChanged)(struct IDirectDrawClipper*, BOOL*);
  265.     HRESULT (STDCALL* SetClipList)(struct IDirectDrawClipper*, LPRGNDATA,DWORD);
  266.     HRESULT (STDCALL* SetHWnd)(struct IDirectDrawClipper*, DWORD, HWND);
  267. } IDirectDrawClipperVMT;
  268. typedef struct IDirectDrawClipper
  269. {
  270. IDirectDrawClipperVMT *VMT;
  271. } IDirectDrawClipper;
  272. #define IDirectDrawClipper_Release(p) (p)->VMT->Release(p)
  273. #define IDirectDrawClipper_SetHWnd(p,a,b) (p)->VMT->SetHWnd(p,a,b)