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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       GXEnvironment.h
  3.  
  4.      Contains:   QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology: Quickdraw GX 1.1
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1994-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 __GXENVIRONMENT__
  18. #define __GXENVIRONMENT__
  19. #ifndef __CONDITIONALMACROS__
  20. #include "ConditionalMacros.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #ifndef __QUICKDRAW__
  26. #include "Quickdraw.h"
  27. #endif
  28. #ifndef __GXTYPES__
  29. #include "GXTypes.h"
  30. #endif
  31. #ifndef __CMAPPLICATION__
  32. #include "CMApplication.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. #if defined(__MWERKS__) && TARGET_CPU_68K
  51.     #pragma push
  52.     #pragma pointers_in_D0
  53. #endif
  54.  
  55. /* old header = graphics macintosh */
  56.  
  57. enum {
  58.     defaultPollingHandlerFlags  = 0x00,
  59.     okToSwitchDuringPollFlag    = 0x00,
  60.     dontSwitchDuringPollFlag    = 0x01
  61. };
  62. typedef long                            gxPollingHandlerFlags;
  63. typedef CALLBACK_API_C( void , gxPollingHandlerProcPtr )(long reference, gxPollingHandlerFlags flags);
  64. typedef STACK_UPP_TYPE(gxPollingHandlerProcPtr)                 gxPollingHandlerUPP;
  65. #if OPAQUE_UPP_TYPES
  66. #if CALL_NOT_IN_CARBON
  67.     EXTERN_API(gxPollingHandlerUPP)
  68.     NewgxPollingHandlerUPP         (gxPollingHandlerProcPtr userRoutine);
  69.     EXTERN_API(void)
  70.     DisposegxPollingHandlerUPP     (gxPollingHandlerUPP     userUPP);
  71.     EXTERN_API(void)
  72.     InvokegxPollingHandlerUPP      (long                    reference,
  73.                                     gxPollingHandlerFlags   flags,
  74.                                     gxPollingHandlerUPP     userUPP);
  75. #endif  /* CALL_NOT_IN_CARBON */
  76. #else
  77.     enum { uppgxPollingHandlerProcInfo = 0x000003C1 };              /* no_return_value Func(4_bytes, 4_bytes) */
  78.     #define NewgxPollingHandlerUPP(userRoutine)                     (gxPollingHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  79.     #define DisposegxPollingHandlerUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  80.     #define InvokegxPollingHandlerUPP(reference, flags, userUPP)    CALL_TWO_PARAMETER_UPP((userUPP), uppgxPollingHandlerProcInfo, (reference), (flags))
  81. #endif
  82. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  83. #define NewgxPollingHandlerProc(userRoutine)                    NewgxPollingHandlerUPP(userRoutine)
  84. #define CallgxPollingHandlerProc(userRoutine, reference, flags) InvokegxPollingHandlerUPP(reference, flags, userRoutine)
  85. #if CALL_NOT_IN_CARBON
  86. EXTERN_API_C( gxPollingHandlerUPP )
  87. GXGetGraphicsPollingHandler     (long *                 reference)                          THREEWORDINLINE(0x303C, 0x0245, 0xA832);
  88. EXTERN_API_C( void )
  89. GXSetGraphicsPollingHandler     (gxPollingHandlerUPP    handler,
  90.                                  long                   reference)                          THREEWORDINLINE(0x303C, 0x0246, 0xA832);
  91. /* old header = graphics toolbox */
  92.  
  93. /* QD to QD GX Translator typedefs */
  94. #endif  /* CALL_NOT_IN_CARBON */
  95. enum {
  96.     gxDefaultOptionsTranslation = 0x0000,
  97.     gxOptimizedTranslation      = 0x0001,
  98.     gxReplaceLineWidthTranslation = 0x0002,
  99.     gxSimpleScalingTranslation  = 0x0004,
  100.     gxSimpleGeometryTranslation = 0x0008,                       /* implies simple scaling */
  101.     gxSimpleLinesTranslation    = 0x000C,                       /* implies simple geometry & scaling */
  102.     gxLayoutTextTranslation     = 0x0010,                       /* turn on gxLine layout (normally off) */
  103.     gxRasterTargetTranslation   = 0x0020,
  104.     gxPostScriptTargetTranslation = 0x0040,
  105.     gxVectorTargetTranslation   = 0x0080,
  106.     gxPDDTargetTranslation      = 0x0100,
  107.     gxDontConvertPatternsTranslation = 0x1000,
  108.     gxDontSplitBitmapsTranslation = 0x2000
  109. };
  110. typedef long                            gxTranslationOption;
  111. enum {
  112.     gxContainsFormsBegin        = 0x0001,
  113.     gxContainsFormsEnd          = 0x0002,
  114.     gxContainsPostScript        = 0x0004,
  115.     gxContainsEmptyPostScript   = 0x0008
  116. };
  117. typedef long                            gxTranslationStatistic;
  118. enum {
  119.     gxQuickDrawPictTag          = FOUR_CHAR_CODE('pict')
  120. };
  121. struct gxQuickDrawPict {
  122.                                                                 /* translator inputs */
  123.     gxTranslationOption             options;
  124.     Rect                            srcRect;
  125.     Point                           styleStretch;
  126.                                                                 /* size of quickdraw picture data */
  127.     unsigned long                   dataLength;
  128.                                                                 /* file alias */
  129.     gxBitmapDataSourceAlias         alias;
  130. };
  131. typedef struct gxQuickDrawPict          gxQuickDrawPict;
  132. /* WindowRecord utilities */
  133. #if CALL_NOT_IN_CARBON
  134. EXTERN_API_C( gxViewPort )
  135. GXNewWindowViewPort             (WindowPtr              qdWindow)                           THREEWORDINLINE(0x303C, 0x0236, 0xA832);
  136. EXTERN_API_C( gxViewPort )
  137. GXGetWindowViewPort             (WindowPtr              qdWindow)                           THREEWORDINLINE(0x303C, 0x0237, 0xA832);
  138. EXTERN_API_C( WindowPtr )
  139. GXGetViewPortWindow             (gxViewPort             portOrder)                          THREEWORDINLINE(0x303C, 0x0238, 0xA832);
  140. /* GDevice utilities */
  141. EXTERN_API_C( GDHandle )
  142. GXGetViewDeviceGDevice          (gxViewDevice           theDevice)                          THREEWORDINLINE(0x303C, 0x0239, 0xA832);
  143. EXTERN_API_C( gxViewDevice )
  144. GXGetGDeviceViewDevice          (GDHandle               qdGDevice)                          THREEWORDINLINE(0x303C, 0x023A, 0xA832);
  145. /* gxPoint utilities */
  146. EXTERN_API_C( void )
  147. GXConvertQDPoint                (const Point *          shortPt,
  148.                                  gxViewPort             portOrder,
  149.                                  gxPoint *              fixedPt)                            THREEWORDINLINE(0x303C, 0x023B, 0xA832);
  150. #endif  /* CALL_NOT_IN_CARBON */
  151. typedef CALLBACK_API_C( OSErr , gxShapeSpoolProcPtr )(gxShape toSpool, long refCon);
  152. /* printing utilities typedef */
  153. typedef CALLBACK_API_C( void , gxUserViewPortFilterProcPtr )(gxShape toFilter, gxViewPort portOrder, long refCon);
  154. typedef CALLBACK_API_C( long , gxConvertQDFontProcPtr )(gxStyle dst, long txFont, long txFace);
  155. typedef STACK_UPP_TYPE(gxShapeSpoolProcPtr)                     gxShapeSpoolUPP;
  156. typedef STACK_UPP_TYPE(gxUserViewPortFilterProcPtr)             gxUserViewPortFilterUPP;
  157. typedef STACK_UPP_TYPE(gxConvertQDFontProcPtr)                  gxConvertQDFontUPP;
  158. #if OPAQUE_UPP_TYPES
  159. #if CALL_NOT_IN_CARBON
  160.     EXTERN_API(gxShapeSpoolUPP)
  161.     NewgxShapeSpoolUPP             (gxShapeSpoolProcPtr     userRoutine);
  162.     EXTERN_API(gxUserViewPortFilterUPP)
  163.     NewgxUserViewPortFilterUPP     (gxUserViewPortFilterProcPtr userRoutine);
  164.     EXTERN_API(gxConvertQDFontUPP)
  165.     NewgxConvertQDFontUPP          (gxConvertQDFontProcPtr  userRoutine);
  166.     EXTERN_API(void)
  167.     DisposegxShapeSpoolUPP         (gxShapeSpoolUPP         userUPP);
  168.     EXTERN_API(void)
  169.     DisposegxUserViewPortFilterUPP    (gxUserViewPortFilterUPP userUPP);
  170.     EXTERN_API(void)
  171.     DisposegxConvertQDFontUPP      (gxConvertQDFontUPP      userUPP);
  172.     EXTERN_API(OSErr)
  173.     InvokegxShapeSpoolUPP          (gxShape                 toSpool,
  174.                                     long                    refCon,
  175.                                     gxShapeSpoolUPP         userUPP);
  176.     EXTERN_API(void)
  177.     InvokegxUserViewPortFilterUPP    (gxShape               toFilter,
  178.                                     gxViewPort              portOrder,
  179.                                     long                    refCon,
  180.                                     gxUserViewPortFilterUPP userUPP);
  181.     EXTERN_API(long)
  182.     InvokegxConvertQDFontUPP       (gxStyle                 dst,
  183.                                     long                    txFont,
  184.                                     long                    txFace,
  185.                                     gxConvertQDFontUPP      userUPP);
  186. #endif  /* CALL_NOT_IN_CARBON */
  187. #else
  188.     enum { uppgxShapeSpoolProcInfo = 0x000003E1 };                  /* 2_bytes Func(4_bytes, 4_bytes) */
  189.     enum { uppgxUserViewPortFilterProcInfo = 0x00000FC1 };          /* no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  190.     enum { uppgxConvertQDFontProcInfo = 0x00000FF1 };               /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  191.     #define NewgxShapeSpoolUPP(userRoutine)                         (gxShapeSpoolUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  192.     #define NewgxUserViewPortFilterUPP(userRoutine)                 (gxUserViewPortFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  193.     #define NewgxConvertQDFontUPP(userRoutine)                      (gxConvertQDFontUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  194.     #define DisposegxShapeSpoolUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  195.     #define DisposegxUserViewPortFilterUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  196.     #define DisposegxConvertQDFontUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  197.     #define InvokegxShapeSpoolUPP(toSpool, refCon, userUPP)         (OSErr)CALL_TWO_PARAMETER_UPP((userUPP), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  198.     #define InvokegxUserViewPortFilterUPP(toFilter, portOrder, refCon, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  199.     #define InvokegxConvertQDFontUPP(dst, txFont, txFace, userUPP)  (long)CALL_THREE_PARAMETER_UPP((userUPP), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  200. #endif
  201. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  202. #define NewgxShapeSpoolProc(userRoutine)                        NewgxShapeSpoolUPP(userRoutine)
  203. #define NewgxUserViewPortFilterProc(userRoutine)                NewgxUserViewPortFilterUPP(userRoutine)
  204. #define NewgxConvertQDFontProc(userRoutine)                     NewgxConvertQDFontUPP(userRoutine)
  205. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)      InvokegxShapeSpoolUPP(toSpool, refCon, userRoutine)
  206. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon) InvokegxUserViewPortFilterUPP(toFilter, portOrder, refCon, userRoutine)
  207. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace) InvokegxConvertQDFontUPP(dst, txFont, txFace, userRoutine)
  208. typedef gxShapeSpoolProcPtr             gxShapeSpoolFunction;
  209. typedef gxUserViewPortFilterProcPtr     gxUserViewPortFilter;
  210. typedef gxConvertQDFontProcPtr          gxConvertQDFontFunction;
  211. /* mouse utilities */
  212. /* return mouse location in fixed-gxPoint global space */
  213. #if CALL_NOT_IN_CARBON
  214. EXTERN_API_C( void )
  215. GXGetGlobalMouse                (gxPoint *              globalPt)                           THREEWORDINLINE(0x303C, 0x023C, 0xA832);
  216. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  217. EXTERN_API_C( void )
  218. GXGetViewPortMouse              (gxViewPort             portOrder,
  219.                                  gxPoint *              localPt)                            THREEWORDINLINE(0x303C, 0x023D, 0xA832);
  220. /* printing utilities */
  221. EXTERN_API_C( gxUserViewPortFilterUPP )
  222. GXGetViewPortFilter             (gxViewPort             portOrder,
  223.                                  long *                 refCon)                             THREEWORDINLINE(0x303C, 0x025E, 0xA832);
  224. EXTERN_API_C( void )
  225. GXSetViewPortFilter             (gxViewPort             portOrder,
  226.                                  gxUserViewPortFilterUPP  filter,
  227.                                  long                   refCon)                             THREEWORDINLINE(0x303C, 0x023E, 0xA832);
  228. /* QD to QD GX Translator functions */
  229. EXTERN_API_C( void )
  230. GXInstallQDTranslator           (GrafPtr                port,
  231.                                  gxTranslationOption    options,
  232.                                  const Rect *           srcRect,
  233.                                  const Rect *           dstRect,
  234.                                  Point                  styleStrech,
  235.                                  gxShapeSpoolUPP        userFunction,
  236.                                  void *                 reference)                          THREEWORDINLINE(0x303C, 0x023F, 0xA832);
  237. EXTERN_API_C( gxTranslationStatistic )
  238. GXRemoveQDTranslator            (GrafPtr                port,
  239.                                  gxTranslationStatistic * statistic)                        THREEWORDINLINE(0x303C, 0x0240, 0xA832);
  240. EXTERN_API_C( gxShape )
  241. GXConvertPICTToShape            (PicHandle              pict,
  242.                                  gxTranslationOption    options,
  243.                                  const Rect *           srcRect,
  244.                                  const Rect *           dstRect,
  245.                                  Point                  styleStretch,
  246.                                  gxShape                destination,
  247.                                  gxTranslationStatistic * stats)                            THREEWORDINLINE(0x303C, 0x0241, 0xA832);
  248. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  249. EXTERN_API_C( long )
  250. GXConvertQDFont                 (gxStyle                theStyle,
  251.                                  long                   txFont,
  252.                                  long                   txFace)                             THREEWORDINLINE(0x303C, 0x0242, 0xA832);
  253. EXTERN_API_C( gxConvertQDFontUPP )
  254. GXGetConvertQDFont              (void)                                                      THREEWORDINLINE(0x303C, 0x0243, 0xA832);
  255. EXTERN_API_C( void )
  256. GXSetConvertQDFont              (gxConvertQDFontUPP     userFunction)                       THREEWORDINLINE(0x303C, 0x0244, 0xA832);
  257. #endif  /* CALL_NOT_IN_CARBON */
  258. typedef unsigned long                   gxProfilePoolAttributes;
  259. struct gxFlatProfileListItem {
  260.     gxProfilePoolAttributes         attributes;                 /* information about this particular profile's source*/
  261.     CMProfileRef                    profileRef;                 /* reference to profile, only valid before shape is disposed*/
  262.     CMProfileIdentifier             identifier;                 /* information on how to find the profile upon unflattening*/
  263. };
  264. typedef struct gxFlatProfileListItem    gxFlatProfileListItem;
  265.  
  266. #if defined(__MWERKS__) && TARGET_CPU_68K
  267.     #pragma pop
  268. #endif
  269. #if PRAGMA_STRUCT_ALIGN
  270.     #pragma options align=reset
  271. #elif PRAGMA_STRUCT_PACKPUSH
  272.     #pragma pack(pop)
  273. #elif PRAGMA_STRUCT_PACK
  274.     #pragma pack()
  275. #endif
  276. #ifdef PRAGMA_IMPORT_OFF
  277. #pragma import off
  278. #elif PRAGMA_IMPORT
  279. #pragma import reset
  280. #endif
  281. #ifdef __cplusplus
  282. }
  283. #endif
  284. #endif /* __GXENVIRONMENT__ */