Typedefs | |
| typedef unsigned | Color |
Enumerations | |
| enum | { NO_COLOR, FREE_COLOR, NUM_FREE_COLOR, GRAY00, GRAY05, GRAY10, GRAY15, GRAY20, GRAY25, GRAY30, GRAY33, GRAY35, GRAY40, GRAY45, GRAY50, GRAY55, GRAY60, GRAY65, GRAY66, GRAY70, GRAY75, GRAY80, GRAY85, GRAY90, GRAY95, GRAY99, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, DARK_RED, DARK_GREEN, DARK_YELLOW, DARK_BLUE, DARK_MAGENTA, DARK_CYAN, WINDOWS_BLUE } |
Functions | |
| Color | color (unsigned char r, unsigned char g, unsigned char b) |
| Color | color (unsigned char g) |
| Color | color (const char *) |
| Color | parsecolor (const char *, unsigned length) |
| Color | lerp (Color c0, Color c1, float f) |
| Color | inactive (Color) |
| Color | inactive (Color, Flags f) |
| Color | contrast (Color fg, Color bg) |
| void | split_color (Color c, unsigned char &r, unsigned char &g, unsigned char &b) |
| void | set_color_index (Color index, Color) |
| Color | get_color_index (Color index) |
| void | set_background (Color) |
| Color | nearest_index (Color) |
|
|
Color is a typedef for a 32-bit integer containing r,g,b bytes and an "index" in the lowest byte (the first byte on a little-endian machine such as an x86). For instance 0xFF008000 is 255 red, zero green, and 128 blue. If rgb are not zero then the low byte is ignored, or may be treated as "alpha" by some code. If the rgb is zero, the N is the color "index". This index is used to look up an Color in an internal table of 255 colors shown here. All the indexed colors may be changed by using set_color_index(). However fltk uses the ones between 32 and 255 and assummes they are not changed from their default values.
A Color of zero (NO_COLOR) will draw black but is ambiguous. It is returned as an error value or to indicate portions of a Style that should be inherited, and it is also used as the default label color for everything so that changing color zero can be used by the -fg switch. You should use BLACK (56) to get black. |
|
|
Symbolic names for some of the indexed colors. The 24-entry "gray ramp" is modified by set_background() so that the color GRAY75 is the background color, and the others are a nice range from black to white. These are used to draw box edges. The gray levels are chosen to be evenly spaced, listed here is the actual 8-bit and decimal gray level assigned by default. Also listed here is the letter used for FrameBox and the old fltk1.1 names used for these levels. The remiander of the colormap is a 5x8x5 color cube. This cube is used to dither images on 8-bit screens X colormaps to reduce the number of colors used.
|
|
|
Turn a string into a color. If name is null this returns NO_COLOR. Otherwise it returns parsecolor(name, strlen(name)). |
| ||||||||||||
|
Returns fg if fltk decides it can be seen well when drawn against bg. Otherwise it returns either BLACK or WHITE. |
|
|
Return the rgb form of color. If it is an indexed color that entry is returned. If it is an rgb color it is returned unchanged. |
| ||||||||||||
|
Same as (f&INACTIVE_R) ? inactive(c) : c |
|
|
Same as lerp(c, GRAY75, .7), it grays out the color. |
| ||||||||||||||||
|
Return (1-weight)*color0 + weight*color1. weight is clamped to the 0-1 range before use. |
|
|
Find an indexed color in the range 56-127 that is closest to this color. If this is an indexed color it is returned unchanged. |
| ||||||||||||
|
Turn the first n bytes of name into an fltk color. This allows you to parse a color out of the middle of a string. Recognized values are:
|
|
|
GRAY75 is replaced with the passed color, and all the other GRAY* colors are replaced with a color ramp (or sometimes a straight line) so that using them for highlighted edges of raised buttons looks correct. |
| ||||||||||||
|
Set one of the indexed colors to the given rgb color. i must be in the range 0-255, and c must be a non-indexed rgb color. |
| ||||||||||||||||||||
|
Set r,g,b to the 8-bit components of this color. If it is an indexed color they are looked up in the table, otherwise they are simply copied out of the color number. |
©2006 Bill Spitzak
and others.