• 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: Basic NSGraphicsContext question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic NSGraphicsContext question


  • Subject: Re: Basic NSGraphicsContext question
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Fri, 4 Jul 2003 23:22:01 +0100

On Friday, July 4, 2003, at 09:36 pm, Jim Crafton wrote:

I think you probably want to look at the lockFocus and unlockFocus methods of NSImage. Something like

NSImage *myImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];

[myImage lockFocus];

// Draw here

[myImage unlockFocus];

will get you an NSImage that you can render to the window using the various compositing and/or drawing methods.

Is it possible to get the NSGraphicsContext that the NSImage uses ?

Try [NSGraphicsContext currentContext] between the lockFocus/unlockFocus.

But why do you need an NSGraphicsContext? You don't normally need to get at the context itself (again, unlike on Win32).

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Basic NSGraphicsContext question
      • From: Gerard Iglesias <email@hidden>
References: 
 >Re: Basic NSGraphicsContext question (From: Jim Crafton <email@hidden>)

  • Prev by Date: Re: Basic NSGraphicsContext question
  • Next by Date: Re: Basic NSGraphicsContext question
  • Previous by thread: Re: Basic NSGraphicsContext question
  • Next by thread: Re: Basic NSGraphicsContext question
  • Index(es):
    • Date
    • Thread