• 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: white screen windows at first
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >white screen windows at first (From: Bill Appleton <email@hidden>)
 >Re: white screen windows at first (From: "Paul Sanders" <email@hidden>)
 >Re: white screen windows at first (From: Bill Appleton <email@hidden>)
 >Re: white screen windows at first (From: Uli Kusterer <email@hidden>)
 >Re: white screen windows at first (From: Bill Appleton <email@hidden>)
 >Re: white screen windows at first (From: "Paul Sanders" <email@hidden>)
 >Re: white screen windows at first (From: vincent habchi <email@hidden>)
 >Re: white screen windows at first (From: Bill Appleton <email@hidden>)

  • Prev by Date: Re: NSKeyedArchiver and NSPoints
  • Next by Date: advancementForGlyph problem
  • Previous by thread: Re: white screen windows at first
  • Next by thread: Re: white screen windows at first
  • Index(es):
    • Date
    • Thread