advertisement

Article:
  Creating a Color Meter Using Cocoa
Subject:   Color wheel...
Date:   2001-06-20 08:26:02
From:   davidmasters
Response to: Color wheel...

I tried a similar approach, and it does work.



To get the color I converted it to a named color space (to ensure I could then get the red, green, blue values), and then used getRed:green:blue:alpha to extract the individual values.


Can someone confirm if this is the right approach?



NSColor *aColor = [[sender color] colorUsingColorSpaceName:@"NSDeviceRGBColorSpace"];


[aColor getRed:&redValue green:&greenValue blue:&blueValue alpha:&alphaValue];


Remember to use & when passing these parameters - you have floats, the method is expecting float *.



After that, just set the floatValue of the sliders and text fields, and everything should work.


David


1 to 1 of 1
  1. Color wheel...
    2001-06-20 10:40:23  rainwadj [View]

    • Color wheel...
      2001-06-20 11:39:04  johnts [View]

      • Color wheel...
        2001-06-20 12:50:22  davidmasters [View]

        • Color wheel...
          2001-06-22 09:17:54  donarb [View]

        • Color wheel...
          2001-06-20 19:54:29  johnts [View]

        • Color wheel...
          2001-06-20 19:39:24  johnts [View]

        • Color wheel...
          2001-06-20 19:28:20  johnts [View]

1 to 1 of 1