home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / CMApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  10.7 KB  |  384 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __CMAPPLICATION__
  18. #define __CMAPPLICATION__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <QuickdrawText.h>                                    */
  31.  
  32. #ifndef __WINDOWS__
  33. #include <Windows.h>
  34. #endif
  35. /*    #include <Memory.h>                                            */
  36. /*    #include <Events.h>                                            */
  37. /*        #include <OSUtils.h>                                    */
  38. /*    #include <Controls.h>                                        */
  39. /*        #include <Menus.h>                                        */
  40.  
  41. #ifndef __PRINTING__
  42. #include <Printing.h>
  43. #endif
  44. /*    #include <Errors.h>                                            */
  45. /*    #include <Dialogs.h>                                        */
  46. /*        #include <TextEdit.h>                                    */
  47.  
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. #if GENERATINGPOWERPC
  53. #pragma options align=mac68k
  54. #endif
  55.  
  56. #ifdef __CFM68K__
  57. #pragma lib_export on
  58. #endif
  59.  
  60.  
  61. enum {
  62.     CMTrap                        = 0xABEE
  63. };
  64.  
  65. /* PicComments */
  66. enum {
  67.     CMBeginProfile                = 220,
  68.     CMEndProfile                = 221,
  69.     CMEnableMatching            = 222,
  70.     CMDisableMatching            = 223
  71. };
  72.  
  73. /* Defines for fieldMask in profile search record */
  74. enum {
  75.     kMatchCMMType                = 0x00000001,
  76.     kMatchApplProfileVersion    = 0x00000002,
  77.     kMatchDataType                = 0x00000004,
  78.     kMatchDeviceType            = 0x00000008,
  79.     kMatchDeviceManufacturer    = 0x00000010,
  80.     kMatchDeviceModel            = 0x00000020,
  81.     kMatchDeviceAttributes        = 0x00000040,
  82.     kMatchFlags                    = 0x00000080,
  83.     kMatchOptions                = 0x00000100,
  84.     kMatchWhite                    = 0x00000200,
  85.     kMatchBlack                    = 0x00000400
  86. };
  87.  
  88. /* Profile Header version */
  89. enum {
  90.     kCMApplProfileVersion        = 0x0100
  91. };
  92.  
  93. /* Data types */
  94. enum {
  95.     rgbData                        = 'RGB ',
  96.     cmykData                    = 'CMYK',
  97.     grayData                    = 'GRAY',
  98.     xyzData                        = 'XYZ '
  99. };
  100.  
  101. /* Device types */
  102. enum {
  103.     monitorDevice                = 'mntr',
  104.     scannerDevice                = 'scnr',
  105.     printerDevice                = 'prtr',
  106.     qdSystemDevice                = 'sys ',
  107.     qdGDevice                    = 'gdev'
  108. };
  109.  
  110. /* Profile flags */
  111. enum {
  112.     CMNativeMatchingPreferred    = 0x00000001,                    /* Default to native not preferred */
  113.     CMTurnOffCache                = 0x00000002                    /* Default to turn on CMM cache */
  114. };
  115.  
  116. typedef long CMMatchFlag;
  117.  
  118. /* Profile options */
  119.  
  120. enum {
  121.     CMPerceptualMatch            = 0x0000,                        /* Default. For photographic images */
  122.     CMColorimetricMatch            = 0x0001,                        /* Exact matching when possible */
  123.     CMSaturationMatch            = 0x0002                        /* For solid colors */
  124. };
  125.  
  126. typedef long CMMatchOption;
  127.  
  128. typedef long CMMatchRef;
  129.  
  130. typedef long CWorld;
  131.  
  132. /* ColorSync result codes */
  133.  
  134. enum {
  135.     CMNoError                    = 0,
  136.     CMProfileError                = -170,
  137.     CMMethodError                = -171,
  138.     CMMemFullError                = -172,
  139.     CMUnimplementedError        = -173,
  140.     CMParamError                = -174,
  141.     CMMethodNotFound            = -175,                            /* CMM not present */
  142.     CMProfileNotFound            = -176,                            /* Responder error */
  143.     CMProfilesIdentical            = -177,                            /* Profiles the same */
  144.     CMCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  145.     CMCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  146.     CMCantDeleteProfile            = -180,                            /* Responder error */
  147.     CMUnsupportedDataType        = -181,                            /* Responder error */
  148.     CMNoCurrentProfile            = -182                            /* Responder error */
  149. };
  150.  
  151. typedef long CMError;
  152.  
  153. /*
  154. ** Types
  155. */
  156. struct XYZColor {
  157.     unsigned short                    X;                            /* 1.15 bit unsigned fixed numbers */
  158.     unsigned short                    Y;
  159.     unsigned short                    Z;
  160. };
  161. typedef struct XYZColor XYZColor;
  162.  
  163. struct CMYKColor {
  164.     unsigned short                    cyan;
  165.     unsigned short                    magenta;
  166.     unsigned short                    yellow;
  167.     unsigned short                    black;
  168. };
  169. typedef struct CMYKColor CMYKColor;
  170.  
  171. union CMColor {
  172.     RGBColor                        rgb;
  173.     XYZColor                        xyz;
  174.     CMYKColor                        cmyk;
  175. };
  176. typedef union CMColor CMColor, *CMColorList;
  177.  
  178. typedef long *CMGamutResult;
  179.  
  180. struct CMHeader {
  181.     unsigned long                    size;                        /* This is the total size of the Profile including custom data */
  182.     OSType                            CMMType;                    /* Corresponding CMM */
  183.     unsigned long                    applProfileVersion;            /* Version of CMProfile format */
  184.     OSType                            dataType;                    /* rgbData, etc. */
  185.     OSType                            deviceType;                    /* monitorDevice, etc. */
  186.     OSType                            deviceManufacturer;            /* Registered with DTS */
  187.     unsigned long                    deviceModel;                /* Specific to Manufacturer */
  188.     unsigned long                    deviceAttributes[2];        /* Attributes like paper, ink, etc. */
  189.     unsigned long                    profileNameOffset;            /* Offset to profile name from top of data */
  190.     unsigned long                    customDataOffset;            /* Offset to custom data from top of data */
  191.     CMMatchFlag                        flags;
  192.     CMMatchOption                    options;
  193.     XYZColor                        white;
  194.     XYZColor                        black;
  195. };
  196. typedef struct CMHeader CMHeader;
  197.  
  198. struct CMProfileSearchRecord {
  199.     CMHeader                        header;
  200.     unsigned long                    fieldMask;
  201.     unsigned long                    reserved[2];
  202. };
  203. typedef struct CMProfileSearchRecord CMProfileSearchRecord, **CMProfileSearchRecordHandle;
  204.  
  205. struct CMProfileChromaticities {
  206.     XYZColor                        red;
  207.     XYZColor                        green;
  208.     XYZColor                        blue;
  209.     XYZColor                        cyan;
  210.     XYZColor                        magenta;
  211.     XYZColor                        yellow;
  212. };
  213. typedef struct CMProfileChromaticities CMProfileChromaticities;
  214.  
  215. typedef unsigned short CMResponseData;
  216.  
  217. struct IString {
  218.     ScriptCode                        theScript;
  219.     Str63                            theString;
  220. };
  221. typedef struct IString IString, *IStringPtr, **IStringHandle;
  222.  
  223.  
  224. enum {
  225.     grayResponse                = 0,
  226.     redResponse                    = 1,
  227.     greenResponse                = 2,
  228.     blueResponse                = 3,
  229.     cyanResponse                = 4,
  230.     magentaResponse                = 5,
  231.     yellowResponse                = 6,
  232.     ucrResponse                    = 7,
  233.     bgResponse                    = 8,
  234.     onePlusLastResponse            = 9
  235. };
  236.  
  237. typedef long responseColor;
  238.  
  239. struct CMProfileResponse {
  240.     unsigned short                    counts[onePlusLastResponse];
  241.     CMResponseData                    data[1];                    /* Variable size */
  242. };
  243. typedef struct CMProfileResponse CMProfileResponse;
  244.  
  245. struct CMProfile {
  246.     CMHeader                        header;
  247.     CMProfileChromaticities            profile;
  248.     CMProfileResponse                response;                    /* Variable size */
  249.     IString                            profileName;                /* Variable size */
  250.     SInt8                            customData[1];                /* Optional variable length custom CMM data */
  251. };
  252. typedef struct CMProfile CMProfile, *CMProfilePtr, **CMProfileHandle;
  253.  
  254. typedef pascal Boolean (*PixMapCallBackProcPtr)(long progress, long refCon);
  255.  
  256. #if GENERATINGCFM
  257. typedef UniversalProcPtr PixMapCallBackUPP;
  258. #else
  259. typedef PixMapCallBackProcPtr PixMapCallBackUPP;
  260. #endif
  261.  
  262. enum {
  263.     uppPixMapCallBackProcInfo = kPascalStackBased
  264.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  265.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  266.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  267. };
  268.  
  269. #if GENERATINGCFM
  270. #define NewPixMapCallBackProc(userRoutine)        \
  271.         (PixMapCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPixMapCallBackProcInfo, GetCurrentArchitecture())
  272. #else
  273. #define NewPixMapCallBackProc(userRoutine)        \
  274.         ((PixMapCallBackUPP) (userRoutine))
  275. #endif
  276.  
  277. #if GENERATINGCFM
  278. #define CallPixMapCallBackProc(userRoutine, progress, refCon)        \
  279.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPixMapCallBackProcInfo, (progress), (refCon))
  280. #else
  281. #define CallPixMapCallBackProc(userRoutine, progress, refCon)        \
  282.         (*(userRoutine))((progress), (refCon))
  283. #endif
  284.  
  285. /*
  286. ** Printing Stuff that will be moved later
  287. */
  288.  
  289. enum {
  290.     enableColorMatchingOp        = 12,
  291.     registerProfileOp            = 13
  292. };
  293.  
  294. /* PrGeneral parameter blocks */
  295. struct TEnableColorMatchingBlk {
  296.     short                            iOpCode;
  297.     short                            iError;
  298.     long                            lReserved;
  299.     THPrint                            hPrint;
  300.     Boolean                            fEnableIt;
  301.     SInt8                            filler;
  302. };
  303. typedef struct TEnableColorMatchingBlk TEnableColorMatchingBlk;
  304.  
  305. struct TRegisterProfileBlk {
  306.     short                            iOpCode;
  307.     short                            iError;
  308.     long                            lReserved;
  309.     THPrint                            hPrint;
  310.     Boolean                            fRegisterIt;
  311.     SInt8                            filler;
  312. };
  313. typedef struct TRegisterProfileBlk TRegisterProfileBlk;
  314.  
  315. /*
  316. ** High Level Calls
  317. */
  318. extern pascal CMError BeginMatching(CMProfileHandle src, CMProfileHandle dst, CMMatchRef *myRef)
  319.  FOURWORDINLINE(0x203c, 0x000C, 10, 0xABEE);
  320. extern pascal void EndMatching(CMMatchRef myRef)
  321.  FOURWORDINLINE(0x203c, 0x0004, 11, 0xABEE);
  322. extern pascal CMError GetProfile(long deviceType, long refNum, CMProfileHandle aProfile, CMProfileHandle *returnedProfile)
  323.  FOURWORDINLINE(0x203c, 0x0010, 5, 0xABEE);
  324. extern pascal CMError SetProfile(long deviceType, long refNum, CMProfileHandle newProfile)
  325.  FOURWORDINLINE(0x203c, 0x000c, 6, 0xABEE);
  326. extern pascal CMError SetProfileDescription(long deviceType, long refNum, long deviceData, CMProfileHandle hProfile)
  327.  FOURWORDINLINE(0x203c, 0x0010, 16, 0xABEE);
  328. extern pascal CMError GetColorSyncFolderSpec(short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID)
  329.  FOURWORDINLINE(0x203c, 0x000c, 17, 0xABEE);
  330. extern pascal CMError GetIndexedProfile(long deviceType, long refNum, CMProfileSearchRecordHandle search, CMProfileHandle *returnProfile, long *index)
  331.  FOURWORDINLINE(0x203c, 0x0014, 18, 0xABEE);
  332. extern pascal CMError DeleteDeviceProfile(long deviceType, long refNum, CMProfileHandle deleteMe)
  333.  FOURWORDINLINE(0x203c, 0x000C, 19, 0xABEE);
  334. /*
  335. ** Data interchange routines
  336. */
  337. extern pascal CMError UseProfile(CMProfileHandle profile)
  338.  FOURWORDINLINE(0x203c, 0x0004, 8, 0xABEE);
  339. extern pascal void DrawMatchedPicture(PicHandle myPicture, CMProfileHandle dst, Rect *myRect)
  340.  FOURWORDINLINE(0x203c, 0x000C, 9, 0xABEE);
  341. extern pascal void EnableMatching(Boolean enableIt)
  342.  FOURWORDINLINE(0x203c, 0x0002, 13, 0xABEE);
  343. /*
  344. ** Profile concatenation
  345. */
  346. extern pascal CMError ConcatenateProfiles(CMProfileHandle thru, CMProfileHandle dst, CMProfileHandle *newDst)
  347.  FOURWORDINLINE(0x203c, 0x000C, 12, 0xABEE);
  348. /*
  349. ** Profile manipulation routines
  350. */
  351. extern pascal void GetProfileName(CMProfileHandle myProfile, IString *IStringResult)
  352.  FOURWORDINLINE(0x203c, 0x0008, 14, 0xABEE);
  353. extern pascal long GetProfileAdditionalDataOffset(CMProfileHandle myProfile)
  354.  FOURWORDINLINE(0x203c, 0x0004, 15, 0xABEE);
  355. /*
  356. ** Low level color calculation routines
  357. */
  358. extern pascal CMError CWNewColorWorld(CWorld *myCWorld, CMProfileHandle src, CMProfileHandle dst)
  359.  FOURWORDINLINE(0x203c, 0x000C, 0, 0xABEE);
  360. extern pascal void CWDisposeColorWorld(CWorld myCWorld)
  361.  FOURWORDINLINE(0x203c, 0x0004, 1, 0xABEE);
  362. extern pascal CMError CWMatchColors(CWorld myCWorld, CMColorList myColors, long count)
  363.  FOURWORDINLINE(0x203c, 0x000c, 2, 0xABEE);
  364. extern pascal CMError CWCheckColors(CWorld myCWorld, CMColorList myColors, long count, CMGamutResult result)
  365.  FOURWORDINLINE(0x203c, 0x0010, 3, 0xABEE);
  366. extern pascal CMError CWMatchPixMap(CWorld myCWorld, PixMap *myPixMap, PixMapCallBackUPP progressProc, long refCon)
  367.  FOURWORDINLINE(0x203c, 0x0010, 4, 0xABEE);
  368. extern pascal CMError CWCheckPixMap(CWorld myCWorld, PixMap *myPixMap, PixMapCallBackUPP progressProc, long refCon, BitMap *resultBitMap)
  369.  FOURWORDINLINE(0x203c, 0x0014, 7, 0xABEE);
  370.  
  371. #ifdef __CFM68K__
  372. #pragma lib_export off
  373. #endif
  374.  
  375. #if GENERATINGPOWERPC
  376. #pragma options align=reset
  377. #endif
  378.  
  379. #ifdef __cplusplus
  380. }
  381. #endif
  382.  
  383. #endif /* __CMAPPLICATION__ */
  384.