Re: How to draw a CGImage object to a NSView?
Re: How to draw a CGImage object to a NSView?
- Subject: Re: How to draw a CGImage object to a NSView?
- From: glenn andreas <email@hidden>
- Date: Wed, 20 Feb 2008 09:12:26 -0600
On Feb 20, 2008, at 4:21 PM, Leopard x86 wrote:
Hi everyone.
After reading the Quartz Graphics programming document, I am still
trying to find a method to draw a CGImageRef object "directly" to a
NSView / NSOpenGLView ...
My application decodes some files on the disk to into
CGDataProvider, then uses the CGDataProviders to create CGImageRefs.
I think it will cost too much performance to convert the CGImage
objects to other formats, e.g. NSImage, CIImage. So I am wondering a
direct way to draw CGImage to a NSView or NSOpenGLView.
It's pretty easy to do in an NSView:
- (void) drawRect: (NSRect) rect
{
CGRect destRect = CGRectMake(0, 0, 100, 100);
CGContextDrawImage ([[NSGraphicsContext currentContext]
graphicsPort], destRect, myImageRef );
}
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | flame : flame fractals & strange attractors : build,
mutate, evolve, animate
_______________________________________________
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