Re: white screen windows at first
Re: white screen windows at first
- Subject: Re: white screen windows at first
- From: "Paul Sanders" <email@hidden>
- Date: Wed, 28 Apr 2010 19:45:25 +0100
If you want to draw outside of drawRect:, try calling lockFocus on your content view first. Then, to get an NSGraphicsContext, call [NSGraphicsContext currentContext]. When you are done drawing, call unlockFocus, again on your content view. Also, in my experience, if you draw outside of drawRect: you need to call flushWindow yourself after calling unlockFocus to get reliable screen updates.
Paul Sanders.
----- Original Message -----
From: Bill Appleton
To: vincent habchi
Cc: Paul Sanders ; cocoa-dev list
Sent: Wednesday, April 28, 2010 7:29 PM
Subject: Re: white screen windows at first
hi all,
i have been working on this a lot & have some new information
previously i was using carbon and core graphics
when i draw to the screen, sometimes it is in the update event but sometimes it was in response to a mouse click, or some other event
this always worked:
QDBeginCGContext(grafptr, &cgContext);
CGContextSaveGState(cgContext);
draw with core graphics here...
CGContextRestoreGState(cgContext);
QDEndCGContext(grafptr, &cgContext);
but when i switched to cocoa, i started doing this:
cgcontext = [[myNSWindowPtr graphicsContext] graphicsPort];
CGContextSaveGState(cgContext);
draw with core graphics here...
CGContextRestoreGState(cgContext);
this appears to only work from inside the drawRect routine, if i get here from some other event it doesn't work
so is it "legal" to draw on an NSWindow from some other event?
if not, what the heck does QDEndCGContext do that makes it work?
thanks,
bill
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden