|
fltk::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 fltk::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 (fltk::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 fltk::BLACK (56) to get black. |
|
Symbolic names for some of the indexed colors. The 24-entry "gray ramp" is modified by fltk::set_background() so that the color fltk::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 fltk::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.
|
|
Uses shift and add to make an rgb color out of the 8-bit components. |
|
Makes a gray-scale color using an 8-bit gray level. This is done by multiplying gray by 0x1010100. |
|
Turn a string into a color. On X this uses XParseColor to lookup named colors like "red". On other platforms it only understands colors of the form "n,n,n" or hex strings of 3, 6, 9, or 12 digits. Maybe we should add the standard web color names, there are only 16 of them. |
|
Return (1-weight)*color0 + weight*color1. weight is clamped to the 0-1 range before use. |
|
Same as lerp(c, GRAY75, .7), it grays out the color. |
|
Same as (f&INACTIVE) ? inactive(c) : c |
|
Returns fg if fltk decides it can be seen well when drawn against bg. Otherwise it returns either fltk::BLACK or fltk::WHITE. |
|
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. |
|
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. |
|
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. |
|
fltk::GRAY75 is replaced with the passed color, and all the other fltk::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. |
|
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. |
|
Set the color for all subsequent drawing operations. |
|
Returns the last Color passed to setcolor(). |
|
Set the "background" color. This is not used by the drawing functions, but many box and image types will refer to it by calling getbgcolor(). |
|
Returns the last Color passed to setbgcolor(). To actually draw in the bg color, do this: Color saved = getcolor(); setcolor(getbgcolor()); draw_stuff(); setcolor(saved) |
|
Draw using this style. Set drawstyle() to this, drawflags() to flags, calls setcolor() and setbgcolor() with appropriate colors for this style and the given flags, and calls setfont(). This is called by the draw() methods on most fltk widgets. The calling Widget picks what flags to pass to the Symbols so that when they call this they get the correct colors for each part of the widget. Flags that are understood:
It then further modifies fg so that it contrasts with the bg. |
|
Return the last style sent to drawstyle(s,f). Some drawing functions (such as glyphs) look in this for box types. If this has not been called it is Widget::default_style. |
|
Store a set of bit flags that may influence the drawing of some fltk::Symbol subclasses, such as boxes. Generally you must also use setcolor() and setbgcolor() to set the color you expect as not all symbols draw differently depending on the flags. The flags are usually copied from the flags() on a Widget. Some commonly-used flags:
|
|
Return the last flags passed to setdrawflags(). |
|
Same as (drawflags() & f), returns true if any of the flags in f are set. |
|
Set how to draw lines (the "pen"). If you change this it is your responsibility to set it back to the default with fltk::line_style(0). style is a bitmask in which you 'or' the following values. If you don't specify a dash type you will get a solid line. If you don't specify a cap or join type you will get a system-defined default of whatever value is fastest.
width is the number of pixels thick to draw the lines. Zero results in the system-defined default, which on both X and Windows is somewhat different and nicer than 1. dashes is a pointer to an array of dash lengths, measured in pixels. The first location is how long to draw a solid portion, the next is how long to draw the gap, then the solid, etc. It is terminated with a zero-length entry. A null pointer or a zero-length array results in a solid line. Odd array sizes are not supported and result in undefined behavior. The dashes array is ignored on Windows 95/98. |