Re: NSBezierPath & different colors
Re: NSBezierPath & different colors
- Subject: Re: NSBezierPath & different colors
- From: Shawn Erickson <email@hidden>
- Date: Mon, 3 Mar 2003 19:16:05 -0800
On Monday, March 3, 2003, at 02:27 PM, Anthony Arthur wrote:
Hi,
I suspect there has already been discussion on this, and I think the
solution may be within the graphics context, but.....
I have several distinct and separate paths. They all are rendered
inside the same view and I want each to be filled with a different
color. Any help on how to do that?
Read the docs for NSBezierPath's fill method. Read the docs for
NSColor's set methods.
Example (assuming inside of drawRect or a locked focused view):
[NSGraphicsContext saveGraphicsState]; //not needed unless you need to
save state for drawing after path fils.
[[NSColor red] set];
[redPath fill];
[[NSColor white] set];
[whitePath fill];
[[NSColor blue] set];
[bluePath fill];
[NSGraphicsContext restoreGraphicsState];
-Shawn
_______________________________________________
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.