• 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: clearing (not erasing) when drawing from a thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clearing (not erasing) when drawing from a thread


  • Subject: Re: clearing (not erasing) when drawing from a thread
  • From: Murat Konar <email@hidden>
  • Date: Mon, 26 Nov 2007 11:22:15 -0800

Having thought this over, and reflecting on what is probably going on in the normal case of drawing, I have concluded that what I'm after is not generally possible.

Here's my reasoning; I'd be happy to be proved wrong, but here goes:

Loosely, when I'm drawing to a window from a thread, I am asking to have my image to be composited onto a bitmap that is shared by all views in the window.

In Cocoa's normal drawing, the entire view stack is re-composited, one view at a time. The effect of having my superviews composited onto the shared bitmap before I draw is that what ever I drew before has been effectively erased.

When drawing from a thread, I don't have the benefit of my superviews clearing out what I drew before, and calling drawRect: on all my superviews is obviously not a solution.

The only alternative I can think of is to periodically grab an image of the composited view stack (minus my view) on the main thread, and feed it to my thread, then from my thread composite my stuff on top of the image then draw the result.

_murat


On Nov 26, 2007, at 7:58 AM, Matt Neuburg wrote:

On Sun, 25 Nov 2007 15:57:10 -0800, m <email@hidden> said:
           [tiffImage drawAtPoint:NSMakePoint(0, 0)
fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];

The problem is that successive frames of my image get composited on
top of each other

Possibly this has something to do with what NSCompositeSourceOver means. It
might help to experiment with other options...


(my drawing will be placed over an arbitrary and possibly changing background)

But you are still the one drawing that background, right? So if necessary
you *could* draw it again in the area where the image is to go, right?


Just some things to think about - These are the sorts of considerations that
have led me to solutions of similar problems in the past... m.
_______________________________________________

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: 
 >Re: clearing (not erasing) when drawing from a thread (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: UTI's and document packages
  • Next by Date: Re: clearing (not erasing) when drawing from a thread
  • Previous by thread: Re: clearing (not erasing) when drawing from a thread
  • Next by thread: IKImageBrowser performance issues
  • Index(es):
    • Date
    • Thread