• 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: Drawing gradients in views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing gradients in views


  • Subject: Re: Drawing gradients in views
  • From: "Ian G. Gillespie" <email@hidden>
  • Date: Tue, 28 Jan 2003 14:17:43 -0800

Hi,

I tried using the methods sent and I get this error:

-redComponent not defined for the NSColor NSCalibratedWhiteColorSpace 1 1; need to first convert colorspace.

How do I convert colorspace?


On Tuesday, January 28, 2003, at 11:57 AM, Matt Gemmell wrote:

On Tuesday, January 28, 2003, at 05:11 pm, Ian G. Gillespie wrote:

Excuse my ignorance (I am still learning, that is for sure), but how do I add a method to the NSBezierPath "category"?

Hi Ian,

A "category" is a way to add methods to an existing class. He's suggesting that you create a category on NSBezierPath (i.e. create a category which adds a method to NSBezierPath). The enclosed files should work. Just add them to your project, and put this line at the top of any file you'll be calling the method from:

#import "NSBezierPath+YourExtensions.h"

and then you can call the method like this:

[NSBezierPath drawGradientInRect:yourRect
startColor:[NSColor yellowColor]
endColor:[NSColor greenColor]];

Note: I haven't checked to see whether the method does what it says it does, but the above is indeed how to add a category to an existing class.

Cheers,
-Matt
<NSBezierPath+YourExtensions.h><NSBezierPath+YourExtensions.m>
--
Matt Gemmell
Scotland Software
http://www.scotlandsoftware.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.

  • Follow-Ups:
    • Re: Drawing gradients in views
      • From: Christopher Holland <email@hidden>
    • Re: Drawing gradients in views
      • From: Matt Gemmell <email@hidden>
  • Prev by Date: Re: Setting the Default Browser?
  • Next by Date: Re: Setting the Default Browser?
  • Previous by thread: Re: Drawing gradients in views
  • Next by thread: Re: Drawing gradients in views
  • Index(es):
    • Date
    • Thread