Re: convert GraphicsImportComponent to NSImage
Re: convert GraphicsImportComponent to NSImage
- Subject: Re: convert GraphicsImportComponent to NSImage
- From: Michael Silva <email@hidden>
- Date: Fri, 21 Apr 2006 22:04:24 -0400
Thanks. I had tried this method, but the image is messed up (wrong
color space or something) after the CGImage conversion.
On Apr 21, 2006, at 7:49 PM, Jonathan Johnson wrote:
On 4/21/06, Michael Silva <email@hidden> wrote:
Is there any reference to get an image stored as
GraphicsImportComponent into a Cocoa NSImage object? Does anyone
have any suggestions?
As of QuickTime 6.5, you can use GraphicsImportCreateCGImage to get a
CGImageRef. Then, the only way I know to get this into an NSImage
would be to create a new NSBitmapImageRep, lock focus, draw the image
using CoreGraphics, and unlock focus.
A couple of conversions, but it's better than nothing, and doesn't
involve the disk.
Depending on your requirements, you might also consider using ImageIO
on 10.4 to skip the QT->CGImageRef step, and start with a CGImageRef.
HTH,
Jon
--
Jonathan Johnson
REAL Software, Inc.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden