I have existing code that uses CMNewProfileSearch to find then iterate over the color profiles on the system getting their names and full paths. Unfortunately, CMNewProfileSearch is deprecated in Mac OS X 10.5 and is also unavailable when compiling a 64-bit application.
In reading the ColorSync Manager 2.5 Reference, it seems like the new way to iterate over installed color profiles is to use the CMIterateColorSyncFolder function.
- Is that true?
- Is there a Cocoa way to do what I want instead?
- Anybody got any sample code?
Thanks.
Yes. As you indicated, the ColorSync Manager Reference says the following:
The CMNewProfileSearch function does not take full advantage of the optimized profile
searching available starting with ColorSync version 2.5. Use CMIterateColorSyncFolder
instead.
CMIterateColorSyncFolderis the official way to do this. Besides, it’s also the optimized way.From Apple’s ImageApp sample code:
EDIT: I’ve modified the code sample to remove
NewCMProfileIterateUPPandDisposeCMProfileIterateUPP.It turns out that don’t need
NewCMProfileIterateUPPandDisposeCMProfileIterateUPPso they haven’t been replaced with anything, as far as I can tell. Instead, you can define the callback function with a signature that matchesprofileIterate, above. You can then just pass the callback function directly toCMIterateColorSyncFolder.I’ve tested my changes in ImageApp on Mac OS X 10.5 it it works as expected.