Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color in Cocoa



On Saturday, December 29, 2001, at 03:00 PM, Alexander Dvorak wrote:

> In working through many of the tutorials on the web
> and in Learning Cocoa, I have learned how to change
> the color to redColor, blueColor, blackColor, etc.
>
> But how do you set the RGB and alpha values directly
> in code (not using the colorwell)? I looked in the
> NSColor.h file, but do not see any calls like that or
> even a structure for NSColor objects.

All of these are near the top of the file:

+ (NSColor *)colorWithCalibratedWhite:(float)white alpha:(float)alpha;
+ (NSColor *)colorWithCalibratedHue:(float)hue
saturation:(float)saturation brightness:(float)brightness
alpha:(float)alpha;
+ (NSColor *)colorWithCalibratedRed:(float)red
green:(float)green blue:(float)blue alpha:(float)alpha;
+ (NSColor *)colorWithDeviceWhite:(float)white alpha:(float)alpha;
+ (NSColor *)colorWithDeviceHue:(float)hue
saturation:(float)saturation brightness:(float)brightness
alpha:(float)alpha;
+ (NSColor *)colorWithDeviceRed:(float)red green:(float)green
blue:(float)blue alpha:(float)alpha;
+ (NSColor *)colorWithDeviceCyan:(float)cyan
magenta:(float)magenta yellow:(float)yellow black:(float)black
alpha:(float)alpha;

-jcr


"These kids today don't know the simple joy of saving four bytes
of page-0 memory on a 6502" - unknown


References: 
 >Color in Cocoa (From: Alexander Dvorak <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.