fill_color(3G)
NAME
fill_color, fill_color_index, bf_fill_color, bf_fill_color_index − set color for filled areas on raster devices
SYNOPSIS
C Syntax:
void fill_color ( fildes, red, green, blue );
int fildes;
float red, green, blue;
void fill_color_index ( fildes, index );
int fildes, index;
void bf_fill_color ( fildes, red, green, blue );
int fildes;
float red, green, blue;
void bf_fill_color_index ( fildes, index );
int fildes, index;
FORTRAN77 Syntax:
subroutine fill_color ( fildes, red, green, blue )
integer*4 fildes
real red, green, blue
subroutine fill_color_index ( fildes, index )
integer*4 fildes, index
subroutine bf_fill_color ( fildes, red, green, blue )
integer*4 fildes
real red, green, blue
subroutine bf_fill_color_index ( fildes, index )
integer*4 fildes, index
Pascal Syntax:
procedure fill_color ( fildes:integer; red, green, blue:real );
procedure fill_color_index ( fildes, index:integer );
procedure bf_fill_color ( fildes:integer; red, green, blue:real );
procedure bf_fill_color_index ( fildes, index: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, including back-facing elements, 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 back-facing, as well as not-back-facing, elements of subsequent filled areas. Values range from 0.0 to 1.0 where zero indicates minimum color (off) and 1.0 indicates full (maximum) color. Grayscale devices determine intensity by using the equation:
I = 0.30 × red + 0.59 × green + 0.11 × blue
Discussion
Polygonal primitives are filled using the specified attributes when interior_style is set to INT_SOLID, INT_HATCHED, INT_TEXTURE, INT_POINT or INT_OUTLINE. Back-facing polygons use the specified fill color when bf_interior_style is INT_SOLID, INT_OUTLINE, or INT_POINT, and bf_control has been called with the attr parameter set to TRUE(1).
The color of polygon primitives and back-facing polygons depends on:
• The state of the shading parameter as specified by shade_mode which determines whether or not polygon vertices are processed with the light source equations.
• Coord, use, and normals parameters as specified by vertex_format which determines whether or not to use colors and/or normals supplied with each vertex. Lighting calculations for back-facing polygons will ignore any colors supplied with each vertex and use the back-face polygon fill color instead.
If shading is FALSE and use is 0:
When the fill color or back-face 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 (specified by fill_dither) is 1, the color table is searched for the closest approximation to the specified color when fill_color or bf_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 (specified by fill_dither) 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 or bf_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. Note: Each color map search takes time. Therefore, the more colors requested in fill_dither, the longer each fill_color or bf_fill_color call will take.
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 (specified by fill_dither) 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 an exact index, dithering is used if colors (specified by fill_dither) is greater than one.
When in CMAP_NORMAL mode, fill_color_index is faster than fill_color and bf_fill_color_index is faster than bf_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 or bf_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.
For texture mapped polygon color, fill_color must be set to a non black value for the texture map to be visible. fill_color may set as a reflectance coefficient, where white is full intensity of the existing texture map color.
The color of back-facing polygons is also set by the backface_control procedure. The last color specified by either backface_control or bf_fill_color will be the color used.
DEFAULTS
Front-facing and back-facing color index defaults to 1. Note that device-dependent dithering is not supported for colors specified by an index.
SEE ALSO
Starbase Reference: backface_control(3G), bf_control(3G), define_color_table(3G), fill_dither(3G), interior_style(3G), light_model(3G), polygon(3G), rectangle(3G), shade_mode(3G), vertex_format(3G).
Starbase Graphics Techniques.
Hewlett-Packard Company — November 03, 1994