Re: NSBezierPath winding rules and glyphs
Re: NSBezierPath winding rules and glyphs
- Subject: Re: NSBezierPath winding rules and glyphs
- From: Brock Brandenberg <email@hidden>
- Date: Sun, 23 Mar 2003 11:52:36 -0600
Joakim,
>
I've tried setting the winding rules for the NSBezierPath, but both
>
NSNonZeroWindingRule and NSEvenOddWindingRule yield the same result for
>
a path consisting of a single glyph - essentially what I'd need is the
>
behavior of a new "NSUnconditionalWindingRule" that always fills
>
everything bounded by the outlines of the path.
>
>
Any ideas or pointers are much appreciated!
The "Winding Rules and Filling Paths" docs are a little misleading because
Fig 1 should have four pictures instead of three. Apple has left off the
fourth picture where the paths should be going in opposite directions, but
the center circle remains unfilled. Knowing this, it should be clearer that
the NSEvenOddWindingRule dosen't care about winding order (read the docs
closer about intersecting the path with a ray). So, the only way to get a
filled center is to set to NSNonZeroWindingRule and reverse the interior
bezier path directions manually so that they all wind in the same direction.
This is not trivial, and unfortunately I don't have an immediate solution to
suggest.
A commonly used technique, though, is to stroke the paths with an opposite
color before filling to give the path a "halo" or outline effect. The
pointer cursor uses this trick so that it's visible on any background, and
it doesn't require you to do any winding rule manipulation. It looks like
you are stoking the path now, but are you doing it in an opposite color?
And here's an appendBezierPathWithGlyph: tip. Make sure that you always send
the appendBezierPathWithGlyph: message inside of a draw loop, or that you
instead have lockFocus on a view or image before sending it or it will not
work. This is an undocumented requirement of the method.
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
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.