FILL_COLOR(3G)
NAME
fill_color − set the color table index or color value for subsequent filled (polygon) areas on raster devices.
SYNOPSIS
C SYNTAX
void fill_color_index(fildes,index);
int fildes,index;
void fill_color(fildes,red,green,blue);
int fildes;
float red,green,blue;
void fill_dither(fildes,colors);
int fildes,colors;
FORTRAN77 SYNTAX
subroutine fill_color_index(fildes,index)
integer*4 fildes,index
subroutine fill_color(fildes,red,green,blue)
integer*4 fildes
real red,green,blue
subroutine fill_dither(fildes,colors)
integer*4 fildes,colors
PASCAL SYNTAX
procedure fill_color_index(fildes,index:integer);
procedure fill_color(fildes:integer;red,green,blue:real);
procedure fill_dither(fildes,colors:integer);
HP-UX COMPATIBILITY
Level: HP-UX/STANDARD
Origin: ANSI Computer Graphics Interface
DESCRIPTION
INPUT PARAMETERS
fildes
is an integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
index
is an integer index into the color table. The fill color for subsequent fill primitives will be the color in that location in the color table. Use the inquire_sizes procedure to find the number of colors table entries available with a specific device.
red, green, blue
are the components of the color for subsequent filled areas (in the range of 0.0 to 1.0). Zero indicates no color and one (1.0) indicates full color. Monochrome devices use the equation I=0.30*red+0.59*green+0.11*blue to determine the intensity.
colors
is the number of colors to be searched for and placed in the dither cell. Only 1, 2, 4, 8 and 16 are allowed. Devices may limit the number of options implemented for this parameter depending on device capabilities.
DISCUSSION
Polygons and rectangles will be filled by the color specified when interior_style is INT_SOLID.
Dithering is a method that allows more fill colors to be generated than colors in the color table. This method depends on the human eye to average the individual colors in a 4 by 4 pixel cell into the desired color. Areas are filled by replicating the dither cell throughout the region defined by the polygonal boundaries.
If colors is 1 then the color table is searched looking for the closest color when fill_color is called and that one index is placed 16 times in the dither cell. If colors is 2 then the color table is searched looking for 2 indexes that when combined in a 50% mixture will be closest to the color specified when fill color is called. If colors is 16 then the color table is searched looking for 16 indexes that when combined come closest to the color requested. It would be unlikely that the indexes would all be different in the case colors is 16.
For example given a monochrome device and colors=16 then fill_color is called with red=0.5, green=0.23, and blue=0.8. The intensity would be calculated 0.30*0.5+0.59*0.23+0.11*0.8=0.374 then the color table (which contains two entries) would be searched 16 times and the resultant dither cell would contain the index 0 (black) 10 times and index 1 (white) 6 times.
If there is a duplicate color in the color table, the algorithm will always select the lowest numbered index.
Fill_color_index is more efficient than fill_color because of the time needed to search for the closest color to the desired color.
The advantage of using fewer colors in the dither cell is the smaller amount of time it takes to search through the color table. The disadvantage is the resulting color may be farther away from the color specified.
DEFAULTS
Color index 1, device dependent dithering for colors not specified with an index.
SEE ALSO
define_color_table(3g), interior_style(3g), polygon(3g), rectangle(3g).
Hewlett-Packard Company — May 11, 2021