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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Quickdraw.h
  3.  
  4.      Contains:   Interface to Quickdraw Graphics
  5.  
  6.      Version:    Technology: Mac OS 9
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1985-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 __QUICKDRAW__
  18. #define __QUICKDRAW__
  19. #ifndef __COMPONENTS__
  20. #include "Components.h"
  21. #endif
  22. #ifndef __MACTYPES__
  23. #include "MacTypes.h"
  24. #endif
  25. #ifndef __MIXEDMODE__
  26. #include "MixedMode.h"
  27. #endif
  28. #ifndef __QUICKDRAWTEXT__
  29. #include "QuickdrawText.h"
  30. #endif
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40. #if PRAGMA_STRUCT_ALIGN
  41.     #pragma options align=mac68k
  42. #elif PRAGMA_STRUCT_PACKPUSH
  43.     #pragma pack(push, 2)
  44. #elif PRAGMA_STRUCT_PACK
  45.     #pragma pack(2)
  46. #endif
  47. enum {
  48.     invalColReq                 = -1                            /*invalid color table request*/
  49. };
  50. enum {
  51.                                                                 /* transfer modes */
  52.     srcCopy                     = 0,                            /*the 16 transfer modes*/
  53.     srcOr                       = 1,
  54.     srcXor                      = 2,
  55.     srcBic                      = 3,
  56.     notSrcCopy                  = 4,
  57.     notSrcOr                    = 5,
  58.     notSrcXor                   = 6,
  59.     notSrcBic                   = 7,
  60.     patCopy                     = 8,
  61.     patOr                       = 9,
  62.     patXor                      = 10,
  63.     patBic                      = 11,
  64.     notPatCopy                  = 12,
  65.     notPatOr                    = 13,
  66.     notPatXor                   = 14,
  67.     notPatBic                   = 15,                           /* Special Text Transfer Mode */
  68.     grayishTextOr               = 49,
  69.     hilitetransfermode          = 50,
  70.     hilite                      = 50,                           /* Arithmetic transfer modes */
  71.     blend                       = 32,
  72.     addPin                      = 33,
  73.     addOver                     = 34,
  74.     subPin                      = 35,
  75.     addMax                      = 37,
  76.     adMax                       = 37,
  77.     subOver                     = 38,
  78.     adMin                       = 39,
  79.     ditherCopy                  = 64,                           /* Transparent mode constant */
  80.     transparent                 = 36
  81. };
  82. enum {
  83.     italicBit                   = 1,
  84.     ulineBit                    = 2,
  85.     outlineBit                  = 3,
  86.     shadowBit                   = 4,
  87.     condenseBit                 = 5,
  88.     extendBit                   = 6
  89. };
  90. enum {
  91.                                                                 /* QuickDraw color separation constants */
  92.     normalBit                   = 0,                            /*normal screen mapping*/
  93.     inverseBit                  = 1,                            /*inverse screen mapping*/
  94.     redBit                      = 4,                            /*RGB additive mapping*/
  95.     greenBit                    = 3,
  96.     blueBit                     = 2,
  97.     cyanBit                     = 8,                            /*CMYBk subtractive mapping*/
  98.     magentaBit                  = 7,
  99.     yellowBit                   = 6,
  100.     blackBit                    = 5
  101. };
  102. enum {
  103.     blackColor                  = 33,                           /*colors expressed in these mappings*/
  104.     whiteColor                  = 30,
  105.     redColor                    = 205,
  106.     greenColor                  = 341,
  107.     blueColor                   = 409,
  108.     cyanColor                   = 273,
  109.     magentaColor                = 137,
  110.     yellowColor                 = 69
  111. };
  112. enum {
  113.     picLParen                   = 0,                            /*standard picture comments*/
  114.     picRParen                   = 1,
  115.     clutType                    = 0,                            /*0 if lookup table*/
  116.     fixedType                   = 1,                            /*1 if fixed table*/
  117.     directType                  = 2,                            /*2 if direct values*/
  118.     gdDevType                   = 0                             /*0 = monochrome 1 = color*/
  119. };
  120. enum {
  121.     interlacedDevice            = 2,                            /* 1 if single pixel lines look bad */
  122.     roundedDevice               = 5,                            /* 1 if device has been "rounded" into the GrayRgn */
  123.     hasAuxMenuBar               = 6,                            /* 1 if device has an aux menu bar on it */
  124.     burstDevice                 = 7,
  125.     ext32Device                 = 8,
  126.     ramInit                     = 10,                           /*1 if initialized from 'scrn' resource*/
  127.     mainScreen                  = 11,                           /* 1 if main screen */
  128.     allInit                     = 12,                           /* 1 if all devices initialized */
  129.     screenDevice                = 13,                           /*1 if screen device [not used]*/
  130.     noDriver                    = 14,                           /* 1 if no driver for this GDevice */
  131.     screenActive                = 15,                           /*1 if in use*/
  132.     hiliteBit                   = 7,                            /*flag bit in HiliteMode (lowMem flag)*/
  133.     pHiliteBit                  = 0,                            /*flag bit in HiliteMode used with BitClr procedure*/
  134.     defQDColors                 = 127,                          /*resource ID of clut for default QDColors*/
  135.                                                                 /* pixel type */
  136.     RGBDirect                   = 16,                           /* 16 & 32 bits/pixel pixelType value */
  137.                                                                 /* pmVersion values */
  138.     baseAddr32                  = 4                             /*pixmap base address is 32-bit address*/
  139. };
  140. enum {
  141.     sysPatListID                = 0,
  142.     iBeamCursor                 = 1,
  143.     crossCursor                 = 2,
  144.     plusCursor                  = 3,
  145.     watchCursor                 = 4
  146. };
  147. enum {
  148.     kQDGrafVerbFrame            = 0,
  149.     kQDGrafVerbPaint            = 1,
  150.     kQDGrafVerbErase            = 2,
  151.     kQDGrafVerbInvert           = 3,
  152.     kQDGrafVerbFill             = 4
  153. };
  154. #if OLDROUTINENAMES
  155. enum {
  156.     frame                       = kQDGrafVerbFrame,
  157.     paint                       = kQDGrafVerbPaint,
  158.     erase                       = kQDGrafVerbErase,
  159.     invert                      = kQDGrafVerbInvert,
  160.     fill                        = kQDGrafVerbFill
  161. };
  162. #endif  /* OLDROUTINENAMES */
  163. typedef SInt8                           GrafVerb;
  164. enum {
  165.     chunky                      = 0,
  166.     chunkyPlanar                = 1,
  167.     planar                      = 2
  168. };
  169. typedef SInt8                           PixelType;
  170. typedef short                           Bits16[16];
  171. /***************   IMPORTANT NOTE REGARDING Pattern  **************************************
  172.    Patterns were originally defined as:
  173.    
  174.         C:          typedef unsigned char Pattern[8];
  175.         Pascal:     Pattern = PACKED ARRAY [0..7] OF 0..255;
  176.         
  177.    The old array definition of Pattern would cause 68000 based CPU's to crash in certain circum-
  178.    stances. The new struct definition is safe, but may require source code changes to compile.
  179.     
  180. *********************************************************************************************/
  181. struct Pattern {
  182.     UInt8                           pat[8];
  183. };
  184. typedef struct Pattern                  Pattern;
  185. /*
  186.  ConstPatternParam is no longer needed.  It was first created when Pattern was an array.
  187.  Now that Pattern is a struct, it is more straight forward to just add the "const" qualifier
  188.  on the parameter type (e.g. "const Pattern * pat" instead of "ConstPatternParam pat").
  189. */
  190. typedef const Pattern *                 ConstPatternParam;
  191. typedef Pattern *                       PatPtr;
  192. typedef PatPtr *                        PatHandle;
  193. typedef SignedByte                      QDByte;
  194. typedef QDByte *                        QDPtr;
  195. typedef QDPtr *                         QDHandle;
  196. typedef short                           QDErr;
  197. enum {
  198.     singleDevicesBit            = 0,
  199.     dontMatchSeedsBit           = 1,
  200.     allDevicesBit               = 2
  201. };
  202. enum {
  203.     singleDevices               = 1 << singleDevicesBit,
  204.     dontMatchSeeds              = 1 << dontMatchSeedsBit,
  205.     allDevices                  = 1 << allDevicesBit
  206. };
  207. typedef unsigned long                   DeviceLoopFlags;
  208. /*
  209.     PrinterStatusOpcode.  For communication with downloading and printing services.
  210. */
  211. typedef SInt32                          PrinterStatusOpcode;
  212. enum {
  213.     kPrinterFontStatus          = 0,
  214.     kPrinterScalingStatus       = 1
  215. };
  216. struct PrinterFontStatus {
  217.     SInt32                          oResult;
  218.     SInt16                          iFondID;
  219.     Style                           iStyle;
  220. };
  221. typedef struct PrinterFontStatus        PrinterFontStatus;
  222. struct PrinterScalingStatus {
  223.     Point                           oScalingFactors;
  224. };
  225. typedef struct PrinterScalingStatus     PrinterScalingStatus;
  226. struct BitMap {
  227.     Ptr                             baseAddr;
  228.     short                           rowBytes;
  229.     Rect                            bounds;
  230. };
  231. typedef struct BitMap                   BitMap;
  232. typedef BitMap *                        BitMapPtr;
  233. typedef BitMapPtr *                     BitMapHandle;
  234. struct Cursor {
  235.     Bits16                          data;
  236.     Bits16                          mask;
  237.     Point                           hotSpot;
  238. };
  239. typedef struct Cursor                   Cursor;
  240. typedef Cursor *                        CursPtr;
  241. typedef CursPtr *                       CursHandle;
  242. struct PenState {
  243.     Point                           pnLoc;
  244.     Point                           pnSize;
  245.     short                           pnMode;
  246.     Pattern                         pnPat;
  247. };
  248. typedef struct PenState                 PenState;
  249. #if !OPAQUE_TOOLBOX_STRUCTS
  250. struct MacRegion {
  251.     unsigned short                  rgnSize;                    /*size in bytes*/
  252.     Rect                            rgnBBox;                    /*enclosing rectangle*/
  253. };
  254. typedef struct MacRegion                MacRegion;
  255. /*
  256.     The type name "Region" has a name space collision on Win32.
  257.     Use MacRegion to be cross-platfrom safe.
  258. */
  259. #if TARGET_OS_MAC
  260. typedef MacRegion                       Region;
  261. #endif  /* TARGET_OS_MAC */
  262. typedef MacRegion *                     RgnPtr;
  263. typedef RgnPtr *                        RgnHandle;
  264. #else
  265. typedef struct OpaqueRgnHandle*         RgnHandle;
  266. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  267. struct Picture {
  268.     short                           picSize;
  269.     Rect                            picFrame;
  270. };
  271. typedef struct Picture                  Picture;
  272. typedef Picture *                       PicPtr;
  273. typedef PicPtr *                        PicHandle;
  274. struct MacPolygon {
  275.     short                           polySize;
  276.     Rect                            polyBBox;
  277.     Point                           polyPoints[1];
  278. };
  279. typedef struct MacPolygon               MacPolygon;
  280. /*
  281.     The type name "Polygon" has a name space collision on Win32.
  282.     Use MacPolygon to be cross-platfrom safe.
  283. */
  284. #if TARGET_OS_MAC
  285. typedef MacPolygon                      Polygon;
  286. #endif  /* TARGET_OS_MAC */
  287. typedef MacPolygon *                    PolyPtr;
  288. typedef PolyPtr *                       PolyHandle;
  289. typedef CALLBACK_API( void , QDTextProcPtr )(short byteCount, Ptr textBuf, Point numer, Point denom);
  290. typedef CALLBACK_API( void , QDLineProcPtr )(Point newPt);
  291. typedef CALLBACK_API( void , QDRectProcPtr )(GrafVerb verb, Rect *r);
  292. typedef CALLBACK_API( void , QDRRectProcPtr )(GrafVerb verb, Rect *r, short ovalWidth, short ovalHeight);
  293. typedef CALLBACK_API( void , QDOvalProcPtr )(GrafVerb verb, Rect *r);
  294. typedef CALLBACK_API( void , QDArcProcPtr )(GrafVerb verb, Rect *r, short startAngle, short arcAngle);
  295. typedef CALLBACK_API( void , QDPolyProcPtr )(GrafVerb verb, PolyHandle poly);
  296. typedef CALLBACK_API( void , QDRgnProcPtr )(GrafVerb verb, RgnHandle rgn);
  297. typedef CALLBACK_API( void , QDBitsProcPtr )(BitMap *srcBits, Rect *srcRect, Rect *dstRect, short mode, RgnHandle maskRgn);
  298. typedef CALLBACK_API( void , QDCommentProcPtr )(short kind, short dataSize, Handle dataHandle);
  299. typedef CALLBACK_API( short , QDTxMeasProcPtr )(short byteCount, Ptr textAddr, Point *numer, Point *denom, FontInfo *info);
  300. typedef CALLBACK_API( void , QDGetPicProcPtr )(Ptr dataPtr, short byteCount);
  301. typedef CALLBACK_API( void , QDPutPicProcPtr )(Ptr dataPtr, short byteCount);
  302. typedef CALLBACK_API( void , QDOpcodeProcPtr )(Rect *fromRect, Rect *toRect, short opcode, short version);
  303. typedef CALLBACK_API_C( OSStatus , QDStdGlyphsProcPtr )(void *dataStream, ByteCount size);
  304. typedef CALLBACK_API( void , QDJShieldCursorProcPtr )(short left, short top, short right, short bottom);
  305. typedef STACK_UPP_TYPE(QDTextProcPtr)                           QDTextUPP;
  306. typedef STACK_UPP_TYPE(QDLineProcPtr)                           QDLineUPP;
  307. typedef STACK_UPP_TYPE(QDRectProcPtr)                           QDRectUPP;
  308. typedef STACK_UPP_TYPE(QDRRectProcPtr)                          QDRRectUPP;
  309. typedef STACK_UPP_TYPE(QDOvalProcPtr)                           QDOvalUPP;
  310. typedef STACK_UPP_TYPE(QDArcProcPtr)                            QDArcUPP;
  311. typedef STACK_UPP_TYPE(QDPolyProcPtr)                           QDPolyUPP;
  312. typedef STACK_UPP_TYPE(QDRgnProcPtr)                            QDRgnUPP;
  313. typedef STACK_UPP_TYPE(QDBitsProcPtr)                           QDBitsUPP;
  314. typedef STACK_UPP_TYPE(QDCommentProcPtr)                        QDCommentUPP;
  315. typedef STACK_UPP_TYPE(QDTxMeasProcPtr)                         QDTxMeasUPP;
  316. typedef STACK_UPP_TYPE(QDGetPicProcPtr)                         QDGetPicUPP;
  317. typedef STACK_UPP_TYPE(QDPutPicProcPtr)                         QDPutPicUPP;
  318. typedef STACK_UPP_TYPE(QDOpcodeProcPtr)                         QDOpcodeUPP;
  319. typedef STACK_UPP_TYPE(QDStdGlyphsProcPtr)                      QDStdGlyphsUPP;
  320. typedef STACK_UPP_TYPE(QDJShieldCursorProcPtr)                  QDJShieldCursorUPP;
  321. struct QDProcs {
  322.     QDTextUPP                       textProc;
  323.     QDLineUPP                       lineProc;
  324.     QDRectUPP                       rectProc;
  325.     QDRRectUPP                      rRectProc;
  326.     QDOvalUPP                       ovalProc;
  327.     QDArcUPP                        arcProc;
  328.     QDPolyUPP                       polyProc;
  329.     QDRgnUPP                        rgnProc;
  330.     QDBitsUPP                       bitsProc;
  331.     QDCommentUPP                    commentProc;
  332.     QDTxMeasUPP                     txMeasProc;
  333.     QDGetPicUPP                     getPicProc;
  334.     QDPutPicUPP                     putPicProc;
  335. };
  336. typedef struct QDProcs                  QDProcs;
  337. typedef QDProcs *                       QDProcsPtr;
  338. #if OPAQUE_UPP_TYPES
  339.     EXTERN_API(QDTextUPP)
  340.     NewQDTextUPP                   (QDTextProcPtr           userRoutine);
  341.     EXTERN_API(QDLineUPP)
  342.     NewQDLineUPP                   (QDLineProcPtr           userRoutine);
  343.     EXTERN_API(QDRectUPP)
  344.     NewQDRectUPP                   (QDRectProcPtr           userRoutine);
  345.     EXTERN_API(QDRRectUPP)
  346.     NewQDRRectUPP                  (QDRRectProcPtr          userRoutine);
  347.     EXTERN_API(QDOvalUPP)
  348.     NewQDOvalUPP                   (QDOvalProcPtr           userRoutine);
  349.     EXTERN_API(QDArcUPP)
  350.     NewQDArcUPP                    (QDArcProcPtr            userRoutine);
  351.     EXTERN_API(QDPolyUPP)
  352.     NewQDPolyUPP                   (QDPolyProcPtr           userRoutine);
  353.     EXTERN_API(QDRgnUPP)
  354.     NewQDRgnUPP                    (QDRgnProcPtr            userRoutine);
  355.     EXTERN_API(QDBitsUPP)
  356.     NewQDBitsUPP                   (QDBitsProcPtr           userRoutine);
  357.     EXTERN_API(QDCommentUPP)
  358.     NewQDCommentUPP                (QDCommentProcPtr        userRoutine);
  359.     EXTERN_API(QDTxMeasUPP)
  360.     NewQDTxMeasUPP                 (QDTxMeasProcPtr         userRoutine);
  361.     EXTERN_API(QDGetPicUPP)
  362.     NewQDGetPicUPP                 (QDGetPicProcPtr         userRoutine);
  363.     EXTERN_API(QDPutPicUPP)
  364.     NewQDPutPicUPP                 (QDPutPicProcPtr         userRoutine);
  365.     EXTERN_API(QDOpcodeUPP)
  366.     NewQDOpcodeUPP                 (QDOpcodeProcPtr         userRoutine);
  367.     EXTERN_API(QDStdGlyphsUPP)
  368.     NewQDStdGlyphsUPP              (QDStdGlyphsProcPtr      userRoutine);
  369.     EXTERN_API(QDJShieldCursorUPP)
  370.     NewQDJShieldCursorUPP          (QDJShieldCursorProcPtr  userRoutine);
  371.     EXTERN_API(void)
  372.     DisposeQDTextUPP               (QDTextUPP               userUPP);
  373.     EXTERN_API(void)
  374.     DisposeQDLineUPP               (QDLineUPP               userUPP);
  375.     EXTERN_API(void)
  376.     DisposeQDRectUPP               (QDRectUPP               userUPP);
  377.     EXTERN_API(void)
  378.     DisposeQDRRectUPP              (QDRRectUPP              userUPP);
  379.     EXTERN_API(void)
  380.     DisposeQDOvalUPP               (QDOvalUPP               userUPP);
  381.     EXTERN_API(void)
  382.     DisposeQDArcUPP                (QDArcUPP                userUPP);
  383.     EXTERN_API(void)
  384.     DisposeQDPolyUPP               (QDPolyUPP               userUPP);
  385.     EXTERN_API(void)
  386.     DisposeQDRgnUPP                (QDRgnUPP                userUPP);
  387.     EXTERN_API(void)
  388.     DisposeQDBitsUPP               (QDBitsUPP               userUPP);
  389.     EXTERN_API(void)
  390.     DisposeQDCommentUPP            (QDCommentUPP            userUPP);
  391.     EXTERN_API(void)
  392.     DisposeQDTxMeasUPP             (QDTxMeasUPP             userUPP);
  393.     EXTERN_API(void)
  394.     DisposeQDGetPicUPP             (QDGetPicUPP             userUPP);
  395.     EXTERN_API(void)
  396.     DisposeQDPutPicUPP             (QDPutPicUPP             userUPP);
  397.     EXTERN_API(void)
  398.     DisposeQDOpcodeUPP             (QDOpcodeUPP             userUPP);
  399.     EXTERN_API(void)
  400.     DisposeQDStdGlyphsUPP          (QDStdGlyphsUPP          userUPP);
  401.     EXTERN_API(void)
  402.     DisposeQDJShieldCursorUPP      (QDJShieldCursorUPP      userUPP);
  403.     EXTERN_API(void)
  404.     InvokeQDTextUPP                (short                   byteCount,
  405.                                     Ptr                     textBuf,
  406.                                     Point                   numer,
  407.                                     Point                   denom,
  408.                                     QDTextUPP               userUPP);
  409.     EXTERN_API(void)
  410.     InvokeQDLineUPP                (Point                   newPt,
  411.                                     QDLineUPP               userUPP);
  412.     EXTERN_API(void)
  413.     InvokeQDRectUPP                (GrafVerb                verb,
  414.                                     Rect *                  r,
  415.                                     QDRectUPP               userUPP);
  416.     EXTERN_API(void)
  417.     InvokeQDRRectUPP               (GrafVerb                verb,
  418.                                     Rect *                  r,
  419.                                     short                   ovalWidth,
  420.                                     short                   ovalHeight,
  421.                                     QDRRectUPP              userUPP);
  422.     EXTERN_API(void)
  423.     InvokeQDOvalUPP                (GrafVerb                verb,
  424.                                     Rect *                  r,
  425.                                     QDOvalUPP               userUPP);
  426.     EXTERN_API(void)
  427.     InvokeQDArcUPP                 (GrafVerb                verb,
  428.                                     Rect *                  r,
  429.                                     short                   startAngle,
  430.                                     short                   arcAngle,
  431.                                     QDArcUPP                userUPP);
  432.     EXTERN_API(void)
  433.     InvokeQDPolyUPP                (GrafVerb                verb,
  434.                                     PolyHandle              poly,
  435.                                     QDPolyUPP               userUPP);
  436.     EXTERN_API(void)
  437.     InvokeQDRgnUPP                 (GrafVerb                verb,
  438.                                     RgnHandle               rgn,
  439.                                     QDRgnUPP                userUPP);
  440.     EXTERN_API(void)
  441.     InvokeQDBitsUPP                (BitMap *                srcBits,
  442.                                     Rect *                  srcRect,
  443.                                     Rect *                  dstRect,
  444.                                     short                   mode,
  445.                                     RgnHandle               maskRgn,
  446.                                     QDBitsUPP               userUPP);
  447.     EXTERN_API(void)
  448.     InvokeQDCommentUPP             (short                   kind,
  449.                                     short                   dataSize,
  450.                                     Handle                  dataHandle,
  451.                                     QDCommentUPP            userUPP);
  452.     EXTERN_API(short)
  453.     InvokeQDTxMeasUPP              (short                   byteCount,
  454.                                     Ptr                     textAddr,
  455.                                     Point *                 numer,
  456.                                     Point *                 denom,
  457.                                     FontInfo *              info,
  458.                                     QDTxMeasUPP             userUPP);
  459.     EXTERN_API(void)
  460.     InvokeQDGetPicUPP              (Ptr                     dataPtr,
  461.                                     short                   byteCount,
  462.                                     QDGetPicUPP             userUPP);
  463.     EXTERN_API(void)
  464.     InvokeQDPutPicUPP              (Ptr                     dataPtr,
  465.                                     short                   byteCount,
  466.                                     QDPutPicUPP             userUPP);
  467.     EXTERN_API(void)
  468.     InvokeQDOpcodeUPP              (Rect *                  fromRect,
  469.                                     Rect *                  toRect,
  470.                                     short                   opcode,
  471.                                     short                   version,
  472.                                     QDOpcodeUPP             userUPP);
  473.     EXTERN_API(OSStatus)
  474.     InvokeQDStdGlyphsUPP           (void *                  dataStream,
  475.                                     ByteCount               size,
  476.                                     QDStdGlyphsUPP          userUPP);
  477.     EXTERN_API(void)
  478.     InvokeQDJShieldCursorUPP       (short                   left,
  479.                                     short                   top,
  480.                                     short                   right,
  481.                                     short                   bottom,
  482.                                     QDJShieldCursorUPP      userUPP);
  483. #else
  484.     enum { uppQDTextProcInfo = 0x00003F80 };                        /* pascal no_return_value Func(2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  485.     enum { uppQDLineProcInfo = 0x000000C0 };                        /* pascal no_return_value Func(4_bytes) */
  486.     enum { uppQDRectProcInfo = 0x00000340 };                        /* pascal no_return_value Func(1_byte, 4_bytes) */
  487.     enum { uppQDRRectProcInfo = 0x00002B40 };                       /* pascal no_return_value Func(1_byte, 4_bytes, 2_bytes, 2_bytes) */
  488.     enum { uppQDOvalProcInfo = 0x00000340 };                        /* pascal no_return_value Func(1_byte, 4_bytes) */
  489.     enum { uppQDArcProcInfo = 0x00002B40 };                         /* pascal no_return_value Func(1_byte, 4_bytes, 2_bytes, 2_bytes) */
  490.     enum { uppQDPolyProcInfo = 0x00000340 };                        /* pascal no_return_value Func(1_byte, 4_bytes) */
  491.     enum { uppQDRgnProcInfo = 0x00000340 };                         /* pascal no_return_value Func(1_byte, 4_bytes) */
  492.     enum { uppQDBitsProcInfo = 0x0000EFC0 };                        /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes, 2_bytes, 4_bytes) */
  493.     enum { uppQDCommentProcInfo = 0x00000E80 };                     /* pascal no_return_value Func(2_bytes, 2_bytes, 4_bytes) */
  494.     enum { uppQDTxMeasProcInfo = 0x0000FFA0 };                      /* pascal 2_bytes Func(2_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  495.     enum { uppQDGetPicProcInfo = 0x000002C0 };                      /* pascal no_return_value Func(4_bytes, 2_bytes) */
  496.     enum { uppQDPutPicProcInfo = 0x000002C0 };                      /* pascal no_return_value Func(4_bytes, 2_bytes) */
  497.     enum { uppQDOpcodeProcInfo = 0x00002BC0 };                      /* pascal no_return_value Func(4_bytes, 4_bytes, 2_bytes, 2_bytes) */
  498.     enum { uppQDStdGlyphsProcInfo = 0x000003F1 };                   /* 4_bytes Func(4_bytes, 4_bytes) */
  499.     enum { uppQDJShieldCursorProcInfo = 0x00002A80 };               /* pascal no_return_value Func(2_bytes, 2_bytes, 2_bytes, 2_bytes) */
  500.     #define NewQDTextUPP(userRoutine)                               (QDTextUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDTextProcInfo, GetCurrentArchitecture())
  501.     #define NewQDLineUPP(userRoutine)                               (QDLineUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDLineProcInfo, GetCurrentArchitecture())
  502.     #define NewQDRectUPP(userRoutine)                               (QDRectUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDRectProcInfo, GetCurrentArchitecture())
  503.     #define NewQDRRectUPP(userRoutine)                              (QDRRectUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDRRectProcInfo, GetCurrentArchitecture())
  504.     #define NewQDOvalUPP(userRoutine)                               (QDOvalUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDOvalProcInfo, GetCurrentArchitecture())
  505.     #define NewQDArcUPP(userRoutine)                                (QDArcUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDArcProcInfo, GetCurrentArchitecture())
  506.     #define NewQDPolyUPP(userRoutine)                               (QDPolyUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDPolyProcInfo, GetCurrentArchitecture())
  507.     #define NewQDRgnUPP(userRoutine)                                (QDRgnUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDRgnProcInfo, GetCurrentArchitecture())
  508.     #define NewQDBitsUPP(userRoutine)                               (QDBitsUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDBitsProcInfo, GetCurrentArchitecture())
  509.     #define NewQDCommentUPP(userRoutine)                            (QDCommentUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDCommentProcInfo, GetCurrentArchitecture())
  510.     #define NewQDTxMeasUPP(userRoutine)                             (QDTxMeasUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDTxMeasProcInfo, GetCurrentArchitecture())
  511.     #define NewQDGetPicUPP(userRoutine)                             (QDGetPicUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDGetPicProcInfo, GetCurrentArchitecture())
  512.     #define NewQDPutPicUPP(userRoutine)                             (QDPutPicUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDPutPicProcInfo, GetCurrentArchitecture())
  513.     #define NewQDOpcodeUPP(userRoutine)                             (QDOpcodeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDOpcodeProcInfo, GetCurrentArchitecture())
  514.     #define NewQDStdGlyphsUPP(userRoutine)                          (QDStdGlyphsUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDStdGlyphsProcInfo, GetCurrentArchitecture())
  515.     #define NewQDJShieldCursorUPP(userRoutine)                      (QDJShieldCursorUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDJShieldCursorProcInfo, GetCurrentArchitecture())
  516.     #define DisposeQDTextUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  517.     #define DisposeQDLineUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  518.     #define DisposeQDRectUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  519.     #define DisposeQDRRectUPP(userUPP)                              DisposeRoutineDescriptor(userUPP)
  520.     #define DisposeQDOvalUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  521.     #define DisposeQDArcUPP(userUPP)                                DisposeRoutineDescriptor(userUPP)
  522.     #define DisposeQDPolyUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  523.     #define DisposeQDRgnUPP(userUPP)                                DisposeRoutineDescriptor(userUPP)
  524.     #define DisposeQDBitsUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  525.     #define DisposeQDCommentUPP(userUPP)                            DisposeRoutineDescriptor(userUPP)
  526.     #define DisposeQDTxMeasUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  527.     #define DisposeQDGetPicUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  528.     #define DisposeQDPutPicUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  529.     #define DisposeQDOpcodeUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  530.     #define DisposeQDStdGlyphsUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  531.     #define DisposeQDJShieldCursorUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  532.     #define InvokeQDTextUPP(byteCount, textBuf, numer, denom, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppQDTextProcInfo, (byteCount), (textBuf), (numer), (denom))
  533.     #define InvokeQDLineUPP(newPt, userUPP)                         CALL_ONE_PARAMETER_UPP((userUPP), uppQDLineProcInfo, (newPt))
  534.     #define InvokeQDRectUPP(verb, r, userUPP)                       CALL_TWO_PARAMETER_UPP((userUPP), uppQDRectProcInfo, (verb), (r))
  535.     #define InvokeQDRRectUPP(verb, r, ovalWidth, ovalHeight, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppQDRRectProcInfo, (verb), (r), (ovalWidth), (ovalHeight))
  536.     #define InvokeQDOvalUPP(verb, r, userUPP)                       CALL_TWO_PARAMETER_UPP((userUPP), uppQDOvalProcInfo, (verb), (r))
  537.     #define InvokeQDArcUPP(verb, r, startAngle, arcAngle, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppQDArcProcInfo, (verb), (r), (startAngle), (arcAngle))
  538.     #define InvokeQDPolyUPP(verb, poly, userUPP)                    CALL_TWO_PARAMETER_UPP((userUPP), uppQDPolyProcInfo, (verb), (poly))
  539.     #define InvokeQDRgnUPP(verb, rgn, userUPP)                      CALL_TWO_PARAMETER_UPP((userUPP), uppQDRgnProcInfo, (verb), (rgn))
  540.     #define InvokeQDBitsUPP(srcBits, srcRect, dstRect, mode, maskRgn, userUPP)  CALL_FIVE_PARAMETER_UPP((userUPP), uppQDBitsProcInfo, (srcBits), (srcRect), (dstRect), (mode), (maskRgn))
  541.     #define InvokeQDCommentUPP(kind, dataSize, dataHandle, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppQDCommentProcInfo, (kind), (dataSize), (dataHandle))
  542.     #define InvokeQDTxMeasUPP(byteCount, textAddr, numer, denom, info, userUPP)  (short)CALL_FIVE_PARAMETER_UPP((userUPP), uppQDTxMeasProcInfo, (byteCount), (textAddr), (numer), (denom), (info))
  543.     #define InvokeQDGetPicUPP(dataPtr, byteCount, userUPP)          CALL_TWO_PARAMETER_UPP((userUPP), uppQDGetPicProcInfo, (dataPtr), (byteCount))
  544.     #define InvokeQDPutPicUPP(dataPtr, byteCount, userUPP)          CALL_TWO_PARAMETER_UPP((userUPP), uppQDPutPicProcInfo, (dataPtr), (byteCount))
  545.     #define InvokeQDOpcodeUPP(fromRect, toRect, opcode, version, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppQDOpcodeProcInfo, (fromRect), (toRect), (opcode), (version))
  546.     #define InvokeQDStdGlyphsUPP(dataStream, size, userUPP)         (OSStatus)CALL_TWO_PARAMETER_UPP((userUPP), uppQDStdGlyphsProcInfo, (dataStream), (size))
  547.     #define InvokeQDJShieldCursorUPP(left, top, right, bottom, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppQDJShieldCursorProcInfo, (left), (top), (right), (bottom))
  548. #endif
  549. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  550. #define NewQDTextProc(userRoutine)                              NewQDTextUPP(userRoutine)
  551. #define NewQDLineProc(userRoutine)                              NewQDLineUPP(userRoutine)
  552. #define NewQDRectProc(userRoutine)                              NewQDRectUPP(userRoutine)
  553. #define NewQDRRectProc(userRoutine)                             NewQDRRectUPP(userRoutine)
  554. #define NewQDOvalProc(userRoutine)                              NewQDOvalUPP(userRoutine)
  555. #define NewQDArcProc(userRoutine)                               NewQDArcUPP(userRoutine)
  556. #define NewQDPolyProc(userRoutine)                              NewQDPolyUPP(userRoutine)
  557. #define NewQDRgnProc(userRoutine)                               NewQDRgnUPP(userRoutine)
  558. #define NewQDBitsProc(userRoutine)                              NewQDBitsUPP(userRoutine)
  559. #define NewQDCommentProc(userRoutine)                           NewQDCommentUPP(userRoutine)
  560. #define NewQDTxMeasProc(userRoutine)                            NewQDTxMeasUPP(userRoutine)
  561. #define NewQDGetPicProc(userRoutine)                            NewQDGetPicUPP(userRoutine)
  562. #define NewQDPutPicProc(userRoutine)                            NewQDPutPicUPP(userRoutine)
  563. #define NewQDOpcodeProc(userRoutine)                            NewQDOpcodeUPP(userRoutine)
  564. #define NewQDStdGlyphsProc(userRoutine)                         NewQDStdGlyphsUPP(userRoutine)
  565. #define NewQDJShieldCursorProc(userRoutine)                     NewQDJShieldCursorUPP(userRoutine)
  566. #define CallQDTextProc(userRoutine, byteCount, textBuf, numer, denom) InvokeQDTextUPP(byteCount, textBuf, numer, denom, userRoutine)
  567. #define CallQDLineProc(userRoutine, newPt)                      InvokeQDLineUPP(newPt, userRoutine)
  568. #define CallQDRectProc(userRoutine, verb, r)                    InvokeQDRectUPP(verb, r, userRoutine)
  569. #define CallQDRRectProc(userRoutine, verb, r, ovalWidth, ovalHeight) InvokeQDRRectUPP(verb, r, ovalWidth, ovalHeight, userRoutine)
  570. #define CallQDOvalProc(userRoutine, verb, r)                    InvokeQDOvalUPP(verb, r, userRoutine)
  571. #define CallQDArcProc(userRoutine, verb, r, startAngle, arcAngle) InvokeQDArcUPP(verb, r, startAngle, arcAngle, userRoutine)
  572. #define CallQDPolyProc(userRoutine, verb, poly)                 InvokeQDPolyUPP(verb, poly, userRoutine)
  573. #define CallQDRgnProc(userRoutine, verb, rgn)                   InvokeQDRgnUPP(verb, rgn, userRoutine)
  574. #define CallQDBitsProc(userRoutine, srcBits, srcRect, dstRect, mode, maskRgn) InvokeQDBitsUPP(srcBits, srcRect, dstRect, mode, maskRgn, userRoutine)
  575. #define CallQDCommentProc(userRoutine, kind, dataSize, dataHandle) InvokeQDCommentUPP(kind, dataSize, dataHandle, userRoutine)
  576. #define CallQDTxMeasProc(userRoutine, byteCount, textAddr, numer, denom, info) InvokeQDTxMeasUPP(byteCount, textAddr, numer, denom, info, userRoutine)
  577. #define CallQDGetPicProc(userRoutine, dataPtr, byteCount)       InvokeQDGetPicUPP(dataPtr, byteCount, userRoutine)
  578. #define CallQDPutPicProc(userRoutine, dataPtr, byteCount)       InvokeQDPutPicUPP(dataPtr, byteCount, userRoutine)
  579. #define CallQDOpcodeProc(userRoutine, fromRect, toRect, opcode, version) InvokeQDOpcodeUPP(fromRect, toRect, opcode, version, userRoutine)
  580. #define CallQDStdGlyphsProc(userRoutine, dataStream, size)      InvokeQDStdGlyphsUPP(dataStream, size, userRoutine)
  581. #define CallQDJShieldCursorProc(userRoutine, left, top, right, bottom) InvokeQDJShieldCursorUPP(left, top, right, bottom, userRoutine)
  582. #if !OPAQUE_TOOLBOX_STRUCTS
  583. struct GrafPort {
  584.     short                           device;
  585.     BitMap                          portBits;
  586.     Rect                            portRect;
  587.     RgnHandle                       visRgn;
  588.     RgnHandle                       clipRgn;
  589.     Pattern                         bkPat;
  590.     Pattern                         fillPat;
  591.     Point                           pnLoc;
  592.     Point                           pnSize;
  593.     short                           pnMode;
  594.     Pattern                         pnPat;
  595.     short                           pnVis;
  596.     short                           txFont;
  597.     StyleField                      txFace;                     /*StyleField occupies 16-bits, but only first 8-bits are used*/
  598.     UInt8                           txFlags;                    /* QuickTime uses second 8 bits of StyleField for txFlags */
  599.     short                           txMode;
  600.     short                           txSize;
  601.     Fixed                           spExtra;
  602.     long                            fgColor;
  603.     long                            bkColor;
  604.     short                           colrBit;
  605.     short                           patStretch;
  606.     Handle                          picSave;
  607.     Handle                          rgnSave;
  608.     Handle                          polySave;
  609.     QDProcsPtr                      grafProcs;
  610. };
  611. typedef struct GrafPort                 GrafPort;
  612. typedef GrafPort *                      GrafPtr;
  613. /*
  614.  *  This set of definitions "belongs" in Windows.
  615.  *  But, there is a circularity in the headers where Windows includes Controls and
  616.  *  Controls includes Windows. To break the circle, the information
  617.  *  needed by Controls is moved from Windows to Quickdraw.
  618.  */
  619. typedef GrafPtr                         WindowPtr;
  620. typedef WindowPtr                       DialogPtr;
  621. #else
  622. typedef struct OpaqueWindowPtr*         WindowPtr;
  623. typedef struct OpaqueDialogPtr*         DialogPtr;
  624. typedef struct OpaqueGrafPtr*           GrafPtr;
  625. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  626. typedef WindowPtr                       WindowRef;
  627. /* DragConstraint constants to pass to DragGray,DragTheRgn, or ConstrainedDragRgn*/
  628. typedef UInt16                          DragConstraint;
  629. enum {
  630.     kNoConstraint               = 0,
  631.     kVerticalConstraint         = 1,
  632.     kHorizontalConstraint       = 2
  633. };
  634. typedef CALLBACK_API( void , DragGrayRgnProcPtr )(void );
  635. /*
  636.  *  Here ends the list of things that "belong" in Windows.
  637.  */
  638. struct RGBColor {
  639.     unsigned short                  red;                        /*magnitude of red component*/
  640.     unsigned short                  green;                      /*magnitude of green component*/
  641.     unsigned short                  blue;                       /*magnitude of blue component*/
  642. };
  643. typedef struct RGBColor                 RGBColor;
  644. typedef RGBColor *                      RGBColorPtr;
  645. typedef RGBColorPtr *                   RGBColorHdl;
  646. typedef CALLBACK_API( Boolean , ColorSearchProcPtr )(RGBColor *rgb, long *position);
  647. typedef CALLBACK_API( Boolean , ColorComplementProcPtr )(RGBColor *rgb);
  648. typedef STACK_UPP_TYPE(DragGrayRgnProcPtr)                      DragGrayRgnUPP;
  649. typedef STACK_UPP_TYPE(ColorSearchProcPtr)                      ColorSearchUPP;
  650. typedef STACK_UPP_TYPE(ColorComplementProcPtr)                  ColorComplementUPP;
  651. #if OPAQUE_UPP_TYPES
  652.     EXTERN_API(DragGrayRgnUPP)
  653.     NewDragGrayRgnUPP              (DragGrayRgnProcPtr      userRoutine);
  654.     EXTERN_API(ColorSearchUPP)
  655.     NewColorSearchUPP              (ColorSearchProcPtr      userRoutine);
  656.     EXTERN_API(ColorComplementUPP)
  657.     NewColorComplementUPP          (ColorComplementProcPtr  userRoutine);
  658.     EXTERN_API(void)
  659.     DisposeDragGrayRgnUPP          (DragGrayRgnUPP          userUPP);
  660.     EXTERN_API(void)
  661.     DisposeColorSearchUPP          (ColorSearchUPP          userUPP);
  662.     EXTERN_API(void)
  663.     DisposeColorComplementUPP      (ColorComplementUPP      userUPP);
  664.     EXTERN_API(void)
  665.     InvokeDragGrayRgnUPP           (DragGrayRgnUPP          userUPP);
  666.     EXTERN_API(Boolean)
  667.     InvokeColorSearchUPP           (RGBColor *              rgb,
  668.                                     long *                  position,
  669.                                     ColorSearchUPP          userUPP);
  670.     EXTERN_API(Boolean)
  671.     InvokeColorComplementUPP       (RGBColor *              rgb,
  672.                                     ColorComplementUPP      userUPP);
  673. #else
  674.     enum { uppDragGrayRgnProcInfo = 0x00000000 };                   /* pascal no_return_value Func() */
  675.     enum { uppColorSearchProcInfo = 0x000003D0 };                   /* pascal 1_byte Func(4_bytes, 4_bytes) */
  676.     enum { uppColorComplementProcInfo = 0x000000D0 };               /* pascal 1_byte Func(4_bytes) */
  677.     #define NewDragGrayRgnUPP(userRoutine)                          (DragGrayRgnUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDragGrayRgnProcInfo, GetCurrentArchitecture())
  678.     #define NewColorSearchUPP(userRoutine)                          (ColorSearchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppColorSearchProcInfo, GetCurrentArchitecture())
  679.     #define NewColorComplementUPP(userRoutine)                      (ColorComplementUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppColorComplementProcInfo, GetCurrentArchitecture())
  680.     #define DisposeDragGrayRgnUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  681.     #define DisposeColorSearchUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  682.     #define DisposeColorComplementUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  683.     #define InvokeDragGrayRgnUPP(userUPP)                           CALL_ZERO_PARAMETER_UPP((userUPP), uppDragGrayRgnProcInfo)
  684.     #define InvokeColorSearchUPP(rgb, position, userUPP)            (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppColorSearchProcInfo, (rgb), (position))
  685.     #define InvokeColorComplementUPP(rgb, userUPP)                  (Boolean)CALL_ONE_PARAMETER_UPP((userUPP), uppColorComplementProcInfo, (rgb))
  686. #endif
  687. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  688. #define NewDragGrayRgnProc(userRoutine)                         NewDragGrayRgnUPP(userRoutine)
  689. #define NewColorSearchProc(userRoutine)                         NewColorSearchUPP(userRoutine)
  690. #define NewColorComplementProc(userRoutine)                     NewColorComplementUPP(userRoutine)
  691. #define CallDragGrayRgnProc(userRoutine)                        InvokeDragGrayRgnUPP(userRoutine)
  692. #define CallColorSearchProc(userRoutine, rgb, position)         InvokeColorSearchUPP(rgb, position, userRoutine)
  693. #define CallColorComplementProc(userRoutine, rgb)               InvokeColorComplementUPP(rgb, userRoutine)
  694. struct ColorSpec {
  695.     short                           value;                      /*index or other value*/
  696.     RGBColor                        rgb;                        /*true color*/
  697. };
  698. typedef struct ColorSpec                ColorSpec;
  699. typedef ColorSpec *                     ColorSpecPtr;
  700. typedef ColorSpec                       CSpecArray[1];
  701. struct ColorTable {
  702.     long                            ctSeed;                     /*unique identifier for table*/
  703.     short                           ctFlags;                    /*high bit: 0 = PixMap; 1 = device*/
  704.     short                           ctSize;                     /*number of entries in CTTable*/
  705.     CSpecArray                      ctTable;                    /*array [0..0] of ColorSpec*/
  706. };
  707. typedef struct ColorTable               ColorTable;
  708. typedef ColorTable *                    CTabPtr;
  709. typedef CTabPtr *                       CTabHandle;
  710. struct xColorSpec {
  711.     short                           value;                      /*index or other value*/
  712.     RGBColor                        rgb;                        /*true color*/
  713.     short                           xalpha;
  714. };
  715. typedef struct xColorSpec               xColorSpec;
  716. typedef xColorSpec *                    xColorSpecPtr;
  717. typedef xColorSpec                      xCSpecArray[1];
  718. struct MatchRec {
  719.     unsigned short                  red;
  720.     unsigned short                  green;
  721.     unsigned short                  blue;
  722.     long                            matchData;
  723. };
  724. typedef struct MatchRec                 MatchRec;
  725. /*
  726.     QuickTime 3.0 makes PixMap data structure available on non-Mac OS's.
  727.     In order to implement PixMap in these alternate environments, the PixMap
  728.     had to be extended. The pmReserved field was changed to pmExt which is
  729.     a Handle to extra info.  The planeBytes field was changed to pixelFormat.
  730.     
  731.     In OS X, Quickdraw also uses the new PixMap data structure.
  732. */
  733. #ifndef OLDPIXMAPSTRUCT
  734. #if TARGET_OS_MAC && TARGET_API_MAC_OS8
  735. #define OLDPIXMAPSTRUCT 1
  736. #else
  737. #define OLDPIXMAPSTRUCT 0
  738. #endif  /* TARGET_OS_MAC && TARGET_API_MAC_OS8 */
  739. #endif  /* !defined(OLDPIXMAPSTRUCT) */
  740. #if OLDPIXMAPSTRUCT
  741.    #define GETPIXMAPPIXELFORMAT(pm)        ( (pm)->pixelSize )
  742. #else
  743.   #define GETPIXMAPPIXELFORMAT(pm)        ( ((pm)->pixelFormat != 0) ? (pm)->pixelFormat : (pm)->pixelSize )
  744. #endif
  745. #if TARGET_OS_MAC && !TARGET_RT_LITTLE_ENDIAN
  746.     #define NON_MAC_PIXEL_FORMATS   0
  747. #else
  748.     #define NON_MAC_PIXEL_FORMATS   1
  749. #endif
  750. /* pixel formats*/
  751. enum {
  752.     k1MonochromePixelFormat     = 0x00000001,                   /* 1 bit indexed*/
  753.     k2IndexedPixelFormat        = 0x00000002,                   /* 2 bit indexed*/
  754.     k4IndexedPixelFormat        = 0x00000004,                   /* 4 bit indexed*/
  755.     k8IndexedPixelFormat        = 0x00000008,                   /* 8 bit indexed*/
  756.     k16BE555PixelFormat         = 0x00000010,                   /* 16 bit BE rgb 555 (Mac)*/
  757.     k24RGBPixelFormat           = 0x00000018,                   /* 24 bit rgb */
  758.     k32ARGBPixelFormat          = 0x00000020,                   /* 32 bit argb    (Mac)*/
  759.     k1IndexedGrayPixelFormat    = 0x00000021,                   /* 1 bit indexed gray*/
  760.     k2IndexedGrayPixelFormat    = 0x00000022,                   /* 2 bit indexed gray*/
  761.     k4IndexedGrayPixelFormat    = 0x00000024,                   /* 4 bit indexed gray*/
  762.     k8IndexedGrayPixelFormat    = 0x00000028                    /* 8 bit indexed gray*/
  763. };
  764. /* values for PixMap.pixelFormat*/
  765. enum {
  766.     k16LE555PixelFormat         = FOUR_CHAR_CODE('L555'),       /* 16 bit LE rgb 555 (PC)*/
  767.     k16LE5551PixelFormat        = FOUR_CHAR_CODE('5551'),       /* 16 bit LE rgb 5551*/
  768.     k16BE565PixelFormat         = FOUR_CHAR_CODE('B565'),       /* 16 bit BE rgb 565*/
  769.     k16LE565PixelFormat         = FOUR_CHAR_CODE('L565'),       /* 16 bit LE rgb 565*/
  770.     k24BGRPixelFormat           = FOUR_CHAR_CODE('24BG'),       /* 24 bit bgr */
  771.     k32BGRAPixelFormat          = FOUR_CHAR_CODE('BGRA'),       /* 32 bit bgra    (Matrox)*/
  772.     k32ABGRPixelFormat          = FOUR_CHAR_CODE('ABGR'),       /* 32 bit abgr    */
  773.     k32RGBAPixelFormat          = FOUR_CHAR_CODE('RGBA'),       /* 32 bit rgba    */
  774.     kYUVSPixelFormat            = FOUR_CHAR_CODE('yuvs'),       /* YUV 4:2:2 byte ordering 16-unsigned = 'YUY2'*/
  775.     kYUVUPixelFormat            = FOUR_CHAR_CODE('yuvu'),       /* YUV 4:2:2 byte ordering 16-signed*/
  776.     kYVU9PixelFormat            = FOUR_CHAR_CODE('YVU9'),       /* YVU9 Planar    9*/
  777.     kYUV411PixelFormat          = FOUR_CHAR_CODE('Y411'),       /* YUV 4:1:1 Interleaved  16*/
  778.     kYVYU422PixelFormat         = FOUR_CHAR_CODE('YVYU'),       /* YVYU 4:2:2 byte ordering   16*/
  779.     kUYVY422PixelFormat         = FOUR_CHAR_CODE('UYVY'),       /* UYVY 4:2:2 byte ordering   16*/
  780.     kYUV211PixelFormat          = FOUR_CHAR_CODE('Y211'),       /* YUV 2:1:1 Packed   8*/
  781.     k2vuyPixelFormat            = FOUR_CHAR_CODE('2vuy')        /* UYVY 4:2:2 byte ordering   16*/
  782. };
  783. #if !OLDPIXMAPSTRUCT
  784. struct PixMapExtension {
  785.     long                            extSize;                    /*size of struct, duh!*/
  786.     unsigned long                   pmBits;                     /*pixmap attributes bitfield*/
  787.     void *                          pmGD;                       /*this is a GDHandle*/
  788.     long                            pmSeed;
  789.     Fixed                           gammaLevel;                 /*pixmap gammalevel*/
  790.     Fixed                           requestedGammaLevel;
  791.     unsigned long                   reserved2;
  792.     long                            longRowBytes;               /*used when rowBytes > 16382*/
  793.     unsigned long                   signature;
  794.     Handle                          baseAddrHandle;
  795. };
  796. typedef struct PixMapExtension          PixMapExtension;
  797. typedef PixMapExtension *               PixMapExtPtr;
  798. typedef PixMapExtPtr *                  PixMapExtHandle;
  799. #endif  /* !OLDPIXMAPSTRUCT */
  800. struct PixMap {
  801.     Ptr                             baseAddr;                   /*pointer to pixels*/
  802.     short                           rowBytes;                   /*offset to next line*/
  803.     Rect                            bounds;                     /*encloses bitmap*/
  804.     short                           pmVersion;                  /*pixMap version number*/
  805.     short                           packType;                   /*defines packing format*/
  806.     long                            packSize;                   /*length of pixel data*/
  807.     Fixed                           hRes;                       /*horiz. resolution (ppi)*/
  808.     Fixed                           vRes;                       /*vert. resolution (ppi)*/
  809.     short                           pixelType;                  /*defines pixel type*/
  810.     short                           pixelSize;                  /*# bits in pixel*/
  811.     short                           cmpCount;                   /*# components in pixel*/
  812.     short                           cmpSize;                    /*# bits per component*/
  813. #if OLDPIXMAPSTRUCT
  814.     long                            planeBytes;                 /*offset to next plane*/
  815.     CTabHandle                      pmTable;                    /*color map for this pixMap*/
  816.     long                            pmReserved;
  817. #else
  818.   OSType                          pixelFormat;                /*fourCharCode representation*/
  819.     CTabHandle                      pmTable;                    /*color map for this pixMap*/
  820.   PixMapExtHandle                 pmExt;                      /*Handle to pixMap extension*/
  821. #endif
  822. };
  823. typedef struct PixMap                   PixMap;
  824. typedef PixMap *                        PixMapPtr;
  825. typedef PixMapPtr *                     PixMapHandle;
  826. struct PixPat {
  827.     short                           patType;                    /*type of pattern*/
  828.     PixMapHandle                    patMap;                     /*the pattern's pixMap*/
  829.     Handle                          patData;                    /*pixmap's data*/
  830.     Handle                          patXData;                   /*expanded Pattern data*/
  831.     short                           patXValid;                  /*flags whether expanded Pattern valid*/
  832.     Handle                          patXMap;                    /*Handle to expanded Pattern data*/
  833.     Pattern                         pat1Data;                   /*old-Style pattern/RGB color*/
  834. };
  835. typedef struct PixPat                   PixPat;
  836. typedef PixPat *                        PixPatPtr;
  837. typedef PixPatPtr *                     PixPatHandle;
  838. struct CCrsr {
  839.     short                           crsrType;                   /*type of cursor*/
  840.     PixMapHandle                    crsrMap;                    /*the cursor's pixmap*/
  841.     Handle                          crsrData;                   /*cursor's data*/
  842.     Handle                          crsrXData;                  /*expanded cursor data*/
  843.     short                           crsrXValid;                 /*depth of expanded data (0 if none)*/
  844.     Handle                          crsrXHandle;                /*future use*/
  845.     Bits16                          crsr1Data;                  /*one-bit cursor*/
  846.     Bits16                          crsrMask;                   /*cursor's mask*/
  847.     Point                           crsrHotSpot;                /*cursor's hotspot*/
  848.     long                            crsrXTable;                 /*private*/
  849.     long                            crsrID;                     /*private*/
  850. };
  851. typedef struct CCrsr                    CCrsr;
  852. typedef CCrsr *                         CCrsrPtr;
  853. typedef CCrsrPtr *                      CCrsrHandle;
  854. struct GammaTbl {
  855.     short                           gVersion;                   /*gamma version number*/
  856.     short                           gType;                      /*gamma data type*/
  857.     short                           gFormulaSize;               /*Formula data size*/
  858.     short                           gChanCnt;                   /*number of channels of data*/
  859.     short                           gDataCnt;                   /*number of values/channel*/
  860.     short                           gDataWidth;                 /*bits/corrected value (data packed to next larger byte size)*/
  861.     short                           gFormulaData[1];            /*data for formulas followed by gamma values*/
  862. };
  863. typedef struct GammaTbl                 GammaTbl;
  864. typedef GammaTbl *                      GammaTblPtr;
  865. typedef GammaTblPtr *                   GammaTblHandle;
  866. struct ITab {
  867.     long                            iTabSeed;                   /*copy of CTSeed from source CTable*/
  868.     short                           iTabRes;                    /*bits/channel resolution of iTable*/
  869.     Byte                            iTTable[1];                 /*byte colortable index values*/
  870. };
  871. typedef struct ITab                     ITab;
  872. typedef ITab *                          ITabPtr;
  873. typedef ITabPtr *                       ITabHandle;
  874. struct SProcRec {
  875.     Handle                          nxtSrch;                    /*SProcHndl Handle to next SProcRec*/
  876.     ColorSearchUPP                  srchProc;                   /*search procedure proc ptr*/
  877. };
  878. typedef struct SProcRec                 SProcRec;
  879. typedef SProcRec *                      SProcPtr;
  880. typedef SProcPtr *                      SProcHndl;
  881. struct CProcRec {
  882.     Handle                          nxtComp;                    /*CProcHndl Handle to next CProcRec*/
  883.     ColorComplementUPP              compProc;                   /*complement procedure proc ptr*/
  884. };
  885. typedef struct CProcRec                 CProcRec;
  886. typedef CProcRec *                      CProcPtr;
  887. typedef CProcPtr *                      CProcHndl;
  888. /*
  889.     QuickTime 3.0 makes GDevice data structure available on non-Mac OS's.
  890.     In order to implement GDevice in these alternate environments, the GDevice
  891.     had to be extended. The gdReserved field was changed to gdExt which is
  892.     a Handle to extra info.  
  893. */
  894. #ifndef OLDGDEVICESTRUCT
  895. #if TARGET_OS_MAC && TARGET_API_MAC_OS8
  896. #define OLDGDEVICESTRUCT 1
  897. #else
  898. #define OLDGDEVICESTRUCT 0
  899. #endif  /* TARGET_OS_MAC && TARGET_API_MAC_OS8 */
  900. #endif  /* !defined(OLDGDEVICESTRUCT) */
  901. typedef struct GDevice                  GDevice;
  902. typedef GDevice *                       GDPtr;
  903. typedef GDPtr *                         GDHandle;
  904. struct GDevice {
  905.     short                           gdRefNum;                   /*driver's unit number*/
  906.     short                           gdID;                       /*client ID for search procs*/
  907.     short                           gdType;                     /*fixed/CLUT/direct*/
  908.     ITabHandle                      gdITable;                   /*Handle to inverse lookup table*/
  909.     short                           gdResPref;                  /*preferred resolution of GDITable*/
  910.     SProcHndl                       gdSearchProc;               /*search proc list head*/
  911.     CProcHndl                       gdCompProc;                 /*complement proc list*/
  912.     short                           gdFlags;                    /*grafDevice flags word*/
  913.     PixMapHandle                    gdPMap;                     /*describing pixMap*/
  914.     long                            gdRefCon;                   /*reference value*/
  915.     GDHandle                        gdNextGD;                   /*GDHandle Handle of next gDevice*/
  916.     Rect                            gdRect;                     /* device's bounds in global coordinates*/
  917.     long                            gdMode;                     /*device's current mode*/
  918.     short                           gdCCBytes;                  /*depth of expanded cursor data*/
  919.     short                           gdCCDepth;                  /*depth of expanded cursor data*/
  920.     Handle                          gdCCXData;                  /*Handle to cursor's expanded data*/
  921.     Handle                          gdCCXMask;                  /*Handle to cursor's expanded mask*/
  922. #if OLDGDEVICESTRUCT
  923.     long                            gdReserved;                 /*future use. MUST BE 0*/
  924. #else
  925.   Handle                          gdExt;                      /*QuickTime 3.0 private info*/
  926. #endif
  927. };
  928. struct GrafVars {
  929.     RGBColor                        rgbOpColor;                 /*color for addPin  subPin and average*/
  930.     RGBColor                        rgbHiliteColor;             /*color for hiliting*/
  931.     Handle                          pmFgColor;                  /*palette Handle for foreground color*/
  932.     short                           pmFgIndex;                  /*index value for foreground*/
  933.     Handle                          pmBkColor;                  /*palette Handle for background color*/
  934.     short                           pmBkIndex;                  /*index value for background*/
  935.     short                           pmFlags;                    /*flags for Palette Manager*/
  936. };
  937. typedef struct GrafVars                 GrafVars;
  938. typedef GrafVars *                      GVarPtr;
  939. typedef GVarPtr *                       GVarHandle;
  940. #if OPAQUE_TOOLBOX_STRUCTS
  941. typedef GrafPtr                         CGrafPtr;
  942. #else
  943. typedef struct CGrafPort                CGrafPort;
  944. typedef CGrafPort *                     CGrafPtr;
  945. #endif  /* OPAQUE_TOOLBOX_STRUCTS */
  946. typedef CALLBACK_API_C( OSStatus , QDPrinterStatusProcPtr )(PrinterStatusOpcode opcode, CGrafPtr currentPort, void *printerStatus);
  947. typedef STACK_UPP_TYPE(QDPrinterStatusProcPtr)                  QDPrinterStatusUPP;
  948. struct CQDProcs {
  949.     QDTextUPP                       textProc;
  950.     QDLineUPP                       lineProc;
  951.     QDRectUPP                       rectProc;
  952.     QDRRectUPP                      rRectProc;
  953.     QDOvalUPP                       ovalProc;
  954.     QDArcUPP                        arcProc;
  955.     QDPolyUPP                       polyProc;
  956.     QDRgnUPP                        rgnProc;
  957.     QDBitsUPP                       bitsProc;
  958.     QDCommentUPP                    commentProc;
  959.     QDTxMeasUPP                     txMeasProc;
  960.     QDGetPicUPP                     getPicProc;
  961.     QDPutPicUPP                     putPicProc;
  962.     QDOpcodeUPP                     opcodeProc;
  963.     UniversalProcPtr                newProc1;                   /* this is the StdPix bottleneck -- see ImageCompression.h */
  964.     QDStdGlyphsUPP                  glyphsProc;                 /* was newProc2; now used in Unicode text drawing */
  965.     QDPrinterStatusUPP              printerStatusProc;          /* was newProc3;  now used to communicate status between Printing code and System imaging code */
  966.     UniversalProcPtr                newProc4;
  967.     UniversalProcPtr                newProc5;
  968.     UniversalProcPtr                newProc6;
  969. };
  970. typedef struct CQDProcs                 CQDProcs;
  971. typedef CQDProcs *                      CQDProcsPtr;
  972. #if !OPAQUE_TOOLBOX_STRUCTS
  973. struct CGrafPort {
  974.     short                           device;
  975.     PixMapHandle                    portPixMap;                 /*port's pixel map*/
  976.     short                           portVersion;                /*high 2 bits always set*/
  977.     Handle                          grafVars;                   /*Handle to more fields*/
  978.     short                           chExtra;                    /*character extra*/
  979.     short                           pnLocHFrac;                 /*pen fraction*/
  980.     Rect                            portRect;
  981.     RgnHandle                       visRgn;
  982.     RgnHandle                       clipRgn;
  983.     PixPatHandle                    bkPixPat;                   /*background pattern*/
  984.     RGBColor                        rgbFgColor;                 /*RGB components of fg*/
  985.     RGBColor                        rgbBkColor;                 /*RGB components of bk*/
  986.     Point                           pnLoc;
  987.     Point                           pnSize;
  988.     short                           pnMode;
  989.     PixPatHandle                    pnPixPat;                   /*pen's pattern*/
  990.     PixPatHandle                    fillPixPat;                 /*fill pattern*/
  991.     short                           pnVis;
  992.     short                           txFont;
  993.     StyleField                      txFace;                     /*StyleField occupies 16-bits, but only first 8-bits are used*/
  994.     UInt8                           txFlags;                    /* QuickTime uses second 8 bits of StyleField for txFlags */
  995.     short                           txMode;
  996.     short                           txSize;
  997.     Fixed                           spExtra;
  998.     long                            fgColor;
  999.     long                            bkColor;
  1000.     short                           colrBit;
  1001.     short                           patStretch;
  1002.     Handle                          picSave;
  1003.     Handle                          rgnSave;
  1004.     Handle                          polySave;
  1005.     CQDProcsPtr                     grafProcs;
  1006. };
  1007. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  1008. #if OPAQUE_TOOLBOX_STRUCTS
  1009. typedef WindowPtr                       CWindowPtr;
  1010. #else
  1011. typedef CGrafPtr                        CWindowPtr;
  1012. #endif  /* OPAQUE_TOOLBOX_STRUCTS */
  1013. struct ReqListRec {
  1014.     short                           reqLSize;                   /*request list size*/
  1015.     short                           reqLData[1];                /*request list data*/
  1016. };
  1017. typedef struct ReqListRec               ReqListRec;
  1018. struct OpenCPicParams {
  1019.     Rect                            srcRect;
  1020.     Fixed                           hRes;
  1021.     Fixed                           vRes;
  1022.     short                           version;
  1023.     short                           reserved1;
  1024.     long                            reserved2;
  1025. };
  1026. typedef struct OpenCPicParams           OpenCPicParams;
  1027. enum {
  1028.     kCursorImageMajorVersion    = 0x0001,
  1029.     kCursorImageMinorVersion    = 0x0000
  1030. };
  1031. struct CursorImageRec {
  1032.     UInt16                          majorVersion;
  1033.     UInt16                          minorVersion;
  1034.     PixMapHandle                    cursorPixMap;
  1035.     BitMapHandle                    cursorBitMask;
  1036. };
  1037. typedef struct CursorImageRec           CursorImageRec;
  1038. typedef CursorImageRec *                CursorImagePtr;
  1039. typedef CALLBACK_API( void , DeviceLoopDrawingProcPtr )(short depth, short deviceFlags, GDHandle targetDevice, long userData);
  1040. typedef STACK_UPP_TYPE(DeviceLoopDrawingProcPtr)                DeviceLoopDrawingUPP;
  1041. #if OPAQUE_UPP_TYPES
  1042. #if CALL_NOT_IN_CARBON
  1043.     EXTERN_API(QDPrinterStatusUPP)
  1044.     NewQDPrinterStatusUPP          (QDPrinterStatusProcPtr  userRoutine);
  1045. #endif  /* CALL_NOT_IN_CARBON */
  1046.     EXTERN_API(DeviceLoopDrawingUPP)
  1047.     NewDeviceLoopDrawingUPP        (DeviceLoopDrawingProcPtr userRoutine);
  1048. #if CALL_NOT_IN_CARBON
  1049.     EXTERN_API(void)
  1050.     DisposeQDPrinterStatusUPP      (QDPrinterStatusUPP      userUPP);
  1051. #endif  /* CALL_NOT_IN_CARBON */
  1052.     EXTERN_API(void)
  1053.     DisposeDeviceLoopDrawingUPP    (DeviceLoopDrawingUPP    userUPP);
  1054. #if CALL_NOT_IN_CARBON
  1055.     EXTERN_API(OSStatus)
  1056.     InvokeQDPrinterStatusUPP       (PrinterStatusOpcode     opcode,
  1057.                                     CGrafPtr                currentPort,
  1058.                                     void *                  printerStatus,
  1059.                                     QDPrinterStatusUPP      userUPP);
  1060. #endif  /* CALL_NOT_IN_CARBON */
  1061.     EXTERN_API(void)
  1062.     InvokeDeviceLoopDrawingUPP     (short                   depth,
  1063.                                     short                   deviceFlags,
  1064.                                     GDHandle                targetDevice,
  1065.                                     long                    userData,
  1066.                                     DeviceLoopDrawingUPP    userUPP);
  1067. #else
  1068.     enum { uppQDPrinterStatusProcInfo = 0x00000FF1 };               /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1069.     enum { uppDeviceLoopDrawingProcInfo = 0x00003E80 };             /* pascal no_return_value Func(2_bytes, 2_bytes, 4_bytes, 4_bytes) */
  1070.     #define NewQDPrinterStatusUPP(userRoutine)                      (QDPrinterStatusUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppQDPrinterStatusProcInfo, GetCurrentArchitecture())
  1071.     #define NewDeviceLoopDrawingUPP(userRoutine)                    (DeviceLoopDrawingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeviceLoopDrawingProcInfo, GetCurrentArchitecture())
  1072.     #define DisposeQDPrinterStatusUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  1073.     #define DisposeDeviceLoopDrawingUPP(userUPP)                    DisposeRoutineDescriptor(userUPP)
  1074.     #define InvokeQDPrinterStatusUPP(opcode, currentPort, printerStatus, userUPP)  (OSStatus)CALL_THREE_PARAMETER_UPP((userUPP), uppQDPrinterStatusProcInfo, (opcode), (currentPort), (printerStatus))
  1075.     #define InvokeDeviceLoopDrawingUPP(depth, deviceFlags, targetDevice, userData, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppDeviceLoopDrawingProcInfo, (depth), (deviceFlags), (targetDevice), (userData))
  1076. #endif
  1077. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1078. #define NewQDPrinterStatusProc(userRoutine)                     NewQDPrinterStatusUPP(userRoutine)
  1079. #define NewDeviceLoopDrawingProc(userRoutine)                   NewDeviceLoopDrawingUPP(userRoutine)
  1080. #define CallQDPrinterStatusProc(userRoutine, opcode, currentPort, printerStatus) InvokeQDPrinterStatusUPP(opcode, currentPort, printerStatus, userRoutine)
  1081. #define CallDeviceLoopDrawingProc(userRoutine, depth, deviceFlags, targetDevice, userData) InvokeDeviceLoopDrawingUPP(depth, deviceFlags, targetDevice, userData, userRoutine)
  1082. #if !OPAQUE_TOOLBOX_STRUCTS
  1083. /* In Carbon, use the QDGlobals accessors such as GetQDGlobalsThePort() */
  1084. struct QDGlobals {
  1085.     char                            privates[76];
  1086.     long                            randSeed;
  1087.     BitMap                          screenBits;
  1088.     Cursor                          arrow;
  1089.     Pattern                         dkGray;
  1090.     Pattern                         ltGray;
  1091.     Pattern                         gray;
  1092.     Pattern                         black;
  1093.     Pattern                         white;
  1094.     GrafPtr                         thePort;
  1095. };
  1096. typedef struct QDGlobals                QDGlobals;
  1097. typedef QDGlobals *                     QDGlobalsPtr;
  1098. typedef QDGlobalsPtr *                  QDGlobalsHdl;
  1099. extern QDGlobals qd;
  1100. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  1101. #if CALL_NOT_IN_CARBON
  1102. EXTERN_API( void )
  1103. InitGraf                        (void *                 globalPtr)                          ONEWORDINLINE(0xA86E);
  1104. EXTERN_API( void )
  1105. OpenPort                        (GrafPtr                port)                               ONEWORDINLINE(0xA86F);
  1106. EXTERN_API( void )
  1107. InitPort                        (GrafPtr                port)                               ONEWORDINLINE(0xA86D);
  1108. EXTERN_API( void )
  1109. ClosePort                       (GrafPtr                port)                               ONEWORDINLINE(0xA87D);
  1110. /*
  1111.    These are Carbon only routines. They do nothing at all on
  1112.    Mac OS 8, but work flawlessly on Mac OS X.
  1113. */
  1114. #endif  /* CALL_NOT_IN_CARBON */
  1115. EXTERN_API( OSErr )
  1116. LockPortBits                    (GrafPtr                port);
  1117. EXTERN_API( OSErr )
  1118. UnlockPortBits                  (GrafPtr                port);
  1119. /* Break a region up into rectangles.*/
  1120. enum {
  1121.     kQDParseRegionFromTop       = (1 << 0),
  1122.     kQDParseRegionFromBottom    = (1 << 1),
  1123.     kQDParseRegionFromLeft      = (1 << 2),
  1124.     kQDParseRegionFromRight     = (1 << 3),
  1125.     kQDParseRegionFromTopLeft   = kQDParseRegionFromTop | kQDParseRegionFromLeft,
  1126.     kQDParseRegionFromBottomRight = kQDParseRegionFromBottom | kQDParseRegionFromRight
  1127. };
  1128. typedef SInt32                          QDRegionParseDirection;
  1129. enum {
  1130.     kQDRegionToRectsMsgInit     = 1,
  1131.     kQDRegionToRectsMsgParse    = 2,
  1132.     kQDRegionToRectsMsgTerminate = 3
  1133. };
  1134. typedef CALLBACK_API_C( OSStatus , RegionToRectsProcPtr )(UInt16 message, RgnHandle rgn, const Rect *rect, void *refCon);
  1135. typedef STACK_UPP_TYPE(RegionToRectsProcPtr)                    RegionToRectsUPP;
  1136. #if OPAQUE_UPP_TYPES
  1137.     EXTERN_API(RegionToRectsUPP)
  1138.     NewRegionToRectsUPP            (RegionToRectsProcPtr    userRoutine);
  1139.     EXTERN_API(void)
  1140.     DisposeRegionToRectsUPP        (RegionToRectsUPP        userUPP);
  1141.     EXTERN_API(OSStatus)
  1142.     InvokeRegionToRectsUPP         (UInt16                  message,
  1143.                                     RgnHandle               rgn,
  1144.                                     const Rect *            rect,
  1145.                                     void *                  refCon,
  1146.                                     RegionToRectsUPP        userUPP);
  1147. #else
  1148.     enum { uppRegionToRectsProcInfo = 0x00003FB1 };                 /* 4_bytes Func(2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  1149.     #define NewRegionToRectsUPP(userRoutine)                        (RegionToRectsUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppRegionToRectsProcInfo, GetCurrentArchitecture())
  1150.     #define DisposeRegionToRectsUPP(userUPP)                        DisposeRoutineDescriptor(userUPP)
  1151.     #define InvokeRegionToRectsUPP(message, rgn, rect, refCon, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppRegionToRectsProcInfo, (message), (rgn), (rect), (refCon))
  1152. #endif
  1153. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1154. #define NewRegionToRectsProc(userRoutine)                       NewRegionToRectsUPP(userRoutine)
  1155. #define CallRegionToRectsProc(userRoutine, message, rgn, rect, refCon) InvokeRegionToRectsUPP(message, rgn, rect, refCon, userRoutine)
  1156. EXTERN_API_C( OSStatus )
  1157. QDRegionToRects                 (RgnHandle              rgn,
  1158.                                  QDRegionParseDirection  dir,
  1159.                                  RegionToRectsUPP       proc,
  1160.                                  void *                 userData);
  1161. #if !TARGET_OS_MAC || TARGET_API_MAC_OSX
  1162. #if CALL_NOT_IN_CARBON
  1163. EXTERN_API( OSErr )
  1164. UpdatePort                      (GrafPtr                port);
  1165. EXTERN_API( void *)
  1166. GetPortNativeWindow             (GrafPtr                macPort);
  1167. EXTERN_API( GrafPtr )
  1168. GetNativeWindowPort             (void *                 nativeWindow);
  1169. EXTERN_API( void *)
  1170. MacRegionToNativeRegion         (RgnHandle              macRegion);
  1171. EXTERN_API( RgnHandle )
  1172. NativeRegionToMacRegion         (void *                 nativeRegion);
  1173. #endif  /* CALL_NOT_IN_CARBON */
  1174. #endif  /* !TARGET_OS_MAC || TARGET_API_MAC_OSX */
  1175. #if TARGET_OS_WIN32
  1176. #if CALL_NOT_IN_CARBON
  1177. EXTERN_API( void *)
  1178. GetPortHWND                     (GrafPtr                port);