On Jul 27, 2008, at 4:19 PM, [EMAIL PROTECTED] wrote:
-------------- Original message ----------------------
From: glenn andreas <[EMAIL PROTECTED]>
CG is "stateless", in that there is no "current context" (all drawing
to a CGContext requires passing the CGContextRef).
NSGraphicsContext,
on the other hand, involves an implicit "current context". If you
change that, you need to change it back - that's what currentContext/
setCurrentContext does. Just because NSGraphicsContext is built on
top of CGContextRef doesn't mean that they have the same semantics
(nor is NSGraphicsContext "just a wrapper" - it does a few more
things).
Thanks Glenn.
I'm still confused as to exactly how I should restore or change the
context "back to the original" since the original is a
CGGraphicsContext. and the only NSGraphicsContext is one I create
using the passed in CGGraphicsContext. It seems like a catch-22. I
can't draw the text without creating an NSGraphicsContext and I
can't restore a calling NSGraphicsContext because the calling
context is a CGGraphics context which doesn't work with
[NSGraphicsContext setCurrentContext: nsContext];
Any pointers?
If you call [NSGraphicsContext currentContext] before your
setCurrentContext:, what do you get back?
Whatever that is, that's the context to restore with a second
[NSGraphicsContext setCurrentContext: ] at the end...
Pay no attention to what the CGGraphicsContext is - there is no such
thing as a "current" CGGraphicsContext (since CGGraphicsContext
routines all take the context as an explicit parameter) - it's only
the implicit NSGraphicsContext that matters.
_______________________________________________
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]