• 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: erasing, redrawing NSBezierPath into and NSImage problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: erasing, redrawing NSBezierPath into and NSImage problem


  • Subject: Re: erasing, redrawing NSBezierPath into and NSImage problem
  • From: Steve Sims <email@hidden>
  • Date: Tue, 6 Jul 2004 11:48:53 -0400

On 6 Jul 2004, at 01:03, Wilhelm Phillips wrote:

I'm pretty certain this has something to do with how I'm drawing the bezierPath.

If I use your clearColor code with NSRectFill below I can clear the entire image.

Yeah, NSRectFill doesn't seem to work the same way as filling NSBezierPath objects... If memory serves I think it ignores the opacity setting of the colour you're using it with.

If I set it to clearColor and try to fill just the bezierPath it doesn't clear the image. Interesting.

That's because the clearColor is not opaque - it is fully transparent. If you use it to fill then it actually results in nothing being drawn. Same applies for using it to stroke paths.

This must also be leading to the reason why I cannot redraw correctly back into the image.

Further suggestions?

I looked into doing some of this stuff a while back when I was writing FontFX7. One possibility is to use multiple NSImages and use compositing operations. You might want to take a look at the CompositeLab sample code. If you want to clear parts of an NSImage using an NSBezierPath to describe the area you wish to clear you should draw that NSBezierPath in opaque black (or should that be white?) in a new image and then use an "out" compositing operation to cause the new path to be cleared from your source image.

A common reason for wishing to do this kind of thing is to get around the problem of stroked lines overlapping their fills when using transparent colours.

Using compositing however isn't entirely compatible with producing PDF output files, since there are limitations on PDF compositing within Quartz. For bitmapped output it's fine though.

Of course the alternative approach would be to simply throw the old image away and draw a completely new one. This may be more efficient.

Steve
_______________________________________________
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: erasing, redrawing NSBezierPath into and NSImage problem (From: Wilhelm Phillips <email@hidden>)
 >Re: erasing, redrawing NSBezierPath into and NSImage problem (From: Wilhelm Phillips <email@hidden>)

  • Prev by Date: Using -scrollRectToVisible: in NSTextView
  • Next by Date: Re: Using -scrollRectToVisible: in NSTextView
  • Previous by thread: Re: erasing, redrawing NSBezierPath into and NSImage problem
  • Next by thread: Re: erasing, redrawing NSBezierPath into and NSImage problem
  • Index(es):
    • Date
    • Thread