Re: Converting NSImage to CGImage
Re: Converting NSImage to CGImage
- Subject: Re: Converting NSImage to CGImage
- From: "Julien Jalon" <email@hidden>
- Date: Sun, 12 Nov 2006 12:04:02 -0800
If you want to draw something AppKit base in a CGContextRef, you need to:
1) create a NSGraphicsContext from CGContext using
graphicsContextWithGraphicsPort:flipped:
2) Then:
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:myNSContext];
3) do your drawing
4) Then:
[NSGraphicsContext restoreGraphicsState];
--
Julien
On 11/12/06, Antonio Nunes <email@hidden> wrote:
Hi,
I have NSImages of different types (jpg, png, tiff, psd, etc) and
need to draw them into a CGContext (CGPDFContext to be precise).
Looking for info on how to convert an NSImage to a CGImage, I get
mostly topics which explain how to do it the other way around. The
closest thing I found is webkit's "WebConvertNSImageToCGImageRef",
but I'm not so sure it will do for my needs. So two questions:
1. Would the webkit's function gracefully handle large images?
2. Are there other ways to accomplish the conversion?
António
-----------------------------------------------------------
Don't believe everything you think
-----------------------------------------------------------
_______________________________________________
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
_______________________________________________
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