altering an NSImage by access to pixels

2011-08-18 Thread James Walker
Let's say I have an NSImage that contains some representation other than an NSBitmapImageRep, and I want to play with the pixel values. My plan was like this: Create a NSBitmapImageRep of the same size as my source image. Make a new NSImage and add my new representation to it. Lock focus on

Re: altering an NSImage by access to pixels

2011-08-18 Thread David Duncan
On Aug 18, 2011, at 4:16 PM, James Walker wrote: Let's say I have an NSImage that contains some representation other than an NSBitmapImageRep, and I want to play with the pixel values. Create your NSBitmapImageRep Create a NSGraphicsContext from that rep and make it current Draw your

Re: altering an NSImage by access to pixels

2011-08-18 Thread David Duncan
On Aug 18, 2011, at 4:26 PM, Kyle Sluder wrote: I'd point you at the Snow Leopard AppKit release notes, which contain a very long discussion about this topic (presumably written by David), but it seems there are only the Lion and Leopard versions available online. :( I can't take credit

Re: altering an NSImage by access to pixels

2011-08-18 Thread The Karl Adam
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? _Karl On Thu, Aug 18, 2011 at 4:23 PM, David Duncan

Re: altering an NSImage by access to pixels

2011-08-18 Thread Kyle Sluder
On Thu, Aug 18, 2011 at 4:23 PM, David Duncan david.dun...@apple.com wrote: On Aug 18, 2011, at 4:16 PM, James Walker wrote: Let's say I have an NSImage that contains some representation other than an NSBitmapImageRep, and I want to play with the pixel values. Create your NSBitmapImageRep

Re: altering an NSImage by access to pixels

2011-08-18 Thread James Walker
On 8/18/2011 4:23 PM, David Duncan wrote: On Aug 18, 2011, at 4:16 PM, James Walker wrote: Let's say I have an NSImage that contains some representation other than an NSBitmapImageRep, and I want to play with the pixel values. Create your NSBitmapImageRep Create a NSGraphicsContext from