Re: Basic NSGraphicsContext question
Re: Basic NSGraphicsContext question
- Subject: Re: Basic NSGraphicsContext question
- From: "Alastair J.Houghton" <email@hidden>
- Date: Fri, 4 Jul 2003 21:31:09 +0100
On Friday, July 4, 2003, at 06:54 pm, Jim Crafton wrote:
First off I'll admit I am a complete newbie to OS X development (I am
coming from a Win32 background).
Is there a way to create an NSGraphicsContext from an image (I guess
similar to
CGCreateBitmapContext ?) to use for drawing, and then render the
contents of the NSGraphicsContext back to the one owned by a Window?
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.
It's also worth mentioning that windows are typically buffered
("retained") in OS X, so there isn't any need to render to off-screen
buffers to avoid flicker, 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.