• 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: Converting NSImage to CGImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Converting NSImage to CGImage
      • From: Antonio Nunes <email@hidden>
References: 
 >Converting NSImage to CGImage (From: Antonio Nunes <email@hidden>)

  • Prev by Date: Better printed documentation? (wish list)
  • Next by Date: XMPP framework?
  • Previous by thread: Converting NSImage to CGImage
  • Next by thread: Re: Converting NSImage to CGImage
  • Index(es):
    • Date
    • Thread