• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSBezierPath & different colors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >NSBezierPath & different colors (From: Anthony Arthur <email@hidden>)

  • Prev by Date: Re: Creating an alias
  • Next by Date: Re: Creating an alias
  • Previous by thread: NSBezierPath & different colors
  • Next by thread: Still having table view problems...
  • Index(es):
    • Date
    • Thread