• 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: Convert GWorldPtr into a NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert GWorldPtr into a NSImage


  • Subject: Re: Convert GWorldPtr into a NSImage
  • From: Graham Cox <email@hidden>
  • Date: Fri, 9 Jan 2009 10:00:03 +1100


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 (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: 
 >Convert GWorldPtr into a NSImage (From: Eric Gorr <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Graham Cox <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Eric Gorr <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Graham Cox <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Daniel Kennett <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Eric Gorr <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Graham Cox <email@hidden>)
 >Re: Convert GWorldPtr into a NSImage (From: Eric Gorr <email@hidden>)

  • Prev by Date: What's the most cocoa-ey pattern for this?
  • Next by Date: Re: Encryption and Security
  • Previous by thread: Re: Convert GWorldPtr into a NSImage
  • Next by thread: Re: Convert GWorldPtr into a NSImage
  • Index(es):
    • Date
    • Thread