• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: altering an NSImage by access to pixels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >altering an NSImage by access to pixels (From: James Walker <email@hidden>)
 >Re: altering an NSImage by access to pixels (From: David Duncan <email@hidden>)
 >Re: altering an NSImage by access to pixels (From: The Karl Adam <email@hidden>)

  • Prev by Date: Re: altering an NSImage by access to pixels
  • Next by Date: Lion - CopiesOnScroll Bug with table view
  • Previous by thread: Re: altering an NSImage by access to pixels
  • Next by thread: Re: altering an NSImage by access to pixels
  • Index(es):
    • Date
    • Thread