1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
[Author]
[Introduction]
[fli_map_next_color()]
[Example]
[Caveats]
[Author]
@C4@i@lAuthor
Karel Kubat (karel@icce.rug.nl)
[Introduction]
@C4@i@lIntroduction
The function fli_map_next_color() works like fl_mapcolor(), except that the
function first searches for an already existing color definition. If no color
of the definition is found, a new color is defined in the `free color' range.
[fli_map_next_color()]
@C4@i@lfli_map_next_color()
@iFunction prototype
int fli_map_next_color (int r, int g, int b);
@iArguments
int r, g, b: red/green/blue components of color to map
@iReturn value:
>= 0 : index of mapped color
< 0 : no more empty slots in color table
[Example]
@C4@i@lExample
/* RGB components of the color*/
extern int
red, green, blue;
/* index of new color */
int
newcol;
/* hypothetical error() function to quit program, a-la printf() */
extern void error (char const *fmt, ...);
if ( (newcol = fli_lookup_color (colorname, &red, &green, &blue)) < 0 )
error ("failed to define new color: out of colors");
[Caveats]
@C4@i@lCaveats
The function fli_map_next_color() relies on the fact that unused entries in
the colormap are initially all white (255/255/255). This may vary in
implementations of XForms.
|