这个项目是一个具有核心图形支持的通用 C++ 插件。我无法成功将 PicHandle 转换为 CGImageRef。从 CFDataRef 保存图像会导致图像错误。
if(pic)
{
Handle thePictureFileHandle;
thePictureFileHandle = NewHandleClear(512);
HandAndHand((Handle)pic,thePictureFileHandle);
dataProvider= CGDataProviderCreateWithData(NULL,(void*)*thePictureFileHandle,GetHandleSize( (Handle)thePictureFileHandle ),NULL );
CFDataRef data = CGDataProviderCopyData(dataProvider);
CGImageSourceRef source = CGImageSourceCreateWithDataProvider(dataProvider, NULL);
if ( source )
{
cgImageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL);
}
CGDataProviderRelease(dataProvider);
CFRelease( source );
CFRelease( data );
}