FILL_COLOR(3G)
NAME
fill_color − set color table index or color value for filled 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);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
index Integer index into the color table. The fill color for subsequent fill primitives will be the color at that location in the color table. Use inquire_sizes procedure to find the number of color table entries available for a specific device.
red, green, blue Color components used for subsequent filled areas. Values range from 0.0 to 1.0 where zero indicates minimum color (off) and 1.0 indicates full (maximum) color. Monochrome devices determine intensity by using the equation I=0.30*red+0.59*green+0.11*blue.
colors 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 are filled by the specified color when interior_style is INT_SOLID.
Dithering is a method of generating more fill colors than are available in the color table. It uses the human eye’s ability to integrate or blend closely-spaced small pinpoints of color called pixels, each of which can be set to certain predefined colors, into an average color over the entire dither cell. Each dither cell is composed of 16 red-blue-green pixel triples where each triple can be set to certain combinations of color and relative intensity in order to produce the desired dither cell color. For a more extensive explanation of how dithering is achieved, see Starbase Graphics Techniques.
The color of polygon primitives depends on:
• The state of the shading parameter as specified by shade_mode which determines whether or not polygons are sent through light source equations.
• Coord, use, and normals parameters as specified by vertex_format which determines whether or not to use color coordinates supplied with each vertex.
If shading is FALSE and use ==0:
When the fill color is set by use of red-green-blue parameters, determination of actual output depends on the state of the mode parameter set with shade_mode:
CMAP_NORMAL This is the default mode if shade_mode has not been called. If colors is 1, the color table is searched for the closest approximation to the specified color when fill_color is called. When the closest color has been found, the corresponding index value is placed in each of the 16 pixel color index locations in the dither cell. If colors is 2, the color table is searched to find two indexes that, when combined in a 50% mixture, will be closest to the color specified when fill_color is called. Each index value is then copied into eight pixel locations in the dither cell. If colors is 16, the color table is searched for a combination of 16 indexes that, when combined, come closest to the color requested. In this case, it is unlikely that 16 different index values would be used to produce the specified color.
CMAP_MONOTONIC The color values are converted to an intensity value by using the equation: I = 0.30(red) + 0.59(green) + 0.11(blue). This intensity is mapped to an index, using the minimum and maximum limits defined by shade_range. If the intensity does not map to an exact index value, dithering is used between two adjacent indices if colors is greater than one.
CMAP_FULL Color values are mapped directly to an index with the assumption that the color map is set up to a predefined full-color state. If the colors do not map to a exact index, dithering is used if colors is greater than 1.
When in CMAP_NORMAL mode, fill_color_index is faster than fill_color because less time is spent searching for an optimum color match in each dither cell.
Search time can also be shortened by using fewer colors in a dither cell to further shorten color table search time. However, the limited color resolution makes it more difficult to match a given specified color.
For use >0, coord equal to 3, and normals FALSE, fill_color is ignored and the polygon color is determined by extra coordinates given with each vertex. See vertex_format for more information.
For shading TRUE, fill_color is used to set the reflectance coefficient for the light source equations (if no rgb values are provided for each vertex). If an index is given, the color given by the corresponding color table location is used as the reflectance coefficient. See light_model for information about light source equations.
DEFAULTS
Color Index defaults to 1:Device-dependent dithering for colors not specified with an index.
SEE ALSO
backface_control(3G), define_color_table(3G), interior_style(3G), light_model(3G), polygon(3G),
rectangle(3G), shade_mode(3G), vertex_format(3G), Starbase Graphics Techniques.
Hewlett-Packard Company — May 11, 2021