-------------- Original message ----------------------
From: glenn andreas <[EMAIL PROTECTED]>
>  restoreGraphicsState restores the state of the current context - it  
> does not restore the context to the previous context. You need to  
> explicitly save the current context before you do setCurrentContext:
> 
> NSGraphicsContext *oldContext = [NSGraphicsContext currentContext];
> [NSGraphicsContext setCurrentContext: nsContext];
> ... do drawing in the nsContext (save/restoreGraphics state impacts  
> internal variables of nsContext)
> [NSGraphicsContext setCurrentContext: oldContext];
> 

I think part of the difficulty I'm having is that I'm using CGGraphicsContext 
for the bulk of the drawing but found the CGxxx styled text drawing too tedious 
so switch to NSGraphic context methods just to draw the text and then attempt 
to switch back to CGGraphicsContext

You'll note that I'm passing in a CGContextRef to drawImageTextInCGContext and 
creating a temporary context just for the text drawing with this line:

NSGraphicsContext *nsContext = [NSGraphicsContext 
graphicsContextWithGraphicsPort: inContextRef flipped: NO];

By my (perhaps flawed) understanding, I'm really just using the passed in 
context with an NSGraphics context wrapper, no? Do I restore the passed in 
context? And if so, how?


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to