The clipping path approach doesn't really help. It turns out that you can only 
intersect the current clipping path (initially the view's bounds) with a new 
path and the intersected region is the region where drawing is visible. This 
means that when you're drawing a larger rectangle over a smaller one, you would 
need to set the clipping path to all areas NOT covered by the smaller 
rectangle. This is basically the same problem as calculating which parts of the 
larger rectangle to draw and just drawing there.

The layer approach din't work out as well. I get the same black color problem 
as with the view.  

Overriding drawRect: is problematic for WebViews, as Jens pointed out WebViews 
do all sorts of drawing voodoo. Believe me, I've tried. 

It seems that the only option left manually doing difference operations (or 
doing an overlay window) on the rectangles and drawing only the uncovered 
portions. Set operations on NSBezierPath would definitely help. I found a nice 
category on cocoadev 
(http://www.cocoadev.com/index.pl?NSBezierPathcombinatorics) but it uses the 
General Polygon Clipper (which I won't be able to use due to licensing issues). 
Does perhaps anyone else know of a convenient method (library) to do difference 
operations on rectangular shapes (i.e., draw a NSRect but not the points that 
are in an array of other NSRects)?

> If the clipping path method works, and if you can subclass your webview, then 
> you shouldn't need a separate view at all.  Just override drawRect: and draw 
> your rectangles after calling super.  It sounds almost too easy.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to