Re: Extracting Color components from NSColorWell
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