On 9 Jan 2009, at 12:53 am, Eric Gorr wrote:
Interesting. It looks like the function has a pixelFormatType parameter, so there is no need to place it in the attributes dictionary. While it does look like I could get a CVPixelBufferRef, what is unclear is how I could get a NSImage from the CVPixelBufferRef. I've searched briefly, but couldn't come up with anything...all of the messages I found mentioning both these items talk about converting a NSImage to a CVPixelBufferRef.
Once you have a raw pixel buffer of any sort, it's easy to get it into an NSImage.
First wrap a NSBitmapImageRep around it - you can pass in the base address of the pixel buffer in the first parameter ("planes").
Then add the rep to an NSImage. At no point is it necessary to create a context, data provider, do any drawing or anything else - you have the data (the pixel buffer) it just needs putting into the right structure.
--Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com