Re: altering an NSImage by access to pixels
Re: altering an NSImage by access to pixels
- Subject: Re: altering an NSImage by access to pixels
- From: David Duncan <email@hidden>
- Date: Thu, 18 Aug 2011 16:35:57 -0700
On Aug 18, 2011, at 4:31 PM, The Karl Adam wrote:
> Hey David,
> Why not just use the CGDataProviderCopyData(CGImageGetDataProvider(imageRef)) to create a new NSBitmapImageRequest with the image's original data? Is drawing it more performant or gives you a better more compact data representation?
In the end the difference is minor (assuming you use either the NSCompositeCopy compositing operation or kCGBlendModeCopy blend mode when drawing the image – if you don't you leave some performance on the ground and need to ensure your destination buffer has been cleared). The primary downside to using CGDataProviderCopyData is that if the original image isn't in precisely the format you need, you have to re-draw it anyway.
Typically CGDataProviderCopyData() is most valuable if your source data is in non-premultiplied alpha format and you need it to remain in that format. Core Graphics can't provide you with non-premultiplied alpha pixels via drawing, so thats the only route if you need them.
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden