Creating a Color Meter Using Cocoa
Subject:   Extending ColorMeter
Date:   2001-12-27 02:47:04
From:   michele
I've tried to extend Color meter as suggested at the end of the article, just creating an action in InterfaceBuilder getColor and coding it as follows:

- (IBAction)getColor:(id)sender
// Retrieves the color sent by the color well and transformed to RGB name space
NSColor *aColor = [[sender color] colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
redValue = [aColor redComponent];
[redField setFloatValue: redValue];
[redSlider setFloatValue: redValue];
greenValue = [aColor greenComponent];
[greenField setFloatValue: greenValue];
[greenSlider setFloatValue: greenValue];
blueValue = [aColor blueComponent];
[blueField setFloatValue: blueValue];
[blueSlider setFloatValue: blueValue];
alphaValue = [aColor alphaComponent];
[alphaField setFloatValue: alphaValue];
[alphaSlider setFloatValue: alphaValue];

It works fine except that there is no alpha channel. I've tried to use setIgnoresAlpha, but I don't understand how to call it.

Any hint?

Thank in advance,