home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / CMApplication.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  10.4 KB  |  397 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        CMApplication.p
  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. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT CMApplication;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __CMAPPLICATION__}
  27. {$SETC __CMAPPLICATION__ := 1}
  28.  
  29. {$I+}
  30. {$SETC CMApplicationIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __QUICKDRAW__}
  40. {$I Quickdraw.p}
  41. {$ENDC}
  42. {    MixedMode.p                                                    }
  43. {    QuickdrawText.p                                                }
  44.  
  45. {$IFC UNDEFINED __WINDOWS__}
  46. {$I Windows.p}
  47. {$ENDC}
  48. {    Memory.p                                                    }
  49. {    Events.p                                                    }
  50. {        OSUtils.p                                                }
  51. {    Controls.p                                                    }
  52. {        Menus.p                                                    }
  53.  
  54. {$IFC UNDEFINED __PRINTING__}
  55. {$I Printing.p}
  56. {$ENDC}
  57. {    Errors.p                                                    }
  58. {    Dialogs.p                                                    }
  59. {        TextEdit.p                                                }
  60.  
  61. {$PUSH}
  62. {$ALIGN MAC68K}
  63. {$LibExport+}
  64.  
  65. CONST
  66.     CMTrap                        = $ABEE;
  67.  
  68. { PicComments }
  69.     CMBeginProfile                = 220;
  70.     CMEndProfile                = 221;
  71.     CMEnableMatching            = 222;
  72.     CMDisableMatching            = 223;
  73.  
  74. { Defines for fieldMask in profile search record }
  75.     kMatchCMMType                = $00000001;
  76.     kMatchApplProfileVersion    = $00000002;
  77.     kMatchDataType                = $00000004;
  78.     kMatchDeviceType            = $00000008;
  79.     kMatchDeviceManufacturer    = $00000010;
  80.     kMatchDeviceModel            = $00000020;
  81.     kMatchDeviceAttributes        = $00000040;
  82.     kMatchFlags                    = $00000080;
  83.     kMatchOptions                = $00000100;
  84.     kMatchWhite                    = $00000200;
  85.     kMatchBlack                    = $00000400;
  86.  
  87. { Profile Header version }
  88.     kCMApplProfileVersion        = $0100;
  89.  
  90. { Data types }
  91.     rgbData                        = 'RGB ';
  92.     cmykData                    = 'CMYK';
  93.     grayData                    = 'GRAY';
  94.     xyzData                        = 'XYZ ';
  95.  
  96. { Device types }
  97.     monitorDevice                = 'mntr';
  98.     scannerDevice                = 'scnr';
  99.     printerDevice                = 'prtr';
  100.     qdSystemDevice                = 'sys ';
  101.     qdGDevice                    = 'gdev';
  102.  
  103. { Profile flags }
  104.     CMNativeMatchingPreferred    = $00000001;                    { Default to native not preferred }
  105.     CMTurnOffCache                = $00000002;                    { Default to turn on CMM cache }
  106.  
  107.     
  108. TYPE
  109.     CMMatchFlag = LONGINT;
  110.  
  111. { Profile options }
  112.  
  113. CONST
  114.     CMPerceptualMatch            = $0000;                        { Default. For photographic images }
  115.     CMColorimetricMatch            = $0001;                        { Exact matching when possible }
  116.     CMSaturationMatch            = $0002;                        { For solid colors }
  117.  
  118.     
  119. TYPE
  120.     CMMatchOption = LONGINT;
  121.  
  122.     CMMatchRef = LONGINT;
  123.  
  124.     CWorld = LONGINT;
  125.  
  126. { ColorSync result codes }
  127.  
  128. CONST
  129.     CMNoError                    = 0;
  130.     CMProfileError                = -170;
  131.     CMMethodError                = -171;
  132.     CMMemFullError                = -172;
  133.     CMUnimplementedError        = -173;
  134.     CMParamError                = -174;
  135.     CMMethodNotFound            = -175;                            { CMM not present }
  136.     CMProfileNotFound            = -176;                            { Responder error }
  137.     CMProfilesIdentical            = -177;                            { Profiles the same }
  138.     CMCantConcatenateError        = -178;                            { Profile can't be concatenated }
  139.     CMCantXYZ                    = -179;                            { CMM cant handle XYZ space }
  140.     CMCantDeleteProfile            = -180;                            { Responder error }
  141.     CMUnsupportedDataType        = -181;                            { Responder error }
  142.     CMNoCurrentProfile            = -182;                            { Responder error }
  143.  
  144.     
  145. TYPE
  146.     CMError = LONGINT;
  147.  
  148. {
  149. ** Types
  150. }
  151.     XYZColor = RECORD
  152.         X:                        INTEGER;                                { 1.15 bit unsigned fixed numbers }
  153.         Y:                        INTEGER;
  154.         Z:                        INTEGER;
  155.     END;
  156.     CMYKColor = RECORD
  157.         cyan:                    INTEGER;
  158.         magenta:                INTEGER;
  159.         yellow:                    INTEGER;
  160.         black:                    INTEGER;
  161.     END;
  162.     CMColor = RECORD
  163.         CASE INTEGER OF
  164.         0: (
  165.             rgb:                        RGBColor;
  166.            );
  167.         1: (
  168.             xyz:                        XYZColor;
  169.            );
  170.         2: (
  171.             cmyk:                        CMYKColor;
  172.            );
  173.     END;
  174.     CMColorList = ^CMColor;
  175.  
  176.     CMGamutResult = ^LONGINT;
  177.  
  178.     CMHeader = RECORD
  179.         size:                    LONGINT;                                { This is the total size of the Profile including custom data }
  180.         CMMType:                OSType;                                    { Corresponding CMM }
  181.         applProfileVersion:        LONGINT;                                { Version of CMProfile format }
  182.         dataType:                OSType;                                    { rgbData, etc. }
  183.         deviceType:                OSType;                                    { monitorDevice, etc. }
  184.         deviceManufacturer:        OSType;                                    { Registered with DTS }
  185.         deviceModel:            LONGINT;                                { Specific to Manufacturer }
  186.         deviceAttributes:        ARRAY [0..1] OF LONGINT;                { Attributes like paper, ink, etc. }
  187.         profileNameOffset:        LONGINT;                                { Offset to profile name from top of data }
  188.         customDataOffset:        LONGINT;                                { Offset to custom data from top of data }
  189.         flags:                    CMMatchFlag;
  190.         options:                CMMatchOption;
  191.         white:                    XYZColor;
  192.         black:                    XYZColor;
  193.     END;
  194.     CMProfileSearchRecord = RECORD
  195.         header:                    CMHeader;
  196.         fieldMask:                LONGINT;
  197.         reserved:                ARRAY [0..1] OF LONGINT;
  198.     END;
  199.     CMProfileSearchRecordPtr = ^CMProfileSearchRecord;
  200.     CMProfileSearchRecordHandle = ^CMProfileSearchRecordPtr;
  201.  
  202.     CMProfileChromaticities = RECORD
  203.         red:                    XYZColor;
  204.         green:                    XYZColor;
  205.         blue:                    XYZColor;
  206.         cyan:                    XYZColor;
  207.         magenta:                XYZColor;
  208.         yellow:                    XYZColor;
  209.     END;
  210.     CMResponseData = INTEGER;
  211.  
  212.     IString = RECORD
  213.         theScript:                ScriptCode;
  214.         theString:                Str63;
  215.     END;
  216.     IStringPtr = ^IString;
  217.     IStringHandle = ^IStringPtr;
  218.  
  219.  
  220. CONST
  221.     grayResponse                = 0;
  222.     redResponse                    = 1;
  223.     greenResponse                = 2;
  224.     blueResponse                = 3;
  225.     cyanResponse                = 4;
  226.     magentaResponse                = 5;
  227.     yellowResponse                = 6;
  228.     ucrResponse                    = 7;
  229.     bgResponse                    = 8;
  230.     onePlusLastResponse            = 9;
  231.  
  232.     
  233. TYPE
  234.     responseColor = LONGINT;
  235.  
  236.     CMProfileResponse = RECORD
  237.         counts:                    ARRAY [0..onePlusLastResponse-1] OF INTEGER;
  238.         data:                    ARRAY [0..0] OF CMResponseData;            { Variable size }
  239.     END;
  240.     CMProfile = RECORD
  241.         header:                    CMHeader;
  242.         profile:                CMProfileChromaticities;
  243.         response:                CMProfileResponse;                        { Variable size }
  244.         profileName:            IString;                                { Variable size }
  245.         customData:                ARRAY [0..0] OF SInt8;                    { Optional variable length custom CMM data }
  246.     END;
  247.     CMProfilePtr = ^CMProfile;
  248.     CMProfileHandle = ^CMProfilePtr;
  249.  
  250.     PixMapCallBackProcPtr = ProcPtr;  { FUNCTION PixMapCallBack(progress: LONGINT; refCon: LONGINT): BOOLEAN; }
  251.     PixMapCallBackUPP = UniversalProcPtr;
  252.  
  253. CONST
  254.     uppPixMapCallBackProcInfo = $000003D0; { FUNCTION (4 byte param, 4 byte param): 1 byte result; }
  255.  
  256. FUNCTION NewPixMapCallBackProc(userRoutine: PixMapCallBackProcPtr): PixMapCallBackUPP;
  257.     {$IFC NOT GENERATINGCFM }
  258.     INLINE $2E9F;
  259.     {$ENDC}
  260.  
  261. FUNCTION CallPixMapCallBackProc(progress: LONGINT; refCon: LONGINT; userRoutine: PixMapCallBackUPP): BOOLEAN;
  262.     {$IFC NOT GENERATINGCFM}
  263.     INLINE $205F, $4E90;
  264.     {$ENDC}
  265. {
  266. ** Printing Stuff that will be moved later
  267. }
  268.  
  269. CONST
  270.     enableColorMatchingOp        = 12;
  271.     registerProfileOp            = 13;
  272.  
  273. { PrGeneral parameter blocks }
  274.  
  275. TYPE
  276.     TEnableColorMatchingBlk = RECORD
  277.         iOpCode:                INTEGER;
  278.         iError:                    INTEGER;
  279.         lReserved:                LONGINT;
  280.         hPrint:                    THPrint;
  281.         fEnableIt:                BOOLEAN;
  282.     END;
  283.     TRegisterProfileBlk = RECORD
  284.         iOpCode:                INTEGER;
  285.         iError:                    INTEGER;
  286.         lReserved:                LONGINT;
  287.         hPrint:                    THPrint;
  288.         fRegisterIt:            BOOLEAN;
  289.     END;
  290. {
  291. ** High Level Calls
  292. }
  293.  
  294. FUNCTION BeginMatching(src: CMProfileHandle; dst: CMProfileHandle; VAR myRef: CMMatchRef): CMError;
  295.     {$IFC NOT GENERATINGCFM}
  296.     INLINE $203c, $000C, 10, $ABEE;
  297.     {$ENDC}
  298. PROCEDURE EndMatching(myRef: CMMatchRef);
  299.     {$IFC NOT GENERATINGCFM}
  300.     INLINE $203c, $0004, 11, $ABEE;
  301.     {$ENDC}
  302. FUNCTION GetProfile(deviceType: LONGINT; refNum: LONGINT; aProfile: CMProfileHandle; VAR returnedProfile: CMProfileHandle): CMError;
  303.     {$IFC NOT GENERATINGCFM}
  304.     INLINE $203c, $0010, 5, $ABEE;
  305.     {$ENDC}
  306. FUNCTION SetProfile(deviceType: LONGINT; refNum: LONGINT; newProfile: CMProfileHandle): CMError;
  307.     {$IFC NOT GENERATINGCFM}
  308.     INLINE $203c, $000c, 6, $ABEE;
  309.     {$ENDC}
  310. FUNCTION SetProfileDescription(deviceType: LONGINT; refNum: LONGINT; deviceData: LONGINT; hProfile: CMProfileHandle): CMError;
  311.     {$IFC NOT GENERATINGCFM}
  312.     INLINE $203c, $0010, 16, $ABEE;
  313.     {$ENDC}
  314. FUNCTION GetColorSyncFolderSpec(vRefNum: INTEGER; createFolder: BOOLEAN; VAR foundVRefNum: INTEGER; VAR foundDirID: LONGINT): CMError;
  315.     {$IFC NOT GENERATINGCFM}
  316.     INLINE $203c, $000c, 17, $ABEE;
  317.     {$ENDC}
  318. FUNCTION GetIndexedProfile(deviceType: LONGINT; refNum: LONGINT; search: CMProfileSearchRecordHandle; VAR returnProfile: CMProfileHandle; VAR index: LONGINT): CMError;
  319.     {$IFC NOT GENERATINGCFM}
  320.     INLINE $203c, $0014, 18, $ABEE;
  321.     {$ENDC}
  322. FUNCTION DeleteDeviceProfile(deviceType: LONGINT; refNum: LONGINT; deleteMe: CMProfileHandle): CMError;
  323.     {$IFC NOT GENERATINGCFM}
  324.     INLINE $203c, $000C, 19, $ABEE;
  325.     {$ENDC}
  326. {
  327. ** Data interchange routines
  328. }
  329. FUNCTION UseProfile(profile: CMProfileHandle): CMError;
  330.     {$IFC NOT GENERATINGCFM}
  331.     INLINE $203c, $0004, 8, $ABEE;
  332.     {$ENDC}
  333. PROCEDURE DrawMatchedPicture(myPicture: PicHandle; dst: CMProfileHandle; VAR myRect: Rect);
  334.     {$IFC NOT GENERATINGCFM}
  335.     INLINE $203c, $000C, 9, $ABEE;
  336.     {$ENDC}
  337. PROCEDURE EnableMatching(enableIt: BOOLEAN);
  338.     {$IFC NOT GENERATINGCFM}
  339.     INLINE $203c, $0002, 13, $ABEE;
  340.     {$ENDC}
  341. {
  342. ** Profile concatenation
  343. }
  344. FUNCTION ConcatenateProfiles(thru: CMProfileHandle; dst: CMProfileHandle; VAR newDst: CMProfileHandle): CMError;
  345.     {$IFC NOT GENERATINGCFM}
  346.     INLINE $203c, $000C, 12, $ABEE;
  347.     {$ENDC}
  348. {
  349. ** Profile manipulation routines
  350. }
  351. PROCEDURE GetProfileName(myProfile: CMProfileHandle; VAR IStringResult: IString);
  352.     {$IFC NOT GENERATINGCFM}
  353.     INLINE $203c, $0008, 14, $ABEE;
  354.     {$ENDC}
  355. FUNCTION GetProfileAdditionalDataOffset(myProfile: CMProfileHandle): LONGINT;
  356.     {$IFC NOT GENERATINGCFM}
  357.     INLINE $203c, $0004, 15, $ABEE;
  358.     {$ENDC}
  359. {
  360. ** Low level color calculation routines
  361. }
  362. FUNCTION CWNewColorWorld(VAR myCWorld: CWorld; src: CMProfileHandle; dst: CMProfileHandle): CMError;
  363.     {$IFC NOT GENERATINGCFM}
  364.     INLINE $203c, $000C, 0, $ABEE;
  365.     {$ENDC}
  366. PROCEDURE CWDisposeColorWorld(myCWorld: CWorld);
  367.     {$IFC NOT GENERATINGCFM}
  368.     INLINE $203c, $0004, 1, $ABEE;
  369.     {$ENDC}
  370. FUNCTION CWMatchColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT): CMError;
  371.     {$IFC NOT GENERATINGCFM}
  372.     INLINE $203c, $000c, 2, $ABEE;
  373.     {$ENDC}
  374. FUNCTION CWCheckColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT; result: CMGamutResult): CMError;
  375.     {$IFC NOT GENERATINGCFM}
  376.     INLINE $203c, $0010, 3, $ABEE;
  377.     {$ENDC}
  378. FUNCTION CWMatchPixMap(myCWorld: CWorld; VAR myPixMap: PixMap; progressProc: PixMapCallBackUPP; refCon: LONGINT): CMError;
  379.     {$IFC NOT GENERATINGCFM}
  380.     INLINE $203c, $0010, 4, $ABEE;
  381.     {$ENDC}
  382. FUNCTION CWCheckPixMap(myCWorld: CWorld; VAR myPixMap: PixMap; progressProc: PixMapCallBackUPP; refCon: LONGINT; VAR resultBitMap: BitMap): CMError;
  383.     {$IFC NOT GENERATINGCFM}
  384.     INLINE $203c, $0014, 7, $ABEE;
  385.     {$ENDC}
  386.  
  387. {$ALIGN RESET}
  388. {$POP}
  389.  
  390. {$SETC UsingIncludes := CMApplicationIncludes}
  391.  
  392. {$ENDC} {__CMAPPLICATION__}
  393.  
  394. {$IFC NOT UsingIncludes}
  395.  END.
  396. {$ENDC}
  397.