• 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: Display vs. LockFocus and draw
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display vs. LockFocus and draw


  • Subject: Re: Display vs. LockFocus and draw
  • From: Marco Binder <email@hidden>
  • Date: Tue, 30 Jul 2002 11:32:36 +0200

> display will also get sub views to draw as well as the parts of it
> parent view that the view occupies, even if your image/drawing doesn't
> have any explicit transparency you will probably find you drawing still
> contains transparency due to aliasing. If you are trying to improve
> response when dragging try using setNeedsDisplayInRect: and make sure
> your view takes advantage of the NSRect parameter in drawRect:

Thanks for the response! Still...

the point is, that i DO NOT want the view to redisplay itself! I draw
something ontop of the view while dragging the mouse, and only when dragging
is done, I will have this object added to the elements, my view will draw
from inside its drawRect: method. But still, I need the view to draw its
"old" state just restore the background while dragging. It works nicely with

myView.lockFocus();

myView.drawRect(rect);
myObject.drawRect(rect);
myView.unlockFocus();
myView.setNeedsDisplay(false);

myView.unlockFocus();

myView.displayIfNeeded();

MyObject is only drawn after the displayIfNeeded()-call. So- if I d use
myView.display() or as suggested myView.setNeedsDisplayInRect(rect),
myObject would be erased again, since ist not yet part of the
myView.draw()-method.

So you see, it works the way I did it, but still I wonder WHAT display() is
doing in addition to locking the focus, drawing and unlocking again, as they
say in the docs.

marco
_______________________________________________
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.

References: 
 >Re: Display vs. LockFocus and draw (From: Nathan Day <email@hidden>)

  • Prev by Date: Re: Rearranging NSWindows
  • Next by Date: NSImageRep.imageFileTypes() doesnt work...
  • Previous by thread: Re: Display vs. LockFocus and draw
  • Next by thread: Accessing points within an NSBezierPath
  • Index(es):
    • Date
    • Thread