DrawSprocket.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:17k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       DrawSprocket.h
  3.  
  4.      Contains:   Games Sprockets: DrawSprocket interfaces
  5.  
  6.      Version:    Technology: Draw Sprocket 1.7
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1996-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DRAWSPROCKET__
  18. #define __DRAWSPROCKET__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __EVENTS__
  23. #include "Events.h"
  24. #endif
  25. #ifndef __QUICKDRAW__
  26. #include "Quickdraw.h"
  27. #endif
  28. #ifndef __QDOFFSCREEN__
  29. #include "QDOffscreen.h"
  30. #endif
  31. #ifndef __DISPLAYS__
  32. #include "Displays.h"
  33. #endif
  34. #ifndef __MACERRORS__
  35. #include "MacErrors.h"
  36. #endif
  37. #if PRAGMA_ONCE
  38. #pragma once
  39. #endif
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46. #if PRAGMA_STRUCT_ALIGN
  47.     #pragma options align=power
  48. #elif PRAGMA_STRUCT_PACKPUSH
  49.     #pragma pack(push, 2)
  50. #elif PRAGMA_STRUCT_PACK
  51.     #pragma pack(2)
  52. #endif
  53. #if PRAGMA_ENUM_ALWAYSINT
  54.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  55.         #define __DRAWSPROCKET__RESTORE_TWOBYTEINTS
  56.         #pragma fourbyteints on
  57.     #endif
  58.     #pragma enumsalwaysint on
  59. #elif PRAGMA_ENUM_OPTIONS
  60.     #pragma option enum=int
  61. #elif PRAGMA_ENUM_PACK
  62.     #if __option(pack_enums)
  63.         #define __DRAWSPROCKET__RESTORE_PACKED_ENUMS
  64.         #pragma options(!pack_enums)
  65.     #endif
  66. #endif
  67. /*
  68. ********************************************************************************
  69. ** constants
  70. ********************************************************************************
  71. */
  72. enum DSpDepthMask {
  73.     kDSpDepthMask_1             = 1 << 0,
  74.     kDSpDepthMask_2             = 1 << 1,
  75.     kDSpDepthMask_4             = 1 << 2,
  76.     kDSpDepthMask_8             = 1 << 3,
  77.     kDSpDepthMask_16            = 1 << 4,
  78.     kDSpDepthMask_32            = 1 << 5,
  79.     kDSpDepthMask_All           = -1L
  80. };
  81. typedef enum DSpDepthMask DSpDepthMask;
  82. enum DSpColorNeeds {
  83.     kDSpColorNeeds_DontCare     = 0L,
  84.     kDSpColorNeeds_Request      = 1L,
  85.     kDSpColorNeeds_Require      = 2L
  86. };
  87. typedef enum DSpColorNeeds DSpColorNeeds;
  88. enum DSpContextState {
  89.     kDSpContextState_Active     = 0L,
  90.     kDSpContextState_Paused     = 1L,
  91.     kDSpContextState_Inactive   = 2L
  92. };
  93. typedef enum DSpContextState DSpContextState;
  94. /* kDSpContextOption_QD3DAccel not yet implemented */
  95. enum DSpContextOption {
  96.                                                                 /*    kDSpContextOption_QD3DAccel       = 1<<0,*/
  97.     kDSpContextOption_PageFlip  = 1 << 1,
  98.     kDSpContextOption_DontSyncVBL = 1 << 2,
  99.     kDSpContextOption_Stereoscopic = 1 << 3
  100. };
  101. typedef enum DSpContextOption DSpContextOption;
  102. enum DSpAltBufferOption {
  103.     kDSpAltBufferOption_RowBytesEqualsWidth = 1 << 0
  104. };
  105. typedef enum DSpAltBufferOption DSpAltBufferOption;
  106. enum DSpBufferKind {
  107.     kDSpBufferKind_Normal       = 0
  108. };
  109. typedef enum DSpBufferKind DSpBufferKind;
  110. enum DSpBlitMode {
  111.     kDSpBlitMode_Plain          = 0,
  112.     kDSpBlitMode_SrcKey         = 1 << 0,
  113.     kDSpBlitMode_DstKey         = 1 << 1,
  114.     kDSpBlitMode_Interpolation  = 1 << 2
  115. };
  116. typedef enum DSpBlitMode DSpBlitMode;
  117. /*
  118. ********************************************************************************
  119. ** data types
  120. ********************************************************************************
  121. */
  122. typedef struct OpaqueDSpAltBufferReference*  DSpAltBufferReference;
  123. typedef struct OpaqueDSpContextReference*  DSpContextReference;
  124. #define kDSpEveryContext ((DSpContextReference)NULL)
  125. typedef CALLBACK_API_C( Boolean , DSpEventProcPtr )(EventRecord *inEvent);
  126. typedef CALLBACK_API_C( Boolean , DSpCallbackProcPtr )(DSpContextReference inContext, void *inRefCon);
  127. struct DSpContextAttributes {
  128.     Fixed                           frequency;
  129.     UInt32                          displayWidth;
  130.     UInt32                          displayHeight;
  131.     UInt32                          reserved1;
  132.     UInt32                          reserved2;
  133.     UInt32                          colorNeeds;
  134.     CTabHandle                      colorTable;
  135.     OptionBits                      contextOptions;
  136.     OptionBits                      backBufferDepthMask;
  137.     OptionBits                      displayDepthMask;
  138.     UInt32                          backBufferBestDepth;
  139.     UInt32                          displayBestDepth;
  140.     UInt32                          pageCount;
  141.     char                            filler[3];
  142.     Boolean                         gameMustConfirmSwitch;
  143.     UInt32                          reserved3[4];
  144. };
  145. typedef struct DSpContextAttributes     DSpContextAttributes;
  146. typedef DSpContextAttributes *          DSpContextAttributesPtr;
  147. struct DSpAltBufferAttributes {
  148.     UInt32                          width;
  149.     UInt32                          height;
  150.     DSpAltBufferOption              options;
  151.     UInt32                          reserved[4];
  152. };
  153. typedef struct DSpAltBufferAttributes   DSpAltBufferAttributes;
  154. typedef struct DSpBlitInfo              DSpBlitInfo;
  155. typedef CALLBACK_API_C( void , DSpBlitDoneProc )(DSpBlitInfo *info);
  156. struct DSpBlitInfo {
  157.     Boolean                         completionFlag;
  158.     char                            filler[3];
  159.     DSpBlitDoneProc                 completionProc;
  160.     DSpContextReference             srcContext;
  161.     CGrafPtr                        srcBuffer;
  162.     Rect                            srcRect;
  163.     UInt32                          srcKey;
  164.     DSpContextReference             dstContext;
  165.     CGrafPtr                        dstBuffer;
  166.     Rect                            dstRect;
  167.     UInt32                          dstKey;
  168.     DSpBlitMode                     mode;
  169.     UInt32                          reserved[4];
  170. };
  171. typedef DSpBlitInfo *                   DSpBlitInfoPtr;
  172. /*
  173. ********************************************************************************
  174. ** function prototypes
  175. ********************************************************************************
  176. */
  177. /*
  178. ** global operations
  179. */
  180. #if CALL_NOT_IN_CARBON
  181. EXTERN_API_C( OSStatus )
  182. DSpStartup                      (void);
  183. EXTERN_API_C( OSStatus )
  184. DSpShutdown                     (void);
  185. EXTERN_API_C( NumVersion )
  186. DSpGetVersion                   (void);
  187. EXTERN_API_C( OSStatus )
  188. DSpGetFirstContext              (DisplayIDType          inDisplayID,
  189.                                  DSpContextReference *  outContext);
  190. EXTERN_API_C( OSStatus )
  191. DSpGetNextContext               (DSpContextReference    inCurrentContext,
  192.                                  DSpContextReference *  outContext);
  193. EXTERN_API_C( OSStatus )
  194. DSpGetCurrentContext            (DisplayIDType          inDisplayID,
  195.                                  DSpContextReference *  outContext);
  196. EXTERN_API_C( OSStatus )
  197. DSpFindBestContext              (DSpContextAttributesPtr  inDesiredAttributes,
  198.                                  DSpContextReference *  outContext);
  199. EXTERN_API_C( OSStatus )
  200. DSpFindBestContextOnDisplayID   (DSpContextAttributesPtr  inDesiredAttributes,
  201.                                  DSpContextReference *  outContext,
  202.                                  DisplayIDType          inDisplayID);
  203. EXTERN_API_C( OSStatus )
  204. DSpCanUserSelectContext         (DSpContextAttributesPtr  inDesiredAttributes,
  205.                                  Boolean *              outUserCanSelectContext);
  206. EXTERN_API_C( OSStatus )
  207. DSpUserSelectContext            (DSpContextAttributesPtr  inDesiredAttributes,
  208.                                  DisplayIDType          inDialogDisplayLocation,
  209.                                  DSpEventProcPtr        inEventProc,
  210.                                  DSpContextReference *  outContext);
  211. EXTERN_API_C( OSStatus )
  212. DSpProcessEvent                 (EventRecord *          inEvent,
  213.                                  Boolean *              outEventWasProcessed);
  214. EXTERN_API_C( OSStatus )
  215. DSpSetBlankingColor             (const RGBColor *       inRGBColor);
  216. EXTERN_API_C( OSStatus )
  217. DSpSetDebugMode                 (Boolean                inDebugMode);
  218. EXTERN_API_C( OSStatus )
  219. DSpFindContextFromPoint         (Point                  inGlobalPoint,
  220.                                  DSpContextReference *  outContext);
  221. EXTERN_API_C( OSStatus )
  222. DSpGetMouse                     (Point *                outGlobalPoint);
  223. /*
  224. ** alternate buffer operations
  225. */
  226. EXTERN_API_C( OSStatus )
  227. DSpAltBuffer_New                (DSpContextReference    inContext,
  228.                                  Boolean                inVRAMBuffer,
  229.                                  DSpAltBufferAttributes * inAttributes,
  230.                                  DSpAltBufferReference * outAltBuffer);
  231. EXTERN_API_C( OSStatus )
  232. DSpAltBuffer_Dispose            (DSpAltBufferReference  inAltBuffer);
  233. EXTERN_API_C( OSStatus )
  234. DSpAltBuffer_InvalRect          (DSpAltBufferReference  inAltBuffer,
  235.                                  const Rect *           inInvalidRect);
  236. EXTERN_API_C( OSStatus )
  237. DSpAltBuffer_GetCGrafPtr        (DSpAltBufferReference  inAltBuffer,
  238.                                  DSpBufferKind          inBufferKind,
  239.                                  CGrafPtr *             outCGrafPtr,
  240.                                  GDHandle *             outGDevice);
  241. /*
  242. ** context operations
  243. */
  244. /* general */
  245. EXTERN_API_C( OSStatus )
  246. DSpContext_GetAttributes        (DSpContextReference    inContext,
  247.                                  DSpContextAttributesPtr  outAttributes);
  248. EXTERN_API_C( OSStatus )
  249. DSpContext_Reserve              (DSpContextReference    inContext,
  250.                                  DSpContextAttributesPtr  inDesiredAttributes);
  251. EXTERN_API_C( OSStatus )
  252. DSpContext_Queue                (DSpContextReference    inParentContext,
  253.                                  DSpContextReference    inChildContext,
  254.                                  DSpContextAttributesPtr  inDesiredAttributes);
  255. EXTERN_API_C( OSStatus )
  256. DSpContext_Switch               (DSpContextReference    inOldContext,
  257.                                  DSpContextReference    inNewContext);
  258. EXTERN_API_C( OSStatus )
  259. DSpContext_Release              (DSpContextReference    inContext);
  260. EXTERN_API_C( OSStatus )
  261. DSpContext_GetDisplayID         (DSpContextReference    inContext,
  262.                                  DisplayIDType *        outDisplayID);
  263. EXTERN_API_C( OSStatus )
  264. DSpContext_GlobalToLocal        (DSpContextReference    inContext,
  265.                                  Point *                ioPoint);
  266. EXTERN_API_C( OSStatus )
  267. DSpContext_LocalToGlobal        (DSpContextReference    inContext,
  268.                                  Point *                ioPoint);
  269. EXTERN_API_C( OSStatus )
  270. DSpContext_SetVBLProc           (DSpContextReference    inContext,
  271.                                  DSpCallbackProcPtr     inProcPtr,
  272.                                  void *                 inRefCon);
  273. EXTERN_API_C( OSStatus )
  274. DSpContext_GetFlattenedSize     (DSpContextReference    inContext,
  275.                                  UInt32 *               outFlatContextSize);
  276. EXTERN_API_C( OSStatus )
  277. DSpContext_Flatten              (DSpContextReference    inContext,
  278.                                  void *                 outFlatContext);
  279. EXTERN_API_C( OSStatus )
  280. DSpContext_Restore              (void *                 inFlatContext,
  281.                                  DSpContextReference *  outRestoredContext);
  282. EXTERN_API_C( OSStatus )
  283. DSpContext_GetMonitorFrequency  (DSpContextReference    inContext,
  284.                                  Fixed *                outFrequency);
  285. EXTERN_API_C( OSStatus )
  286. DSpContext_SetMaxFrameRate      (DSpContextReference    inContext,
  287.                                  UInt32                 inMaxFPS);
  288. EXTERN_API_C( OSStatus )
  289. DSpContext_GetMaxFrameRate      (DSpContextReference    inContext,
  290.                                  UInt32 *               outMaxFPS);
  291. EXTERN_API_C( OSStatus )
  292. DSpContext_SetState             (DSpContextReference    inContext,
  293.                                  DSpContextState        inState);
  294. EXTERN_API_C( OSStatus )
  295. DSpContext_GetState             (DSpContextReference    inContext,
  296.                                  DSpContextState *      outState);
  297. EXTERN_API_C( OSStatus )
  298. DSpContext_IsBusy               (DSpContextReference    inContext,
  299.                                  Boolean *              outBusyFlag);
  300. /* dirty rectangles */
  301. EXTERN_API_C( OSStatus )
  302. DSpContext_SetDirtyRectGridSize (DSpContextReference    inContext,
  303.                                  UInt32                 inCellPixelWidth,
  304.                                  UInt32                 inCellPixelHeight);
  305. EXTERN_API_C( OSStatus )
  306. DSpContext_GetDirtyRectGridSize (DSpContextReference    inContext,
  307.                                  UInt32 *               outCellPixelWidth,
  308.                                  UInt32 *               outCellPixelHeight);
  309. EXTERN_API_C( OSStatus )
  310. DSpContext_GetDirtyRectGridUnits (DSpContextReference   inContext,
  311.                                  UInt32 *               outCellPixelWidth,
  312.                                  UInt32 *               outCellPixelHeight);
  313. EXTERN_API_C( OSStatus )
  314. DSpContext_InvalBackBufferRect  (DSpContextReference    inContext,
  315.                                  const Rect *           inRect);
  316. /* underlays */
  317. EXTERN_API_C( OSStatus )
  318. DSpContext_SetUnderlayAltBuffer (DSpContextReference    inContext,
  319.                                  DSpAltBufferReference  inNewUnderlay);
  320. EXTERN_API_C( OSStatus )
  321. DSpContext_GetUnderlayAltBuffer (DSpContextReference    inContext,
  322.                                  DSpAltBufferReference * outUnderlay);
  323. /* gamma */
  324. EXTERN_API_C( OSStatus )
  325. DSpContext_FadeGammaOut         (DSpContextReference    inContext,
  326.                                  RGBColor *             inZeroIntensityColor);
  327. EXTERN_API_C( OSStatus )
  328. DSpContext_FadeGammaIn          (DSpContextReference    inContext,
  329.                                  RGBColor *             inZeroIntensityColor);
  330. EXTERN_API_C( OSStatus )
  331. DSpContext_FadeGamma            (DSpContextReference    inContext,
  332.                                  SInt32                 inPercentOfOriginalIntensity,
  333.                                  RGBColor *             inZeroIntensityColor);
  334. /* buffering */
  335. EXTERN_API_C( OSStatus )
  336. DSpContext_SwapBuffers          (DSpContextReference    inContext,
  337.                                  DSpCallbackProcPtr     inBusyProc,
  338.                                  void *                 inUserRefCon);
  339. EXTERN_API_C( OSStatus )
  340. DSpContext_GetBackBuffer        (DSpContextReference    inContext,
  341.                                  DSpBufferKind          inBufferKind,
  342.                                  CGrafPtr *             outBackBuffer);
  343. EXTERN_API_C( OSStatus )
  344. DSpContext_GetFrontBuffer       (DSpContextReference    inContext,
  345.                                  CGrafPtr *             outFrontBuffer);
  346. /* clut operations */
  347. EXTERN_API_C( OSStatus )
  348. DSpContext_SetCLUTEntries       (DSpContextReference    inContext,
  349.                                  const ColorSpec *      inEntries,
  350.                                  UInt16                 inStartingEntry,
  351.                                  UInt16                 inLastEntry);
  352. EXTERN_API_C( OSStatus )
  353. DSpContext_GetCLUTEntries       (DSpContextReference    inContext,
  354.                                  ColorSpec *            outEntries,
  355.                                  UInt16                 inStartingEntry,
  356.                                  UInt16                 inLastEntry);
  357. /* blit operations */
  358. EXTERN_API_C( OSStatus )
  359. DSpBlit_Faster                  (DSpBlitInfoPtr         inBlitInfo,
  360.                                  Boolean                inAsyncFlag);
  361. EXTERN_API_C( OSStatus )
  362. DSpBlit_Fastest                 (DSpBlitInfoPtr         inBlitInfo,
  363.                                  Boolean                inAsyncFlag);
  364. #endif  /* CALL_NOT_IN_CARBON */
  365. #if PRAGMA_ENUM_ALWAYSINT
  366.     #pragma enumsalwaysint reset
  367.     #ifdef __DRAWSPROCKET__RESTORE_TWOBYTEINTS
  368.         #pragma fourbyteints off
  369.     #endif
  370. #elif PRAGMA_ENUM_OPTIONS
  371.     #pragma option enum=reset
  372. #elif defined(__DRAWSPROCKET__RESTORE_PACKED_ENUMS)
  373.     #pragma options(pack_enums)
  374. #endif
  375. #if PRAGMA_STRUCT_ALIGN
  376.     #pragma options align=reset
  377. #elif PRAGMA_STRUCT_PACKPUSH
  378.     #pragma pack(pop)
  379. #elif PRAGMA_STRUCT_PACK
  380.     #pragma pack()
  381. #endif
  382. #ifdef PRAGMA_IMPORT_OFF
  383. #pragma import off
  384. #elif PRAGMA_IMPORT
  385. #pragma import reset
  386. #endif
  387. #ifdef __cplusplus
  388. }
  389. #endif
  390. #endif /* __DRAWSPROCKET__ */