We've expanded our news coverage and improved our search!
for the latest or search for all things across O'Reilly!
Creating a Color Meter Using Cocoa
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:
// 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.
Thank in advance,