Re: [firstPath appendBezierPath: [secondPath bezierPathByReversingPath]];
Re: [firstPath appendBezierPath: [secondPath bezierPathByReversingPath]];
- Subject: Re: [firstPath appendBezierPath: [secondPath bezierPathByReversingPath]];
- From: Steve Sims <email@hidden>
- Date: Wed, 19 May 2004 01:59:59 -0400
On 19 May 2004, at 00:07, Hamish Allan wrote:
Can anybody explain this NSBezierPath behaviour to me? When I run the
code below I get:
path 1 point at (0.250000,0.750000)
path 1 point at (0.750000,0.750000)
path 1 point at (0.750000,0.250000)
path 1 point at (0.250000,0.250000)
path 2 point at (0.250000,0.750000)
path 2 point at (0.750000,0.750000)
path 2 point at (0.750000,0.250000)
path 2 point at (0.250000,0.250000)
which seem to describe the same path, but I only see the red (path 1)
quad. (I used transparency for demonstration's sake, but the problem is
reproducible with solid color by just trying to draw each box in turn).
The code is the drawRect for a custom NSView. (It's copied from XCode,
rather than written in Mail.app.)
<snip>
Any ideas?
Yep. Your path 2 is composed of different types of path elements from
path 1.
The elementAtIndex call actually returns the type of path element at
the index. If you looked at the path type I think you'll find that the
two paths above are not identical; line and move path elements are
different... Whilst the two paths contain the same points path 2
actually describes two separate lines, rather than a square, so there's
no fill area for that path. If you stroked the paths rather than
filling them you would have seen this.
Just one other point... I would have used closePath to ensure the path
was properly completed. I'm not sure that really matters much though.
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.