NSBezierPath winding rules and glyphs
NSBezierPath winding rules and glyphs
- Subject: NSBezierPath winding rules and glyphs
- From: email@hidden
- Date: Sun, 23 Mar 2003 12:16:11 +0100
Hi everyone,
I'd like to be able to completely fill all of the innards of a glyph
using the outline regardless of any internal subpaths of the glyph.
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.
I've played around with both Quartz 2D and NSBezierPath but either it's
simply not possible or I'm (hopefully!) missing something obvious?
The reason for wanting to do this is that I'd like to fill any "holes"
in the glyph with a specific color before compositing it into my view
as I've got a bunch of chess fonts that expect to be used on a white
background to look correct (but I really want to composite them onto
another pattern filled background which makes them look bad unless I
can fill those holes first...).
Any ideas or pointers are much appreciated!
Joakim
The testing code is as simple as:
---
{
NSBezierPath *path = [NSBezierPath bezierPath];
NSFont *font = [self currentChessFont];
[path setWindingRule: NSNonZeroWindingRule] ; // NSEvenOddWindingRule
[path moveToPoint:NSMakePoint(r.origin.x, r.origin.y)];
[path appendBezierPathWithGlyph:[font glyphWithName:@"k"]
inFont:font];
[path fill];
[path stroke];
}
---
_______________________________________________
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.