是的。如您所示,ColorSync Manager Reference指出以下内容:
CMNewProfileSearch函数未充分利用从ColorSync版本2.5开始的优化配置文件 搜索。改为使用CMIterateColorSyncFolder 。
CMIterateColorSyncFolder
是官方这样做的方法。此外,这也是优化的方式。
从Apple's ImageApp sample code:
编辑:我已经修改了代码示例删除NewCMProfileIterateUPP
和DisposeCMProfileIterateUPP
。
// Callback routine with a description of a profile that is
// called during an iteration through the available profiles.
//
static OSErr profileIterate (CMProfileIterateData *info, void *refCon)
{
NSMutableArray* array = (NSMutableArray*) refCon;
Profile* prof = [Profile profileWithIterateData:info];
if (prof)
[array addObject:prof];
return noErr;
}
// return an array of all profiles
//
+ (NSArray*) arrayOfAllProfiles
{
NSMutableArray* profs=[[NSMutableArray arrayWithCapacity:0] retain];
CMIterateColorSyncFolder(profileIterate, NULL, 0L, profs);
return (NSArray*)profs;
}
事实证明,不需要NewCMProfileIterateUPP
和DisposeCMProfileIterateUPP
所以他们没有被替换成任何东西,只要我可以告诉。相反,您可以使用与上面的profileIterate
匹配的签名来定义回调函数。然后您可以直接将回调函数传递给CMIterateColorSyncFolder
。
我测试了我在Mac OS X 10.5上的ImageApp中的更改,它按预期工作。
函数NewCMProfileIterateUPP()和DisposeCMProfileIterateUPP()在Mac OS X 10.5中不推荐使用。 – 2009-05-05 03:37:08