Important: The information in this document is obsolete and should not be used for new development.
Summary of the ColorSync Manager
Constants
/* constants for profile location type */ enum { cmNoProfileBase = 0, cmFileBasedProfile= 1, cmHandleBasedProfile= 2, cmPtrBasedProfile = 3, cmProcedureBasedProfile= 4 }; /* profile classes */ enum { cmInputClass = 'scnr', cmDisplayClass = 'mntr', cmOutputClass = 'prtr', cmLinkClass = 'link', cmAbstractClass= 'abst', cmColorSpaceClass= 'spac', cmNamedColorClass= 'nmcl' }; /* signature of the Apple-supplied color management module (CMM) */ enum { kDefaultCMMSignature= 'appl' }; /* commands for calling the application-supplied MyColorSyncDataTransfer */ enum { openReadSpool = 1, openWriteSpool, readSpool, writeSpool, closeSpool }; /* picture comment IDs for profiles and color matching */ enum { cmBeginProfile = 220, cmEndProfile = 221, cmEnableMatching= 222, cmDisableMatching= 223, cmComment = 224 }; /* picture comment selectors for the cmComment ID */ enum { cmBeginProfileSel = 0, cmContinueProfileSel= 1, cmEndProfileSel = 2, cmProfileIdentifierSel= 3 }; /* commands for profile access procedure */ enum { cmOpenReadAccess= 1, cmOpenWriteAccess= 2, cmReadAccess = 3, cmWriteAccess = 4, cmCloseAccess = 5, cmCreateNewAccess= 6, cmAbortWriteAccess= 7, cmBeginAccess = 8, cmEndAccess = 9 }; /* color space signatures */ enum { cmXYZData= 'XYZ ', cmLabData= 'Lab ', cmLuvData= 'Luv ', cmYxyData= 'Yxy ', cmRGBData= 'RGB ', cmGrayData= 'GRAY', cmHSVData= 'HSV ', cmHLSData= 'HLS ', cmCMYKData= 'CMYK', cmCMYData= 'CMY ', cmMCH5Data= 'MCH5', cmMCH6Data= 'MCH6', cmMCH7Data= 'MCH7', cmMCH8Data= 'MCH8' }; /* color packing for color spaces */ enum { cmNoColorPacking = 0x0000, cmAlphaSpace = 0x0080, cmWord5ColorPacking= 0x0500, cmLong8ColorPacking= 0x0800, cmLong10ColorPacking= 0x0a00, cmAlphaFirstPacking= 0x1000, cmOneBitDirectPacking= 0x0b00, cmAlphaLastPacking= 0x0000, cm24_8ColorPacking= 0x2100, cm32_8ColorPacking= cmLong8ColorPacking, cm40_8ColorPacking= 0x2200, cm48_8ColorPacking= 0x2300, cm56_8ColorPacking= 0x2400, cm64_8ColorPacking= 0x2500, cm32_16ColorPacking= 0x2600, cm32_32ColorPacking= 0x2700 }; /* color spaces */ enum { cmNoSpace = 0, cmRGBSpace = 1, cmCMYKSpace = 2, cmHSVSpace = 3, cmHLSSpace = 4, cmYXYSpace = 5, cmXYZSpace = 6, cmLUVSpace = 7, cmLABSpace = 8, cmReservedSpace1= 9, cmGraySpace = 10, cmReservedSpace2= 11, cmGamutResultSpace= 12, cmNamedIndexedSpace= 16, cmMCFiveSpace = 17, cmMCSixSpace = 18, cmMCSevenSpace = 19, cmMCEightSpace = 20 }; enum { cmRGBASpace = cmRGBSpace + cmAlphaSpace, cmGrayASpace = cmGraySpace + cmAlphaSpace, cmRGB16Space = cmWord5ColorPacking + cmRGBSpace, cmRGB32Space = cmLong8ColorPacking + cmRGBSpace, cmARGB32Space = cmLong8ColorPacking + cmAlphaFirstPacking + cmRGBASpace, cmCMYK32Space = cmLong8ColorPacking + cmCMYKSpace, cmHSV32Space = cmLong10ColorPacking + cmHSVSpace, cmHLS32Space = cmLong10ColorPacking + cmHLSSpace, cmYXY32Space = cmLong10ColorPacking + cmYXYSpace, cmXYZ32Space = cmLong10ColorPacking + cmXYZSpace, cmLUV32Space = cmLong10ColorPacking + cmLUVSpace, cmLAB32Space = cmLong10ColorPacking + cmLABSpace, cmGamutResult1Space= cmOneBitDirectPacking + cmGamutResultSpace, cmRGB24Space = cm24_8ColorPacking + cmRGBSpace, cmRGBA32Space = cm32_8ColorPacking + cmAlphaLastPacking + cmRGBASpace, cmLAB24Space = cm24_8ColorPacking + cmLABSpace, cmNamedIndexed32Space= cm32_32ColorPacking + cmNamedIndexedSpace, cmMCFive8Space = cm40_8ColorPacking + cmMCFiveSpace, cmMCSix8Space = cm48_8ColorPacking + cmMCSixSpace, cmMCSeven8Space = cm56_8ColorPacking + cmMCSevenSpace, cmMCEight8Space = cm64_8ColorPacking + cmMCEightSpace }; /* rendering intent values for version 2.x profiles */ enum { cmPerceptual = 0, cmRelativeColorimetric= 1, cmSaturation = 2, cmAbsoluteColorimetric= 3 }; /* flag mask values for version 2.x profiles */ enum { cmICCReservedFlagsMask= 0x0000FFFF, cmEmbeddedMask = 0x00000001, cmEmbeddedUseMask = 0x00000002, cmCMSReservedFlagsMask= 0xFFFF0000, cmQualityMask = 0x00030000, cmInterpolationMask= 0x00040000, cmGamutCheckingMask= 0x00080000 }; /* speed and quality flag values for version 2.x profiles */ enum { cmNormalMode= 0, cmDraftMode = 1, cmBestMode = 2 }; /* deviceAttributes fields */ enum { cmICCReservedAttr0Mask= 0x0000FFFF, cmReflectiveTransparentMask= 0x00000001, cmGlossyMatteMask = 0x00000002, cmVendorReservedAttr0Mask= 0xFFFF0000, cmVendorReservedAttr1Mask= 0xFFFFFFFF }; /* device/media attributes element values */ enum { cmReflective= 0, cmGlossy = 1 }; /* PrGeneral operation codes */ enum { enableColorMatchingOp= 12, registerProfileOp = 13 }; /* ColorSync Manager element tags and their signatures for version 1.0 profiles */ enum { cmCS1ChromTag= 'chrm', cmCS1TRCTag = 'trc ', cmCS1NameTag= 'name', cmCS1CustTag= 'cust' }; /* defines for the CMSearchRecord.searchMask field */ enum { cmMatchAnyProfile = 0x00000000, cmMatchProfileCMMType = 0x00000001, cmMatchProfileClass = 0x00000002, cmMatchDataColorSpace = 0x00000004, cmMatchProfileConnectionSpace= 0x00000008, cmMatchManufacturer = 0x00000010, cmMatchModel = 0x00000020, cmMatchAttributes = 0x00000040, cmMatchProfileFlags = 0x00000080 };Data Structures
/* date and time structure */ struct CMDateTime { unsigned short year; unsigned short month; unsigned short dayOfTheMonth; unsigned short hours; unsigned short minutes; unsigned short seconds; }; /* profile location union */ union CMProfLoc { CMFileLocation fileLoc; CMHandleLocation handleLoc; CMPtrLocation ptrLoc; CMProcedureLocation procLoc; }; /* profile location structure */ struct CMProfileLocation{ short locType; CMProfLoc u; }; /* file specification for file-based profiles */ struct CMFileLocation { FSSpec spec; }; /* handle specification for memory-based profiles */ struct CMHandleLocation { Handle h; }; /* procedure specification for procedure access profiles */ struct CMProcedureLocation { CMProfileAccessUPP proc; void *refCon; }; /* pointer specification for memory-based profiles */ struct CMPtrLocation { Ptr p; }; /* Apple profile header */ union CMAppleProfileHeader { CMHeader cm1; CM2Headercm2; }; /* ColorSync Manager profile 2.x header structure */ struct CM2Header { unsigned long size; OSType CMMType; unsigned long profileVersion; OSType profileClass; OSType dataColorSpace; OSType profileConnectionSpace; CMDateTime dateTime; OSType CS2profileSignature; OSType platform; unsigned long flags; OSType deviceManufacturer; unsigned long deviceModel; unsigned long deviceAttributes[2]; unsigned long renderingIntent; CMFixedXYZColorwhite; char reserved[48]; }; /* concatenated profile set structure */ struct CMConcatProfileSet { unsigned short keyIndex; unsigned short count; CMProfileRef profileSet[1]; }; /* color world information record */ struct CMCWInfoRecord { unsigned long cmmCount; CMMInfoRecord cmmInfo[2]; }; /* color management module (CMM) information record structure */ struct CMMInfoRecord { OSType CMMType; long CMMVersion; }; /* profile search record */ struct CMSearchRecord { OSType CMMType; OSType profileClass; OSType dataColorSpace; OSType profileConnectionSpace; unsigned long deviceManufacturer; unsigned long deviceModel; unsigned long deviceAttributes[2]; unsigned long profileFlags; unsigned long searchMask; CMProfileFilterUPPfilter; }; /* XYZ color-component values */ typedef unsigned short CMXYZComponent; /* XYZ color value */ struct CMXYZColor { CMXYZComponentX; CMXYZComponentY; CMXYZComponentZ; }; /* fixed XYZ color value */ struct CMFixedXYZColor { Fixed X; Fixed Y; Fixed Z; }; /* L*a*b* color value */ struct CMLabColor { unsigned shortL; unsigned shorta; unsigned shortb; }; /* L*u*v* color value */ struct CMLuvColor { unsigned shortL; unsigned shortu; unsigned shortv; }; /* Yxy color value */ struct CMYxyColor { unsigned shortcapY;/* 0..65535 maps to 0..1 */ unsigned shortx; /* 0..65535 maps to 0..1 */ unsigned shorty; /* 0..65535 maps to 0..1 */ }; /* RGB color value */ struct CMRGBColor { unsigned shortred; unsigned shortgreen; unsigned shortblue; }; /* HLS color value */ struct CMHLSColor { unsigned shorthue; unsigned shortlightness; unsigned shortsaturation; }; /* HSV color value */ typedef struct CMHSVColor { unsigned shorthue; unsigned shortsaturation; unsigned shortvalue; }; /* CMYK color value */ struct CMCMYKColor { unsigned shortcyan; unsigned shortmagenta; unsigned shortyellow; unsigned shortblack; }; /* CMY color value */ struct CMCMYColor { unsigned shortcyan; unsigned shortmagenta; unsigned shortyellow; }; /* HiFi color values */ struct CMMultichannel5Color { unsigned charcomponents[5]; }; struct CMMultichannel6Color { unsigned charcomponents[6]; }; struct CMMultichannel7Color { unsigned charcomponents[7]; }; struct CMMultichannel8Color { unsigned charcomponents[8]; }; /* gray color value */ struct CMGrayColor { unsigned shortgray; }; /* named color value */ struct CMNamedColor { unsigned long namedColorIndex;/* 0..a lot */ }; /* profile identifier structure */ struct CMProfileIdentifier { CM2Header profileHeader; CMDateTime calibrationDate; unsigned long ASCIIProfileDescriptionLen; char ASCIIProfileDescription[1]; /* variable length */ }; /* color union */ union CMColor { CM rgb; CMHSVColor hsv; CMHLSColor hls; CMXYZColor XYZ; CMLabColor Lab; CMLuvColor Luv; CMYxyColor Yxy; CMCMYKColor cmyk; CMCMYColor cmy; CMGrayColor gray; CMMultichannel5Colormc5; CMMultichannel6Colormc6; CMMultichannel7Colormc7; CMMultichannel8Colormc8; CMNamedColor namedColor; }; /* ColorSync Manager bitmap */ struct CMBitmap { char *image; long width; long height; long rowBytes; long pixelSize; CMBitmapColorSpacespace; long user1; long user2; }; /* profile reference abstract data type */ typedef struct OpaqueCMProfileRef *CMProfileRef; /* profile search result reference abstract data type */ struct CMPrivateProfileSearchResult *CMProfileSearchRef; /* high-level color-matching session reference abstract data type */ struct CMPrivateMatchRefRecord *CMMatchRef; /* color world reference abstract data type */ struct CMPrivateColorWorldRecord *CMWorldRef; /* TEnableColorMatchingBlk */ struct TEnableColorMatchingBlk { short iOpCode; short iError; long lReserved; THPrint hPrint; Boolean fEnableIt; SInt8 filler; }; /* ColorSync version 1.0 profile header */ struct CMHeader { unsigned longsize; OSType CMMType; unsigned longapplProfileVersion; OSType dataType; OSType deviceType; OSType deviceManufacturer; unsigned longdeviceModel; unsigned longdeviceAttributes[2]; unsigned longprofileNameOffset; unsigned longcustomDataOffset; CMMatchFlag flags; CMMatchOptionoptions; CMXYZColor white; CMXYZColor black; }; /* PostScript color rendering dictionary (CRD) virtual memory size tag structure */ struct CMIntentCRDVMSize { long renderingIntent; unsigned long VMSize; }; struct CMPS2CRDVMSizeType { OSType typeDescriptor; unsigned long reserved; unsigned long count; CMIntentCRDVMSize intentCRD[1]; };Functions
Accessing Profile Files
pascal CMError CMOpenProfile(CMProfileRef *prof, const CMProfileLocation *theProfile); pascal CMError CMCloseProfile(CMProfileRef prof); pascal CMError CMProfileModified(CMProfileRef prof, Boolean *modified); pascal CMError CMUpdateProfile(CMProfileRef prof); pascal CMError CMNewProfile(CMProfileRef *prof, const CMProfileLocation *theProfile); pascal CMError CMCopyProfile(CMProfileRef *targetProf, const CMProfileLocation *targetLocation, CMProfileRef prof); pascal CMError CMCloneProfileRef(CMProfileRef prof); pascal CMError CMGetProfileRefCount ( CMProfileRef prof, long *count); pascal CMError CMValidateProfile(CMProfileRef prof, Boolean *valid, Boolean *preferredCMMnotfound); pascal CMError CMGetProfileLocation ( CMProfileRef prof, CMProfileLocation *theProfile); pascal CMError CMFlattenProfile (CMProfileRef prof, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound); pascal CMError CMUnflattenProfile(FSSpec *resultFileSpec, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound);Accessing Profile Elements
pascal CMError CMProfileElementExists ( CMProfileRef prof, OSType tag, Boolean *found); pascal CMError CMCountProfileElements ( CMProfileRef prof, unsigned long *elementCount); pascal CMError CMGetProfileElement ( CMProfileRef prof, OSType tag, unsigned long *elementSize, void *elementData); pascal CMError CMGetProfileHeader (CMProfileRef prof, CMAppleProfileHeader *header); pascal CMError CMGetPartialProfileElement ( CMProfileRef prof, OSType tag, unsigned long offset, unsigned long *byteCount, void *elementData); pascal CMError CMSetProfileElementSize ( CMProfileRef prof, OSType tag, unsigned long elementSize); pascal CMError CMGetIndProfileElementInfo ( CMProfileRef prof, unsigned long index, OSType *tag, unsigned long *elementSize, Boolean *refs); pascal CMError CMGetIndProfileElement ( CMProfileRef prof, unsigned long index, unsigned long *elementSize, void *elementData); pascal CMError CMSetPartialProfileElement ( CMProfileRef prof, OSType tag, unsigned long offset, unsigned long byteCount, void *elementData); pascal CMError CMSetProfileElement ( CMProfileRef prof, OSType tag, unsigned long elementSize, void *elementData); pascal CMError CMSetProfileHeader(CMProfileRef prof, const CMAppleProfileHeader *header); pascal CMError CMSetProfileElementReference ( CMProfileRef prof, OSType elementTag, OSType referenceTag); pascal CMError CMRemoveProfileElement ( CMProfileRef prof, OSType tag); pascal CMError CMGetScriptProfileDescription ( CMProfileRef prof, Str255 name, ScriptCode *code);Accessing Named Color Profile Values
pascal CMError CMGetNamedColorInfo ( CMProfileRef prof, unsigned long *deviceChannels, OSType *deviceColorSpace, OSType *PCSColorSpace, unsigned long *count, StringPtr prefix, StringPtr suffix); pascal CMError CMGetNamedColorValue ( CMProfileRef prof, StringPtr name, CMColor *deviceColor, CMColor *PCSColor) pascal CMError CMGetIndNamedColorValue ( CMProfileRef prof, unsigned long index, CMColor *deviceColor, CMColor *PCSColor); pascal CMError CMGetNamedColorIndex ( CMProfileRef prof, StringPtr name, unsigned long *index); pascal CMError CMGetNamedColorName ( CMProfileRef prof, unsigned long index, StringPtr name)Matching Colors Using High-Level Functions With QuickDraw
pascal CMError NCMBeginMatching (CMProfileRef src, CMProfileRef dst, CMMatchRef *myRef); pascal void CMEndMatching (CMMatchRef myRef); pascal void CMEnableMatchingComment ( Boolean enableIt);Matching Colors Using Low-Level Functions Without QuickDraw
pascal CMError NCWNewColorWorld(CMWorldRef *cw, CMProfileRef src, CMProfileRef dst); pascal CMError CWConcatColorWorld (CMWorldRef *cw, CMConcatProfileSet *profileSet); pascal CMError CWNewLinkProfile(CMProfileRef *prof, const CMProfileLocation *targetLocation, CMConcatProfileSet *profileSet); pascal void CWDisposeColorWorld (CMWorldRef cw); pascal CMError CWMatchPixMap (CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon); pascal CMError CWCheckPixMap (CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon, BitMap *resultBitMap); pascal CMError CWMatchBitmap (CMWorldRef cw, CMBitMap *bitMap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitMap *matchedBitMap); pascal CMError CWCheckBitmap (CMWorldRef cw, const CMBitMap *bitMap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitMap *resultBitMap); pascal CMError CWMatchColors (CMWorldRef cw, CMColor *myColors, unsigned long count); pascal CMError CWCheckColors (CMWorldRef cw, CMColor *myColors, unsigned long count, long *result);Using Embedded Profiles With QuickDraw
pascal void NCMDrawMatchedPicture (PicHandle myPicture, CMProfileRef dst, Rect *myRect); pascal CMError NCMUseProfileComment ( CMProfileRef prof, unsigned long flags);Assigning and Accessing the System Profile File
pascal CMError CMSetSystemProfile (const FSSpec *profileFileSpec); pascal CMError CMGetSystemProfile (CMProfileRef *prof);Searching External Profiles
pascal CMError CMNewProfileSearch (CMSearchRecord *searchSpec, void *refCon, unsigned long *count, CMProfileSearchRef *searchResult); pascal CMError CMUpdateProfileSearch ( CMProfileSearchRef search, void *refCon, unsigned long *count); pascal void CMDisposeProfileSearch ( CMProfileSearchRef search); pascal CMError CMSearchGetIndProfile ( CMProfileSearchRef search, unsigned long index, CMProfileRef *prof); pascal CMError CMSearchGetIndProfileFileSpec ( CMProfileSearchRef search, unsigned long index, FSSpec *profileFile);Searching For a Profile by Profile Identifier
pascal CMError CMProfileIdentifierFolderSearch ( CMProfileIdentifierPtr ident, unsigned long *matchedCount, CMProfileSearchRef *searchResult); pascal CMError CMProfileIdentifierListSearch ( CMProfileIdentifierPtr ident, CMProfileRef *profileList, unsigned long listSize, unsigned long *matchedCount, CMProfileRef *matchedList);Converting Between Color Spaces
pascal ComponentResult CMConvertXYZToLab ( const CMColor *src, const CMXYZColor *white, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertLabToXYZ ( const CMColor *src, const CMXYZColor *white, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertXYZToLuv ( const CMColor *src, const CMXYZColor *white, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertLuvToXYZ ( const CMColor *src, const CMXYZColor *white, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertXYZToYxy ( const CMColor *src, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertYxyToXYZ ( const CMColor *src, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertXYZToFixedXYZ ( const CMXYZColor *src, CMFixedXYZColor *dst, unsigned long count); pascal ComponentResult CMConvertFixedXYZToXYZ ( const CMFixedXYZColor *src, CMXYZColor *dst, unsigned long count); pascal ComponentResult CMConvertRGBToHLS ( const CMColor *src, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertHLSToRGB ( const CMColor *src, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertRGBToHSV ( const CMColor *src, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertHSVToRGB ( const CMColor *src, CMColor *dst, unsigned long count); pascal ComponentResult CMConvertRGBToGray ( const CMColor *src, CMColor *dst, unsigned long count);PostScript Color-Matching Support Functions
pascal CMError CMGetPS2ColorSpace (CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound); pascal CMError CMGetPS2ColorRenderingIntent ( CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound); pascal CMError CMGetPS2ColorRendering ( CMProfileRef srcProf, CMProfileRef dstProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound); extern pascal CMError CMGetPS2ColorRenderingVMSize ( CMProfileRef srcProf, CMProfileRef dstProf, unsigned long *vmSize, Boolean *preferredCMMnotfound);Locating the ColorSync(TM) Profiles Folder
pascal CMError CMGetColorSyncFolderSpec ( short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID);Converting 2.x Profiles to 1.0 Format
pascal CMError CMConvertProfile2to1 ( CMProfileRef profv2, CMProfileHandle *profv1);Obtaining Information About a Color World
pascal CMError CMGetCWInfo (CMWorldRef cw, CMCWInfoRecord *info);Application-Supplied Functions for the ColorSync Manager
pascal OSErr MyColorSyncDataTransfer ( long command, long *size, void *data, void *refCon); pascal Boolean MyCMBitmapCallBackProc ( long progress, void *refCon); pascal Boolean MyCMProfileFilterProc ( CMProfileRef prof, void *refCon);