home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / Windows / Interfaces / QD3DDrawContext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-03  |  13.0 KB  |  437 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DDrawContext.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:    Draw context class types and routines                        **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1993-1996 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DDrawContext_h
  15. #define QD3DDrawContext_h
  16.  
  17. #if PRAGMA_ONCE
  18.     #pragma once
  19. #endif
  20.  
  21. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  22.     #include <Quickdraw.h>
  23.     #include <FixMath.h>
  24.     #include <GXTypes.h>
  25. #endif /* WINDOW_SYSTEM_MACINTOSH */
  26.  
  27. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  28.     #include <X11/Xlib.h>
  29.     #include <X11/Xutil.h>
  30. #endif /* WINDOW_SYSTEM_X11 */
  31.  
  32. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  33.     #include <windows.h>
  34.     #include <ddraw.h>
  35. #endif  /*  WINDOW_SYSTEM_WIN32  */
  36.  
  37. #if defined(THINK_C) || defined(__SC__)
  38.     #pragma options(!pack_enums, !align_arrays)
  39.     #pragma SC options align=power
  40. #elif defined(__MWERKS__)
  41.     #pragma enumsalwaysint on
  42.     #pragma align_array_members off
  43.     #pragma options align=native
  44. #elif defined(__PPCC__)
  45.     #pragma options align=power
  46. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  47.     #pragma options enum=int
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif /*  __cplusplus  */
  53.  
  54.  
  55. /******************************************************************************
  56.  **                                                                             **
  57.  **                            DrawContext Data Structures                         **
  58.  **                                                                             **
  59.  *****************************************************************************/
  60.  
  61. typedef enum TQ3DrawContextClearImageMethod{
  62.     kQ3ClearMethodNone,
  63. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  64.     kQ3ClearMethodWithColor,
  65.     kQ3ClearMethodWithShader
  66. #else
  67.     kQ3ClearMethodWithColor
  68. #endif /* ESCHER_VER_15 */
  69. } TQ3DrawContextClearImageMethod;
  70.  
  71.  
  72. typedef struct TQ3DrawContextData {
  73.     TQ3DrawContextClearImageMethod    clearImageMethod;
  74.     TQ3ColorARGB                    clearImageColor;
  75.     TQ3Area                            pane;
  76.     TQ3Boolean                        paneState;
  77.     TQ3Bitmap                        mask;
  78.     TQ3Boolean                        maskState;
  79.     TQ3Boolean                        doubleBufferState;
  80. } TQ3DrawContextData;
  81.  
  82.  
  83. /******************************************************************************
  84.  **                                                                             **
  85.  **                                DrawContext Routines                         **
  86.  **                                                                             **
  87.  *****************************************************************************/
  88.  
  89. QD3D_EXPORT TQ3ObjectType Q3DrawContext_GetType(
  90.     TQ3DrawContextObject        drawContext);
  91.  
  92. QD3D_EXPORT TQ3Status Q3DrawContext_SetData(
  93.     TQ3DrawContextObject        context,
  94.     const TQ3DrawContextData    *contextData);
  95.  
  96. QD3D_EXPORT TQ3Status Q3DrawContext_GetData(
  97.     TQ3DrawContextObject        context,
  98.     TQ3DrawContextData            *contextData);
  99.     
  100. QD3D_EXPORT TQ3Status Q3DrawContext_SetClearImageColor(
  101.     TQ3DrawContextObject        context,
  102.     const TQ3ColorARGB             *color);
  103.  
  104. QD3D_EXPORT TQ3Status Q3DrawContext_GetClearImageColor(
  105.     TQ3DrawContextObject        context,
  106.     TQ3ColorARGB                 *color);
  107.  
  108. QD3D_EXPORT TQ3Status Q3DrawContext_SetPane(
  109.     TQ3DrawContextObject        context,
  110.     const TQ3Area                 *pane);
  111.  
  112. QD3D_EXPORT TQ3Status Q3DrawContext_GetPane(
  113.     TQ3DrawContextObject        context,
  114.     TQ3Area                         *pane);
  115.  
  116. QD3D_EXPORT TQ3Status Q3DrawContext_SetPaneState(
  117.     TQ3DrawContextObject        context,
  118.     TQ3Boolean                    state);
  119.  
  120. QD3D_EXPORT TQ3Status Q3DrawContext_GetPaneState(
  121.     TQ3DrawContextObject        context,
  122.     TQ3Boolean                    *state);
  123.         
  124. QD3D_EXPORT TQ3Status Q3DrawContext_SetClearImageMethod(
  125.     TQ3DrawContextObject            context,
  126.     TQ3DrawContextClearImageMethod     method);
  127.         
  128. QD3D_EXPORT TQ3Status Q3DrawContext_GetClearImageMethod(
  129.     TQ3DrawContextObject            context,
  130.     TQ3DrawContextClearImageMethod     *method);
  131.         
  132. QD3D_EXPORT TQ3Status Q3DrawContext_SetMask(
  133.     TQ3DrawContextObject        context,
  134.     const TQ3Bitmap                *mask);
  135.         
  136. QD3D_EXPORT TQ3Status Q3DrawContext_GetMask(
  137.     TQ3DrawContextObject        context,
  138.     TQ3Bitmap                    *mask);
  139.  
  140. QD3D_EXPORT TQ3Status Q3DrawContext_SetMaskState(
  141.     TQ3DrawContextObject        context,
  142.     TQ3Boolean                    state);
  143.  
  144. QD3D_EXPORT TQ3Status Q3DrawContext_GetMaskState(
  145.     TQ3DrawContextObject        context,
  146.     TQ3Boolean                    *state);
  147.  
  148. QD3D_EXPORT TQ3Status Q3DrawContext_SetDoubleBufferState(
  149.     TQ3DrawContextObject        context,
  150.     TQ3Boolean                     state);
  151.  
  152. QD3D_EXPORT TQ3Status Q3DrawContext_GetDoubleBufferState(
  153.     TQ3DrawContextObject        context,
  154.     TQ3Boolean                     *state);
  155.  
  156.  
  157. /******************************************************************************
  158.  **                                                                             **
  159.  **                            Pixmap Data Structure                             **
  160.  **                                                                             **
  161.  *****************************************************************************/
  162.  
  163. typedef struct TQ3PixmapDrawContextData {
  164.     TQ3DrawContextData        drawContextData;
  165.     TQ3Pixmap                pixmap;
  166. } TQ3PixmapDrawContextData;
  167.  
  168.  
  169. /******************************************************************************
  170.  **                                                                             **
  171.  **                        Pixmap DrawContext Routines                             **
  172.  **                                                                             **
  173.  *****************************************************************************/
  174.  
  175. QD3D_EXPORT TQ3DrawContextObject Q3PixmapDrawContext_New(
  176.     const TQ3PixmapDrawContextData    *contextData);
  177.  
  178. QD3D_EXPORT TQ3Status Q3PixmapDrawContext_SetPixmap(
  179.     TQ3DrawContextObject            drawContext,
  180.     const TQ3Pixmap                    *pixmap);
  181.  
  182. QD3D_EXPORT TQ3Status Q3PixmapDrawContext_GetPixmap(
  183.     TQ3DrawContextObject            drawContext,
  184.     TQ3Pixmap                        *pixmap);
  185.  
  186. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  187.  
  188. /******************************************************************************
  189.  **                                                                             **
  190.  **                        Macintosh DrawContext Data Structures                 **
  191.  **                                                                             **
  192.  *****************************************************************************/
  193.  
  194. typedef enum TQ3MacDrawContext2DLibrary {
  195.     kQ3Mac2DLibraryNone,
  196.     kQ3Mac2DLibraryQuickDraw,
  197.     kQ3Mac2DLibraryQuickDrawGX
  198. } TQ3MacDrawContext2DLibrary;
  199.  
  200.  
  201. typedef struct TQ3MacDrawContextData {
  202.     TQ3DrawContextData            drawContextData;
  203.     CWindowPtr                    window;
  204.     TQ3MacDrawContext2DLibrary    library;
  205.     gxViewPort                    viewPort;
  206.     CGrafPtr                    grafPort;
  207. } TQ3MacDrawContextData;
  208.  
  209.  
  210. /******************************************************************************
  211.  **                                                                             **
  212.  **                        Macintosh DrawContext Routines                         **
  213.  **                                                                             **
  214.  *****************************************************************************/
  215.  
  216. QD3D_EXPORT TQ3DrawContextObject Q3MacDrawContext_New(
  217.     const TQ3MacDrawContextData    *drawContextData);
  218.     
  219. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetWindow(
  220.     TQ3DrawContextObject        drawContext,
  221.     const CWindowPtr            window);
  222.  
  223. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetWindow(
  224.     TQ3DrawContextObject        drawContext,
  225.     CWindowPtr                    *window);
  226.  
  227. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetGXViewPort(
  228.     TQ3DrawContextObject        drawContext,
  229.     const gxViewPort            viewPort);
  230.  
  231. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetGXViewPort(
  232.     TQ3DrawContextObject        drawContext,
  233.     gxViewPort                    *viewPort);
  234.  
  235. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetGrafPort(
  236.     TQ3DrawContextObject        drawContext,
  237.     const CGrafPtr                grafPort);
  238.  
  239. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetGrafPort(
  240.     TQ3DrawContextObject        drawContext,
  241.     CGrafPtr                    *grafPort);
  242.  
  243. QD3D_EXPORT TQ3Status Q3MacDrawContext_Set2DLibrary(
  244.     TQ3DrawContextObject        drawContext,
  245.     TQ3MacDrawContext2DLibrary    library);
  246.  
  247. QD3D_EXPORT TQ3Status Q3MacDrawContext_Get2DLibrary(
  248.     TQ3DrawContextObject        drawContext,
  249.     TQ3MacDrawContext2DLibrary    *library);
  250.  
  251. #endif /* WINDOW_SYSTEM_MACINTOSH */
  252.  
  253. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  254.  
  255. /******************************************************************************
  256.  **                                                                             **
  257.  **                                Types                                         **
  258.  **                                                                             **
  259.  *****************************************************************************/
  260.  
  261. typedef struct TQ3XBufferData *TQ3XBufferObject;
  262.  
  263. typedef struct TQ3XColormapData {
  264.     long        baseEntry;
  265.     long        maxRed;
  266.     long        maxGreen;
  267.     long        maxBlue;
  268.     long        multRed;
  269.     long        multGreen;
  270.     long        multBlue;
  271. } TQ3XColormapData;
  272.  
  273.  
  274. typedef struct TQ3XDrawContextData {
  275.     TQ3DrawContextData        contextData;
  276.     Display                    *display;
  277.     Drawable                drawable;
  278.     Visual                    *visual;
  279.     Colormap                cmap;
  280.     TQ3XColormapData        *colorMapData;
  281. } TQ3XDrawContextData;
  282.  
  283.  
  284. /******************************************************************************
  285.  **                                                                             **
  286.  **                            XDrawContext Routines                             **
  287.  **                                                                             **
  288.  *****************************************************************************/
  289.  
  290. #ifdef XDC_OLD
  291. QD3D_EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  292.     void);
  293.  
  294. QD3D_EXPORT void Q3XDrawContext_Set(
  295.     TQ3DrawContextObject    drawContext,
  296.     unsigned long            flag,                             
  297.     void                    *data);
  298.  
  299. QD3D_EXPORT void Q3XDrawContext_Get(
  300.     TQ3DrawContextObject    drawContext,
  301.     unsigned long            flag,                             
  302.     void                    *data);
  303. #endif  /* XDC_OLD */
  304.  
  305. QD3D_EXPORT TQ3XBufferObject Q3XBuffers_New(
  306.     Display                    *dpy,                       
  307.     unsigned long            numBuffers,
  308.     Window                    window);
  309.  
  310. QD3D_EXPORT void Q3XBuffers_Swap(
  311.     Display                    *dpy,
  312.     TQ3XBufferObject        buffers);
  313.  
  314. QD3D_EXPORT XVisualInfo *Q3X_GetVisualInfo(
  315.     Display                    *dpy,
  316.     Screen                    *screen);
  317.  
  318.  
  319. QD3D_EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  320.     const TQ3XDrawContextData    *xContextData);
  321.  
  322. QD3D_EXPORT TQ3Status Q3XDrawContext_SetDisplay(
  323.     TQ3DrawContextObject        drawContext,
  324.     const Display                *display);
  325.  
  326. QD3D_EXPORT TQ3Status Q3XDrawContext_GetDisplay(
  327.     TQ3DrawContextObject        drawContext,
  328.     Display                        **display);
  329.  
  330. QD3D_EXPORT TQ3Status Q3XDrawContext_SetDrawable(
  331.     TQ3DrawContextObject        drawContext,
  332.     Drawable                    drawable);
  333.  
  334. QD3D_EXPORT TQ3Status Q3XDrawContext_GetDrawable(
  335.     TQ3DrawContextObject        drawContext,
  336.     Drawable                    *drawable);
  337.  
  338. QD3D_EXPORT TQ3Status Q3XDrawContext_SetVisual(
  339.     TQ3DrawContextObject        drawContext,
  340.     const Visual                *visual);
  341.  
  342. QD3D_EXPORT TQ3Status Q3XDrawContext_GetVisual(
  343.     TQ3DrawContextObject        drawContext,
  344.     Visual                        **visual);
  345.  
  346. QD3D_EXPORT TQ3Status Q3XDrawContext_SetColormap(
  347.     TQ3DrawContextObject        drawContext,
  348.     Colormap                    colormap);
  349.  
  350. QD3D_EXPORT TQ3Status Q3XDrawContext_GetColormap(
  351.     TQ3DrawContextObject        drawContext,
  352.     Colormap                    *colormap);
  353.  
  354. QD3D_EXPORT TQ3Status Q3XDrawContext_SetColormapData(
  355.     TQ3DrawContextObject        drawContext,
  356.     const TQ3XColormapData        *colormapData);
  357.  
  358. QD3D_EXPORT TQ3Status Q3XDrawContext_GetColormapData(
  359.     TQ3DrawContextObject        drawContext,
  360.     TQ3XColormapData            *colormapData);
  361.  
  362. #endif /* WINDOW_SYSTEM_X11 */
  363.  
  364. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  365.  
  366. /******************************************************************************
  367.  **                                                                             **
  368.  **                                Types                                         **
  369.  **                                                                             **
  370.  *****************************************************************************/
  371.  
  372. typedef struct TQ3Win32DCDrawContextData {
  373.     HDC            hdc;
  374. } TQ3Win32DCDrawContextData;
  375.  
  376. typedef struct TQ3DDSurfaceDrawContextData {
  377.     LPDIRECTDRAW            lpDirectDraw;
  378.     LPDIRECTDRAWSURFACE        lpDirectDrawSurface;
  379. } TQ3DDSurfaceDrawContextData;
  380.  
  381. /******************************************************************************
  382.  **                                                                             **
  383.  **                            Win32DC DrawContext Routines                     **
  384.  **                                                                             **
  385.  *****************************************************************************/
  386.  
  387. QD3D_EXPORT TQ3DrawContextObject Q3Win32DCDrawContext_New(
  388.     const TQ3Win32DCDrawContextData    *drawContextData);
  389.  
  390. QD3D_EXPORT TQ3Status Q3Win32DCDrawContext_SetDC(
  391.     TQ3DrawContextObject        drawContext,
  392.     const HDC                    hdc);
  393.  
  394. QD3D_EXPORT TQ3Status Q3Win32DCDrawContext_GetDC(
  395.     TQ3DrawContextObject        drawContext,
  396.     HDC                            *hdc);
  397.  
  398. /******************************************************************************
  399.  **                                                                             **
  400.  **                            DDSurface DrawContext Routines                     **
  401.  **                                                                             **
  402.  *****************************************************************************/
  403.  
  404. QD3D_EXPORT TQ3DrawContextObject Q3DDSurfaceDrawContext_New(
  405.     const TQ3DDSurfaceDrawContextData    *drawContextData);
  406.  
  407. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_SetDirectDraw(
  408.     TQ3DrawContextObject        drawContext,
  409.     const LPDIRECTDRAW            lpDirectDraw);
  410.  
  411. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_GetDirectDraw(
  412.     TQ3DrawContextObject        drawContext,
  413.     LPDIRECTDRAW                *lpDirectDraw);
  414.  
  415. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_SetDirectDrawSurface(
  416.     TQ3DrawContextObject        drawContext,
  417.     const LPDIRECTDRAWSURFACE    lpDirectDrawSurface);
  418.  
  419. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_GetDirectDrawSurface(
  420.     TQ3DrawContextObject        drawContext,
  421.     LPDIRECTDRAWSURFACE            *lpDirectDrawSurface);
  422.  
  423. #endif  /*  WINDOW_SYSTEM_WIN32  */
  424.  
  425.  
  426. #ifdef __cplusplus
  427. }
  428. #endif /*  __cplusplus  */
  429.  
  430. #if defined(__MWERKS__)
  431.     #pragma enumsalwaysint reset
  432. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  433.     #pragma options enum=reset
  434. #endif
  435.  
  436. #endif  /*  QD3DDrawContext_h  */
  437.