Mac OS 9
QD3DDrawContext.h
Go to the documentation of this file.
1 
19 #ifndef __QD3DDRAWCONTEXT__
20 #define __QD3DDRAWCONTEXT__
21 
22 #ifndef __QD3D__
23 #include <QD3D.h>
24 #endif
25 
26 #if TARGET_OS_MAC
27 #ifndef __QUICKDRAW__
28 #include <Quickdraw.h>
29 #endif
30 
31 #ifndef __FIXMATH__
32 #include <FixMath.h>
33 #endif
34 
35 #ifndef __GXTYPES__
36 #include <GXTypes.h>
37 #endif
38 
39 #endif /* TARGET_OS_MAC */
40 
41 #if TARGET_OS_UNIX
42 #include <X11/Xlib.h>
43 #include <X11/Xutil.h>
44 #endif /* TARGET_OS_WIN32 */
45 
46 #if TARGET_OS_WIN32
47 /******************************************************************************
48  * **
49  * ABOUT QD3D_NO_DIRECTDRAW: (Win32 Only) **
50  * **
51  * NOTE: Define QD3D_NO_DIRECTDRAW for your application makefile/project **
52  * only if you don't need Q3DDSurfaceDrawContext support and don't **
53  * have access to ddraw.h. **
54  * **
55  *****************************************************************************/
56 #include <windows.h>
57 #if !defined(QD3D_NO_DIRECTDRAW)
58 #include <ddraw.h>
59 #endif /* !QD3D_NO_DIRECTDRAW */
60 #endif /* TARGET_OS_WIN32 */
61 
62 #if PRAGMA_ONCE
63 #pragma once
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C"
68 {
69 #endif
70 
71 #if PRAGMA_IMPORT
72 #pragma import on
73 #endif
74 
75 #if PRAGMA_STRUCT_ALIGN
76 #pragma options align = power
77 #elif PRAGMA_STRUCT_PACKPUSH
78 #pragma pack(push, 2)
79 #elif PRAGMA_STRUCT_PACK
80 #pragma pack(2)
81 #endif
82 
83 #if PRAGMA_ENUM_ALWAYSINT
84 #if defined(__fourbyteints__) && !__fourbyteints__
85 #define __QD3DDRAWCONTEXT__RESTORE_TWOBYTEINTS
86 #pragma fourbyteints on
87 #endif
88 #pragma enumsalwaysint on
89 #elif PRAGMA_ENUM_OPTIONS
90 #pragma option enum =int
91 #elif PRAGMA_ENUM_PACK
92 #if __option(pack_enums)
93 #define __QD3DDRAWCONTEXT__RESTORE_PACKED_ENUMS
94 #pragma options(!pack_enums)
95 #endif
96 #endif
97 
98  /******************************************************************************
99  ** **
100  ** DrawContext Data Structures **
101  ** **
102  *****************************************************************************/
103  enum TQ3DrawContextClearImageMethod
104  {
105  kQ3ClearMethodNone = 0,
106  kQ3ClearMethodWithColor = 1
107  };
108  typedef enum TQ3DrawContextClearImageMethod TQ3DrawContextClearImageMethod;
109 
111  {
112  TQ3DrawContextClearImageMethod clearImageMethod;
113  TQ3ColorARGB clearImageColor;
114  TQ3Area pane;
115  TQ3Boolean paneState;
116  TQ3Bitmap mask;
117  TQ3Boolean maskState;
118  TQ3Boolean doubleBufferState;
119  };
120  typedef struct TQ3DrawContextData TQ3DrawContextData;
121 /******************************************************************************
122  ** **
123  ** DrawContext Routines **
124  ** **
125  *****************************************************************************/
126 #if CALL_NOT_IN_CARBON
136  Q3DrawContext_GetType(TQ3DrawContextObject drawContext);
137 
146  TQ3Status
147  Q3DrawContext_SetData(TQ3DrawContextObject context,
148  const TQ3DrawContextData *contextData);
149 
158  TQ3Status
159  Q3DrawContext_GetData(TQ3DrawContextObject context,
160  TQ3DrawContextData *contextData);
161 
170  TQ3Status
171  Q3DrawContext_SetClearImageColor(TQ3DrawContextObject context,
172  const TQ3ColorARGB *color);
173 
182  TQ3Status
183  Q3DrawContext_GetClearImageColor(TQ3DrawContextObject context,
184  TQ3ColorARGB *color);
185 
194  TQ3Status
195  Q3DrawContext_SetPane(TQ3DrawContextObject context, const TQ3Area *pane);
196 
205  TQ3Status
206  Q3DrawContext_GetPane(TQ3DrawContextObject context, TQ3Area *pane);
207 
216  TQ3Status
217  Q3DrawContext_SetPaneState(TQ3DrawContextObject context, TQ3Boolean state);
218 
227  TQ3Status
228  Q3DrawContext_GetPaneState(TQ3DrawContextObject context, TQ3Boolean *state);
229 
238  TQ3Status
239  Q3DrawContext_SetClearImageMethod(TQ3DrawContextObject context,
240  TQ3DrawContextClearImageMethod method);
241 
250  TQ3Status
251  Q3DrawContext_GetClearImageMethod(TQ3DrawContextObject context,
252  TQ3DrawContextClearImageMethod *method);
253 
262  TQ3Status
263  Q3DrawContext_SetMask(TQ3DrawContextObject context, const TQ3Bitmap *mask);
264 
273  TQ3Status
274  Q3DrawContext_GetMask(TQ3DrawContextObject context, TQ3Bitmap *mask);
275 
284  TQ3Status
285  Q3DrawContext_SetMaskState(TQ3DrawContextObject context, TQ3Boolean state);
286 
295  TQ3Status
296  Q3DrawContext_GetMaskState(TQ3DrawContextObject context, TQ3Boolean *state);
297 
306  TQ3Status
307  Q3DrawContext_SetDoubleBufferState(TQ3DrawContextObject context,
308  TQ3Boolean state);
309 
318  TQ3Status
319  Q3DrawContext_GetDoubleBufferState(TQ3DrawContextObject context,
320  TQ3Boolean *state);
321 
322 /******************************************************************************
323  ** **
324  ** Pixmap Data Structure **
325  ** **
326  *****************************************************************************/
327 #endif /* CALL_NOT_IN_CARBON */
328 
330  {
331  TQ3DrawContextData drawContextData;
332  TQ3Pixmap pixmap;
333  };
335 /******************************************************************************
336  ** **
337  ** Pixmap DrawContext Routines **
338  ** **
339  *****************************************************************************/
340 #if CALL_NOT_IN_CARBON
349  TQ3DrawContextObject
351 
360  TQ3Status
361  Q3PixmapDrawContext_SetPixmap(TQ3DrawContextObject drawContext,
362  const TQ3Pixmap *pixmap);
363 
372  TQ3Status
373  Q3PixmapDrawContext_GetPixmap(TQ3DrawContextObject drawContext,
374  TQ3Pixmap *pixmap);
375 
376 #endif /* CALL_NOT_IN_CARBON */
377 
378 #if TARGET_OS_MAC
379  /******************************************************************************
380  ** **
381  ** Macintosh DrawContext Data Structures **
382  ** **
383  *****************************************************************************/
384  enum TQ3MacDrawContext2DLibrary
385  {
386  kQ3Mac2DLibraryNone = 0,
387  kQ3Mac2DLibraryQuickDraw = 1,
388  kQ3Mac2DLibraryQuickDrawGX = 2
389  };
390  typedef enum TQ3MacDrawContext2DLibrary TQ3MacDrawContext2DLibrary;
391 
392  struct TQ3MacDrawContextData
393  {
394  TQ3DrawContextData drawContextData;
396  TQ3MacDrawContext2DLibrary library;
397  gxViewPort viewPort;
398  CGrafPtr grafPort;
399  };
400  typedef struct TQ3MacDrawContextData TQ3MacDrawContextData;
401 /******************************************************************************
402  ** **
403  ** Macintosh DrawContext Routines **
404  ** **
405  *****************************************************************************/
406 #if CALL_NOT_IN_CARBON
415  TQ3DrawContextObject
416  Q3MacDrawContext_New(const TQ3MacDrawContextData *drawContextData);
417 
426  TQ3Status
427  Q3MacDrawContext_SetWindow(TQ3DrawContextObject drawContext, CWindowPtr window);
428 
437  TQ3Status
438  Q3MacDrawContext_GetWindow(TQ3DrawContextObject drawContext,
439  CWindowPtr *window);
440 
449  TQ3Status
450  Q3MacDrawContext_SetGXViewPort(TQ3DrawContextObject drawContext,
451  gxViewPort viewPort);
452 
461  TQ3Status
462  Q3MacDrawContext_GetGXViewPort(TQ3DrawContextObject drawContext,
463  gxViewPort *viewPort);
464 
473  TQ3Status
474  Q3MacDrawContext_SetGrafPort(TQ3DrawContextObject drawContext,
475  CGrafPtr grafPort);
476 
485  TQ3Status
486  Q3MacDrawContext_GetGrafPort(TQ3DrawContextObject drawContext,
487  CGrafPtr *grafPort);
488 
497  TQ3Status
498  Q3MacDrawContext_Set2DLibrary(TQ3DrawContextObject drawContext,
499  TQ3MacDrawContext2DLibrary library);
500 
509  TQ3Status
510  Q3MacDrawContext_Get2DLibrary(TQ3DrawContextObject drawContext,
511  TQ3MacDrawContext2DLibrary *library);
512 
513 #endif /* CALL_NOT_IN_CARBON */
514 
515 #endif /* TARGET_OS_MAC */
516 
517 #if TARGET_OS_UNIX
518  /******************************************************************************
519  ** **
520  ** X/Windows DrawContext Data Structures **
521  ** **
522  *****************************************************************************/
523  typedef struct OpaqueTQ3XBufferObject *TQ3XBufferObject;
524  struct TQ3XColormapData
525  {
526  long baseEntry;
527  long maxRed;
528  long maxGreen;
529  long maxBlue;
530  long multRed;
531  long multGreen;
532  long multBlue;
533  };
534  typedef struct TQ3XColormapData TQ3XColormapData;
535  struct TQ3XDrawContextData
536  {
537  TQ3DrawContextData contextData;
538  Display *display;
539  Drawable drawable;
540  Visual *visual;
541  Colormap cmap;
542  TQ3XColormapData *colorMapData;
543  };
544  typedef struct TQ3XDrawContextData TQ3XDrawContextData;
545 /******************************************************************************
546  ** **
547  ** X/Windows DrawContext Routines **
548  ** **
549  *****************************************************************************/
550 #ifdef XDC_OLD
551 #if CALL_NOT_IN_CARBON
560  TQ3DrawContextObject
561  Q3XDrawContext_New(void);
562 
571  void
572  Q3XDrawContext_Set(TQ3DrawContextObject drawContext, unsigned long flag,
573  void *data);
574 
583  void
584  Q3XDrawContext_Get(TQ3DrawContextObject drawContext, unsigned long flag,
585  void *data);
586 
587 #endif /* CALL_NOT_IN_CARBON */
588 
589 #endif /* defined(XDC_OLD) */
590 
591 #if CALL_NOT_IN_CARBON
600  TQ3XBufferObject
601  Q3XBuffers_New(Display *dpy, unsigned long numBuffers, Window window);
602 
611  void
612  Q3XBuffers_Swap(Display *dpy, TQ3XBufferObject buffers);
613 
622  XVisualInfo *
623  Q3X_GetVisualInfo(Display *dpy, Screen *screen);
624 
633  TQ3DrawContextObject
634  Q3XDrawContext_New(const TQ3XDrawContextData *xContextData);
635 
644  TQ3Status
645  Q3XDrawContext_SetDisplay(TQ3DrawContextObject drawContext,
646  const Display *display);
647 
656  TQ3Status
657  Q3XDrawContext_GetDisplay(TQ3DrawContextObject drawContext, Display **display);
658 
667  TQ3Status
668  Q3XDrawContext_SetDrawable(TQ3DrawContextObject drawContext, Drawable drawable);
669 
678  TQ3Status
679  Q3XDrawContext_GetDrawable(TQ3DrawContextObject drawContext,
680  Drawable *drawable);
681 
690  TQ3Status
691  Q3XDrawContext_SetVisual(TQ3DrawContextObject drawContext,
692  const Visual *visual);
693 
702  TQ3Status
703  Q3XDrawContext_GetVisual(TQ3DrawContextObject drawContext, Visual **visual);
704 
713  TQ3Status
714  Q3XDrawContext_SetColormap(TQ3DrawContextObject drawContext, Colormap colormap);
715 
724  TQ3Status
725  Q3XDrawContext_GetColormap(TQ3DrawContextObject drawContext,
726  Colormap *colormap);
727 
736  TQ3Status
737  Q3XDrawContext_SetColormapData(TQ3DrawContextObject drawContext,
738  const TQ3XColormapData *colormapData);
739 
748  TQ3Status
749  Q3XDrawContext_GetColormapData(TQ3DrawContextObject drawContext,
750  TQ3XColormapData *colormapData);
751 
752 #endif /* CALL_NOT_IN_CARBON */
753 
754 #endif /* TARGET_OS_UNIX */
755 
756 #if TARGET_OS_WIN32
757  /******************************************************************************
758  ** **
759  ** Win32 DrawContext Data Structures **
760  ** **
761  *****************************************************************************/
762  struct TQ3Win32DCDrawContextData
763  {
764  TQ3DrawContextData drawContextData;
765  HDC hdc;
766  };
767  typedef struct TQ3Win32DCDrawContextData TQ3Win32DCDrawContextData;
768 #ifndef QD3D_NO_DIRECTDRAW
769  enum TQ3DirectDrawObjectSelector
770  {
771  kQ3DirectDrawObject = 1,
772  kQ3DirectDrawObject2 = 2
773  };
774  typedef enum TQ3DirectDrawObjectSelector TQ3DirectDrawObjectSelector;
775 
776  enum TQ3DirectDrawSurfaceSelector
777  {
778  kQ3DirectDrawSurface = 1,
779  kQ3DirectDrawSurface2 = 2
780  };
781  typedef enum TQ3DirectDrawSurfaceSelector TQ3DirectDrawSurfaceSelector;
782 
783  struct TQ3DDSurfaceDescriptor
784  {
785  TQ3DirectDrawObjectSelector objectSelector;
786  union
787  {
788  LPDIRECTDRAW lpDirectDraw;
789  LPDIRECTDRAW2 lpDirectDraw2;
790  };
791 
792  TQ3DirectDrawSurfaceSelector surfaceSelector;
793  union
794  {
795  LPDIRECTDRAWSURFACE lpDirectDrawSurface;
796  LPDIRECTDRAWSURFACE2 lpDirectDrawSurface2;
797  };
798  };
799  typedef struct TQ3DDSurfaceDescriptor TQ3DDSurfaceDescriptor;
800 
801  struct TQ3DDSurfaceDrawContextData
802  {
803  TQ3DrawContextData drawContextData;
804  TQ3DDSurfaceDescriptor ddSurfaceDescriptor;
805  };
806  typedef struct TQ3DDSurfaceDrawContextData TQ3DDSurfaceDrawContextData;
807 
808 #endif /* !defined(QD3D_NO_DIRECTDRAW) */
809 
810 /******************************************************************************
811  ** **
812  ** Win32DC DrawContext Routines **
813  ** **
814  *****************************************************************************/
815 #if CALL_NOT_IN_CARBON
824  TQ3DrawContextObject
825  Q3Win32DCDrawContext_New(const TQ3Win32DCDrawContextData *drawContextData);
826 
835  TQ3Status
836  Q3Win32DCDrawContext_SetDC(TQ3DrawContextObject drawContext, HDC newHDC);
837 
846  TQ3Status
847  Q3Win32DCDrawContext_GetDC(TQ3DrawContextObject drawContext, HDC *curHDC);
848 
849 /******************************************************************************
850  ** **
851  ** DDSurface DrawContext Routines **
852  ** **
853  *****************************************************************************/
854 #endif /* CALL_NOT_IN_CARBON */
855 
856 #ifndef QD3D_NO_DIRECTDRAW
857 #if CALL_NOT_IN_CARBON
866  TQ3DrawContextObject
867  Q3DDSurfaceDrawContext_New(const TQ3DDSurfaceDrawContextData *drawContextData);
868 
877  TQ3Status
878  Q3DDSurfaceDrawContext_SetDirectDrawSurface(
879  TQ3DrawContextObject drawContext,
880  const TQ3DDSurfaceDescriptor *ddSurfaceDescriptor);
881 
890  TQ3Status
891  Q3DDSurfaceDrawContext_GetDirectDrawSurface(
892  TQ3DrawContextObject drawContext,
893  TQ3DDSurfaceDescriptor *ddSurfaceDescriptor);
894 
895 #endif /* CALL_NOT_IN_CARBON */
896 
897 #endif /* !defined(QD3D_NO_DIRECTDRAW) */
898 
899 #endif /* TARGET_OS_WIN32 */
900 
901 #if PRAGMA_ENUM_ALWAYSINT
902 #pragma enumsalwaysint reset
903 #ifdef __QD3DDRAWCONTEXT__RESTORE_TWOBYTEINTS
904 #pragma fourbyteints off
905 #endif
906 #elif PRAGMA_ENUM_OPTIONS
907 #pragma option enum =reset
908 #elif defined(__QD3DDRAWCONTEXT__RESTORE_PACKED_ENUMS)
909 #pragma options(pack_enums)
910 #endif
911 
912 #if PRAGMA_STRUCT_ALIGN
913 #pragma options align = reset
914 #elif PRAGMA_STRUCT_PACKPUSH
915 #pragma pack(pop)
916 #elif PRAGMA_STRUCT_PACK
917 #pragma pack()
918 #endif
919 
920 #ifdef PRAGMA_IMPORT_OFF
921 #pragma import off
922 #elif PRAGMA_IMPORT
923 #pragma import reset
924 #endif
925 
926 #ifdef __cplusplus
927 }
928 #endif
929 
930 #endif /* __QD3DDRAWCONTEXT__ */
Fixed Math Interfaces.
QuickDraw GX object and constant definitions.
TQ3Status Q3DrawContext_GetMaskState(TQ3DrawContextObject context, TQ3Boolean *state)
TQ3Status Q3DrawContext_SetPaneState(TQ3DrawContextObject context, TQ3Boolean state)
TQ3Status Q3DrawContext_GetMask(TQ3DrawContextObject context, TQ3Bitmap *mask)
TQ3Status Q3DrawContext_SetDoubleBufferState(TQ3DrawContextObject context, TQ3Boolean state)
TQ3Status Q3DrawContext_SetClearImageColor(TQ3DrawContextObject context, const TQ3ColorARGB *color)
TQ3Status Q3DrawContext_SetMaskState(TQ3DrawContextObject context, TQ3Boolean state)
TQ3Status Q3DrawContext_SetData(TQ3DrawContextObject context, const TQ3DrawContextData *contextData)
TQ3Status Q3PixmapDrawContext_SetPixmap(TQ3DrawContextObject drawContext, const TQ3Pixmap *pixmap)
TQ3DrawContextObject Q3PixmapDrawContext_New(const TQ3PixmapDrawContextData *contextData)
TQ3Status Q3DrawContext_GetPaneState(TQ3DrawContextObject context, TQ3Boolean *state)
TQ3Status Q3DrawContext_GetData(TQ3DrawContextObject context, TQ3DrawContextData *contextData)
TQ3Status Q3DrawContext_SetMask(TQ3DrawContextObject context, const TQ3Bitmap *mask)
TQ3Status Q3DrawContext_SetClearImageMethod(TQ3DrawContextObject context, TQ3DrawContextClearImageMethod method)
TQ3Status Q3PixmapDrawContext_GetPixmap(TQ3DrawContextObject drawContext, TQ3Pixmap *pixmap)
TQ3ObjectType Q3DrawContext_GetType(TQ3DrawContextObject drawContext)
TQ3Status Q3DrawContext_SetPane(TQ3DrawContextObject context, const TQ3Area *pane)
TQ3Status Q3DrawContext_GetPane(TQ3DrawContextObject context, TQ3Area *pane)
TQ3Status Q3DrawContext_GetClearImageMethod(TQ3DrawContextObject context, TQ3DrawContextClearImageMethod *method)
TQ3Status Q3DrawContext_GetDoubleBufferState(TQ3DrawContextObject context, TQ3Boolean *state)
TQ3Status Q3DrawContext_GetClearImageColor(TQ3DrawContextObject context, TQ3ColorARGB *color)
Base types for Quickdraw 3D.
long TQ3ObjectType
Definition: QD3D.h:152
Interface to Quickdraw Graphics.
TQAMethodSelector
Definition: RAVE.h:1009
Definition: Quickdraw.h:2261
Definition: Quickdraw.h:1648
Definition: QD3D.h:587
Definition: QD3D.h:530
Definition: QD3D.h:465
Definition: QD3DDrawContext.h:111
Definition: QD3DDrawContext.h:330
Definition: QD3D.h:504