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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       RAVESystem.h
  3.  
  4.      Contains:   Interfaces needed when building RAVE engines
  5.  
  6.      Version:    Technology: Quickdraw 3D 1.6
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1995-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 __RAVESYSTEM__
  18. #define __RAVESYSTEM__
  19. #ifndef __CONDITIONALMACROS__
  20. #include "ConditionalMacros.h"
  21. #endif
  22. #ifndef __RAVE__
  23. #include "RAVE.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=power
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. #if PRAGMA_ENUM_ALWAYSINT
  42.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  43.         #define __RAVESYSTEM__RESTORE_TWOBYTEINTS
  44.         #pragma fourbyteints on
  45.     #endif
  46.     #pragma enumsalwaysint on
  47. #elif PRAGMA_ENUM_OPTIONS
  48.     #pragma option enum=int
  49. #elif PRAGMA_ENUM_PACK
  50.     #if __option(pack_enums)
  51.         #define __RAVESYSTEM__RESTORE_PACKED_ENUMS
  52.         #pragma options(!pack_enums)
  53.     #endif
  54. #endif
  55. /************************************************************************************************
  56.  *
  57.  * Typedefs of texture/bitmap method functions provided by the drawing engine.
  58.  *
  59.  ***********************************************************************************************/
  60. /* TQAColorTableNew parameter descriptions */
  61. /* TQAColorTableType    pixelType           Depth, color space, etc. */
  62. /* void                 *pixelData          lookup table entries in pixelType format */
  63. /* long                 transparentIndex    boolean, false means no transparency, true means index 0 is transparent */
  64. /* TQAColorTable        **newTable          (Out) Newly created TQAColorTable */
  65. typedef CALLBACK_API_C( TQAError , TQAColorTableNew )(TQAColorTableType pixelType, void *pixelData, long transparentIndex, TQAColorTable **newTable);
  66. /* TQAColorTableDelete  parameter descriptions */
  67. /* TQAColorTable        *colorTable     Previously allocated by QAColorTableNew() */
  68. typedef CALLBACK_API_C( void , TQAColorTableDelete )(TQAColorTable *colorTable);
  69. /* TQATextureNew    parameter descriptions */
  70. /*  unsigned long       flags               Mask of kQATexture_xxx flags */
  71. /*  TQAImagePixelType   pixelType           Depth, color space, etc. */
  72. /*  const TQAImage      images[]            Image(s) for texture */
  73. /*  TQATexture          **newTexture        (Out) Newly created TQATexture, or NULL on error */
  74. typedef CALLBACK_API_C( TQAError , TQATextureNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage images[], TQATexture **newTexture);
  75. /* TQATextureDetach parameter descriptions */
  76. /*  TQATexture          *texture            Previously allocated by QATextureNew() */
  77. typedef CALLBACK_API_C( TQAError , TQATextureDetach )(TQATexture *texture);
  78. /* TQATextureDelete parameter descriptions */
  79. /*  TQATexture          *texture            Previously allocated by QATextureNew() */
  80. typedef CALLBACK_API_C( void , TQATextureDelete )(TQATexture *texture);
  81. /* TQATextureBindColorTable parameter descriptions */
  82. /*  TQATexture          *texture            Previously allocated by QATextureNew() */
  83. /*  TQAColorTable       *colorTable         Previously allocated by QAColorTableNew() */
  84. typedef CALLBACK_API_C( TQAError , TQATextureBindColorTable )(TQATexture *texture, TQAColorTable *colorTable);
  85. /* TQABitmapNew parameter descriptions */
  86. /*  unsigned long       flags               Mask of kQABitmap_xxx flags */
  87. /*  TQAImagePixelType   pixelType           Depth, color space, etc. */
  88. /*  const TQAImage      *image              Image */
  89. /*  TQABitmap           **newBitmap         (Out) Newly created TQABitmap, or NULL on error */
  90. typedef CALLBACK_API_C( TQAError , TQABitmapNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage *image, TQABitmap **newBitmap);
  91. /* TQABitmapDetach  parameter descriptions */
  92. /*  TQABitmap           *bitmap         Previously allocated by QABitmapNew() */
  93. typedef CALLBACK_API_C( TQAError , TQABitmapDetach )(TQABitmap *bitmap);
  94. /* TQABitmapDelete  parameter descriptions */
  95. /*  TQABitmap           *bitmap         Previously allocated by QABitmapNew() */
  96. typedef CALLBACK_API_C( void , TQABitmapDelete )(TQABitmap *bitmap);
  97. /* TQABitmapBindColorTable  parameter descriptions */
  98. /*  TQABitmap           *bitmap         Previously allocated by QABitmapNew() */
  99. /*  TQAColorTable       *colorTable     Previously allocated by QAColorTableNew() */
  100. typedef CALLBACK_API_C( TQAError , TQABitmapBindColorTable )(TQABitmap *bitmap, TQAColorTable *colorTable);
  101. /************************************************************************************************
  102.  *
  103.  * Typedefs of private (system-only) functions provided by the drawing engine.
  104.  *
  105.  * The TQADrawPrivateNew function returns a TQADrawPrivate *, which points to the
  106.  * engine-specific private data created for the context. (TQADrawPrivate is a dummy
  107.  * type which is then cast to the correct engine-specific datatype by the engine code.)
  108.  *
  109.  * The TQADrawPrivateDelete function deletes the engine-specific private data.
  110.  *
  111.  * TQAStorePrivateNew and TQAStorePrivateDelete provide the same function as QADrawPrivateNew
  112.  * and TQADrawPrivateDelete, but for the texture and bitmap storage context.
  113.  *
  114.  * TQADrawMethodGet and TQAStoreMethodGet are called by the RAVE manager to retrieve
  115.  * the method pointers for a drawing engine.
  116.  *
  117.  * The TQAEngineCheckDevice function returns TRUE if the engine can render to the
  118.  * indicated GDevice.
  119.  *
  120.  ***********************************************************************************************/
  121. /* TQADrawPrivateNew    parameter descriptions */
  122. /*  TQADrawContext      *newDrawContext     Draw context to initialize */
  123. /*  const TQADevice     *device             Target device */
  124. /*  const TQARect       *rect               Target rectangle (device coordinates) */
  125. /*  const TQAClip       *clip               2D clip region (or NULL) */
  126. /*  unsigned long       flags               Mask of kQAContext_xxx */
  127. typedef CALLBACK_API_C( TQAError , TQADrawPrivateNew )(TQADrawContext *newDrawContext, const TQADevice *device, const TQARect *rect, const TQAClip *clip, unsigned long flags);
  128. /* TQADrawPrivateDelete parameter descriptions */
  129. /*  TQADrawPrivate      *drawPrivate        Private context data to delete */
  130. typedef CALLBACK_API_C( void , TQADrawPrivateDelete )(TQADrawPrivate *drawPrivate);
  131. /* TQAEngineCheckDevice parameter descriptions */
  132. /*  const TQADevice     *device         Target device */
  133. typedef CALLBACK_API_C( TQAError , TQAEngineCheckDevice )(const TQADevice *device);
  134. /* TQAEngineGestalt parameter descriptions */
  135. /*  TQAGestaltSelector  selector            Gestalt parameter being requested */
  136. /*  void                *response           Buffer that receives response */
  137. typedef CALLBACK_API_C( TQAError , TQAEngineGestalt )(TQAGestaltSelector selector, void *response);
  138. /* new engine methods for RAVE 1.6 */
  139. typedef CALLBACK_API_C( TQAError , TQAAccessTexture )(TQATexture *texture, long mipmapLevel, long flags, TQAPixelBuffer *buffer);
  140. typedef CALLBACK_API_C( TQAError , TQAAccessTextureEnd )(TQATexture *texture, const TQARect *dirtyRect);
  141. typedef CALLBACK_API_C( TQAError , TQAAccessBitmap )(TQABitmap *bitmap, long flags, TQAPixelBuffer *buffer);
  142. typedef CALLBACK_API_C( TQAError , TQAAccessBitmapEnd )(TQABitmap *bitmap, const TQARect *dirtyRect);
  143. /************************************************************************************************
  144.  *
  145.  * The TQAEngineMethod union is used to represent a single engine method (it's a
  146.  * parameter to QAEngineGetMethod). TQAEngineMethodTag identifies which method is being
  147.  * requested.
  148.  *
  149.  ***********************************************************************************************/
  150. union TQAEngineMethod {
  151.     TQADrawPrivateNew               drawPrivateNew;             /* Method: Create a private draw context */
  152.     TQADrawPrivateDelete            drawPrivateDelete;          /* Method: Delete a private draw context */
  153.     TQAEngineCheckDevice            engineCheckDevice;          /* Method: Check a device for drawing */
  154.     TQAEngineGestalt                engineGestalt;              /* Method: Gestalt */
  155.     TQATextureNew                   textureNew;                 /* Method: Create a texture (load is non-blocking) */
  156.     TQATextureDetach                textureDetach;              /* Method: Complete load of a texture (blocking) */
  157.     TQATextureDelete                textureDelete;              /* Method: Delete a texture */
  158.     TQABitmapNew                    bitmapNew;                  /* Method: Create a bitmap (load is non-blocking)  */
  159.     TQABitmapDetach                 bitmapDetach;               /* Method: Complete load of a bitmap (blocking) */
  160.     TQABitmapDelete                 bitmapDelete;               /* Method: Delete a bitmap */
  161.     TQAColorTableNew                colorTableNew;              /* Method: Create a new color table */
  162.     TQAColorTableDelete             colorTableDelete;           /* Method: Create a new color table */
  163.     TQATextureBindColorTable        textureBindColorTable;      /* Method: Bind a CLUT to a texture */
  164.     TQABitmapBindColorTable         bitmapBindColorTable;       /* Method: Bind a CLUT to a bitmap */
  165.     TQAAccessTexture                accessTexture;
  166.     TQAAccessTextureEnd             accessTextureEnd;
  167.     TQAAccessBitmap                 accessBitmap;
  168.     TQAAccessBitmapEnd              accessBitmapEnd;
  169. };
  170. typedef union TQAEngineMethod           TQAEngineMethod;
  171. enum TQAEngineMethodTag {
  172.     kQADrawPrivateNew           = 0,
  173.     kQADrawPrivateDelete        = 1,
  174.     kQAEngineCheckDevice        = 2,
  175.     kQAEngineGestalt            = 3,
  176.     kQATextureNew               = 4,
  177.     kQATextureDetach            = 5,
  178.     kQATextureDelete            = 6,
  179.     kQABitmapNew                = 7,
  180.     kQABitmapDetach             = 8,
  181.     kQABitmapDelete             = 9,
  182.     kQAColorTableNew            = 10,
  183.     kQAColorTableDelete         = 11,
  184.     kQATextureBindColorTable    = 12,
  185.     kQABitmapBindColorTable     = 13,
  186.     kQAAccessTexture            = 14,
  187.     kQAAccessTextureEnd         = 15,
  188.     kQAAccessBitmap             = 16,
  189.     kQAAccessBitmapEnd          = 17
  190. };
  191. typedef enum TQAEngineMethodTag TQAEngineMethodTag;
  192. /************************************************************************************************
  193.  *
  194.  * QARegisterEngine() registers a new engine. This is called at boot time by the drawing engine
  195.  * initialization code to register itself with the system. This call takes only one parameter,
  196.  * the engine's function that allows the manager to request the other methods.
  197.  *
  198.  ***********************************************************************************************/
  199. /* TQAEngineGetMethod   parameter descriptions */
  200. /*  TQAEngineMethodTag      methodTag               Method being requested */
  201. /*  TQAEngineMethod         *method                 (Out) Method */
  202. typedef CALLBACK_API_C( TQAError , TQAEngineGetMethod )(TQAEngineMethodTag methodTag, TQAEngineMethod *method);
  203. /* QARegisterEngine parameter descriptions */
  204. /*  TQAEngineGetMethod      engineGetMethod     Engine's getMethod method */
  205. #if CALL_NOT_IN_CARBON
  206. EXTERN_API_C( TQAError )
  207. QARegisterEngine                (TQAEngineGetMethod     engineGetMethod);
  208. /* QARegisterEngineWithRefCon parameter descriptions */
  209. /*  TQAEngineGetMethod      engineGetMethod     Engine's getMethod method */
  210. /*  long                    refCon              Engine RefCon */
  211. EXTERN_API_C( TQAError )
  212. QARegisterEngineWithRefCon      (TQAEngineGetMethod     engineGetMethod,
  213.                                  long                   refCon);
  214. /* QAGetEngineRefCon parameter descriptions */
  215. EXTERN_API_C( long )
  216. QAGetCurrentEngineRefCon        (void);
  217. /************************************************************************************************
  218.  *
  219.  * The TQADrawMethod union is used to represent a single draw context method (it's a
  220.  * parameter to QARegisterDrawMethod). TQADrawMethodTag identifies which method is being
  221.  * passed.
  222.  *
  223.  ***********************************************************************************************/
  224. #endif  /* CALL_NOT_IN_CARBON */
  225. union TQADrawMethod {
  226.     TQASetFloat                     setFloat;                   /* Method: Set a float state variable */
  227.     TQASetInt                       setInt;                     /* Method: Set an unsigned long state variable */
  228.     TQASetPtr                       setPtr;                     /* Method: Set an unsigned long state variable */
  229.     TQAGetFloat                     getFloat;                   /* Method: Get a float state variable */
  230.     TQAGetInt                       getInt;                     /* Method: Get an unsigned long state variable */
  231.     TQAGetPtr                       getPtr;                     /* Method: Get an pointer state variable */
  232.     TQADrawPoint                    drawPoint;                  /* Method: Draw a point */
  233.     TQADrawLine                     drawLine;                   /* Method: Draw a line */
  234.     TQADrawTriGouraud               drawTriGouraud;             /* Method: Draw a Gouraud shaded triangle */
  235.     TQADrawTriTexture               drawTriTexture;             /* Method: Draw a texture mapped triangle */
  236.     TQADrawVGouraud                 drawVGouraud;               /* Method: Draw Gouraud vertices */
  237.     TQADrawVTexture                 drawVTexture;               /* Method: Draw texture vertices */
  238.     TQADrawBitmap                   drawBitmap;                 /* Method: Draw a bitmap */
  239.     TQARenderStart                  renderStart;                /* Method: Initialize for rendering */
  240.     TQARenderEnd                    renderEnd;                  /* Method: Complete rendering and display */
  241.     TQARenderAbort                  renderAbort;                /* Method: Abort any outstanding rendering (blocking) */
  242.     TQAFlush                        flush;                      /* Method: Start render of any queued commands (non-blocking) */
  243.     TQASync                         sync;                       /* Method: Wait for completion of all rendering (blocking) */
  244.     TQASubmitVerticesGouraud        submitVerticesGouraud;      /* Method: Submit Gouraud vertices for trimesh */
  245.     TQASubmitVerticesTexture        submitVerticesTexture;      /* Method: Submit Texture vertices for trimesh */
  246.     TQADrawTriMeshGouraud           drawTriMeshGouraud;         /* Method: Draw a Gouraud triangle mesh */
  247.     TQADrawTriMeshTexture           drawTriMeshTexture;         /* Method: Draw a Texture triangle mesh */
  248.     TQASetNoticeMethod              setNoticeMethod;            /* Method: Set a notice method */
  249.     TQAGetNoticeMethod              getNoticeMethod;            /* Method: Get a notice method */
  250.                                                                 /* new in 1.6 */
  251.     TQASubmitMultiTextureParams     submitMultiTextureParams;   /* Method: Submit secondary texture params */
  252.     TQAAccessDrawBuffer             accessDrawBuffer;
  253.     TQAAccessDrawBufferEnd          accessDrawBufferEnd;
  254.     TQAAccessZBuffer                accessZBuffer;
  255.     TQAAccessZBufferEnd             accessZBufferEnd;
  256.     TQAClearDrawBuffer              clearDrawBuffer;
  257.     TQAClearZBuffer                 clearZBuffer;
  258.     TQATextureNewFromDrawContext    textureFromContext;
  259.     TQABitmapNewFromDrawContext     bitmapFromContext;
  260.     TQABusy                         busy;
  261.     TQASwapBuffers                  swapBuffers;
  262. };
  263. typedef union TQADrawMethod             TQADrawMethod;
  264. enum TQADrawMethodTag {
  265.     kQASetFloat                 = 0,
  266.     kQASetInt                   = 1,
  267.     kQASetPtr                   = 2,
  268.     kQAGetFloat                 = 3,
  269.     kQAGetInt                   = 4,
  270.     kQAGetPtr                   = 5,
  271.     kQADrawPoint                = 6,
  272.     kQADrawLine                 = 7,
  273.     kQADrawTriGouraud           = 8,
  274.     kQADrawTriTexture           = 9,
  275.     kQADrawVGouraud             = 10,
  276.     kQADrawVTexture             = 11,
  277.     kQADrawBitmap               = 12,
  278.     kQARenderStart              = 13,
  279.     kQARenderEnd                = 14,
  280.     kQARenderAbort              = 15,
  281.     kQAFlush                    = 16,
  282.     kQASync                     = 17,
  283.     kQASubmitVerticesGouraud    = 18,
  284.     kQASubmitVerticesTexture    = 19,
  285.     kQADrawTriMeshGouraud       = 20,
  286.     kQADrawTriMeshTexture       = 21,
  287.     kQASetNoticeMethod          = 22,
  288.     kQAGetNoticeMethod          = 23,
  289.     kQSubmitMultiTextureParams  = 24,
  290.     kQAccessDrawBuffer          = 25,
  291.     kQAccessDrawBufferEnd       = 26,
  292.     kQAccessZBuffer             = 27,
  293.     kQAccessZBufferEnd          = 28,
  294.     kQClearDrawBuffer           = 29,
  295.     kQClearZBuffer              = 30,
  296.     kQTextureNewFromDrawContext = 31,
  297.     kQBitmapNewFromDrawContext  = 32,
  298.     kQBusy                      = 33,
  299.     kQSwapBuffers               = 34
  300. };
  301. typedef enum TQADrawMethodTag TQADrawMethodTag;
  302. /************************************************************************************************
  303.  *
  304.  * System call to register a new method for an engine. This is called during the engine's
  305.  * draw private new functions (to set the initial value of the draw methods), and possibly
  306.  * at other times when the engine needs to change a draw method.
  307.  *
  308.  ***********************************************************************************************/
  309. /* QARegisterDrawMethod parameter descriptions */
  310. /*  TQADrawContext          *drawContext            Draw context in which to set method */
  311. /*  TQADrawMethodTag        methodTag               Method to set */
  312. /*  TQADrawMethod           method                  Method */
  313. #if CALL_NOT_IN_CARBON
  314. EXTERN_API_C( TQAError )
  315. QARegisterDrawMethod            (TQADrawContext *       drawContext,
  316.                                  TQADrawMethodTag       methodTag,
  317.                                  TQADrawMethod          method);
  318. #endif  /* CALL_NOT_IN_CARBON */
  319. #if PRAGMA_ENUM_ALWAYSINT
  320.     #pragma enumsalwaysint reset
  321.     #ifdef __RAVESYSTEM__RESTORE_TWOBYTEINTS
  322.         #pragma fourbyteints off
  323.     #endif
  324. #elif PRAGMA_ENUM_OPTIONS
  325.     #pragma option enum=reset
  326. #elif defined(__RAVESYSTEM__RESTORE_PACKED_ENUMS)
  327.     #pragma options(pack_enums)
  328. #endif
  329. #if PRAGMA_STRUCT_ALIGN
  330.     #pragma options align=reset
  331. #elif PRAGMA_STRUCT_PACKPUSH
  332.     #pragma pack(pop)
  333. #elif PRAGMA_STRUCT_PACK
  334.     #pragma pack()
  335. #endif
  336. #ifdef PRAGMA_IMPORT_OFF
  337. #pragma import off
  338. #elif PRAGMA_IMPORT
  339. #pragma import reset
  340. #endif
  341. #ifdef __cplusplus
  342. }
  343. #endif
  344. #endif /* __RAVESYSTEM__ */