• 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: Extracting Color components from NSColorWell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extracting Color components from NSColorWell


  • Subject: Re: Extracting Color components from NSColorWell
  • From: Ali Ozer <email@hidden>
  • Date: Tue, 24 Jan 2006 23:25:19 -0800

NSColorWell is the control; the color value is stored in an NSColor, which you can get with -[NSColorWell color].

Note that even then you can't just send redComponent to an arbitrary color, since redComponent makes sense only for colors in RGB colorspaces. So you need to do something like [[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] redComponent]. Note that [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] might return nil if the color in question cannot be converted to RGB; this might happen if it was a pattern color, for instance.

Ali





Begin forwarded message:

From: Jeremy Hubbell <email@hidden>
Date: January 24, 2006 20:47:22 PST
To: email@hidden
Subject: Extracting Color components from NSColorWell

I'm attempting to do a simple R, G, and B value extraction on an NSColorWell object. Basically, right now, I can get the the values sent to NSLog now as a group of values on a single line (RGBA) but I'd like to grab each value individually and store them separately. Is there a method on NSColorWell that I'm missing here? Using the redComponent method throws an exception in the log. I'm sure I'm just missing something simple here (and I'm a bit of a noob if you couldn't tell already) but if anyone knows a simple way to do this, I'd appreciate the help.

Thanks.

-Jh

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Extracting Color components from NSColorWell (From: Jeremy Hubbell <email@hidden>)

  • Prev by Date: Re: KVC with an path, AppleScript and InterfaceBuilder
  • Next by Date: Re: TextView Autoresizing Mask problems
  • Previous by thread: Extracting Color components from NSColorWell
  • Next by thread: Memory leak finder....
  • Index(es):
    • Date
    • Thread