Color in Cocoa
Color in Cocoa
- Subject: Color in Cocoa
- From: Alexander Dvorak <email@hidden>
- Date: Sat, 29 Dec 2001 15:00:57 -0800 (PST)
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 the calls
seem to return the values rather than set them. If I
knew that NSColor was defined as having "red","green",
"blue", and "alpha" short variables (for example),
then I could set them a la
NSColor color;
color.blue = 3000;
color.red = 1500;
etc.
The only hint I had at more complex colors was on page
346 of Learning Cocoa where CGContexts are mentioned.
Here there is a call to CGContextSetRGBFillColor().
This supposedly would do what I want, but do I have to
create a context to get access to "millions" of
colors? If I am trying to draw a colorful mandelbrot
set, could contexts be the best way for me to draw
them?
Any suggestions would be helpful. Thank you.
Alexander
Send your FREE holiday greetings online!
http://greetings.yahoo.com