• 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: Matt Gemmell <email@hidden>
  • Date: Wed, 29 Jan 2003 02:01:39 +0000

On Tuesday, January 28, 2003, at 10:17 pm, Ian G. Gillespie wrote:

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

How do I convert colorspace?

Hi again Ian,

When you encounter an error, it's a good idea to look at the documentation pages for the classes which are mentioned in the error; in this case, NSColor. Looking through the NSColor reference page, you'll notice this instance method:

- (NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace

It converts a color into a specified colorspace. Again looking through the NSColor docs, you'll notice a link to a section of the docs called "Using Color", the first subsection of which is "About Color Spaces". This section lists the possible colorspaces you can specify. In this case, since the method code tries to access the red, green and blue components of a color, you probably want to use an RGB colorspace, specifically "NSCalibratedRGBColorSpace". So, you'd convert your color like this:

[[NSColor whiteColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]


Best,
-Matt

--
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.

References: 
 >Re: Drawing gradients in views (From: "Ian G. Gillespie" <email@hidden>)

  • Prev by Date: Re: [loading 16-bit png,psd|loading tiff from stdout]
  • Next by Date: changing NSMenuItem's state image
  • Previous by thread: Re: Drawing gradients in views
  • Next by thread: Re: Drawing gradients in views
  • Index(es):
    • Date
    • Thread