Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

inquire_color_table(3G)

inquire_size(3G)

inquire_display_mode(3G)

shade_mode(3G)

shade_range(3G)

define_color_table(3G)

NAME

define_color_table − set the color values in the device color table

SYNOPSIS

C Syntax:

void define_color_table(fildes,start,count,colors);
int fildes,start,count;
float colors[][3];

FORTRAN77 Syntax:

subroutine define_color_table(fildes,start,count,colors)
integer∗4 fildes,start,count
real colors(3,count)

Pascal Syntax:

type

rgb_color=array[1..3]of real;

procedure define_color_table(fildes,start,count:integer; var colors array:[lo..hi:integer] of rgb_color);

DESCRIPTION

Input Parameters

fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened. 

start Integer index into the color table at which to start the color table update. 

count Integer number of color table entries to be updated. 

colors New red, green, and blue values for each color table entry (floating-point values in the range of 0 to 1, where 1 is full intensity).  In C terminology-
 

color_table[start][0]=colors[0][0];  /* red */
color_table[start][1]=colors[0][1];  /* green */
color_table[start][2]=colors[0][2];  /* blue */
 ...
color_table[start+count-1][2] = colors[count-1][2]

 

Discussion

Each file descriptor opened as an output device has a color table.  When this procedure is called, the color table and the device’s color map are updated.  If multiple file descriptors are open to the same device, the color table and the device’s color map may not always be identical (the color map may have been modified by a previous call).  For Starbase procedures that have red, green and blue parameters, in CMAP_NORMAL mode the closest color is searched for in the color table (not the color map), or in CMAP_FULL and CMAP_MONOTONIC modes the color is calculated in red, green and blue values (limited by hardware configuration). See shade_mode. 

Grayscale devices will convert all RGB values into a grayscale intensity using the formula:
         I = 0.30 ∗ red + 0.59 ∗ green + 0.11 ∗ blue The R, G, and B entries in the colormap will be updated with this intensity.
Some device drivers have a gescape (READ_COLOR_MAP) that reads the current color map into the color table.  See the appropriate device driver description for more information. 

For devices that support 12 bit indexing, the current color table can be either an 8 bit or a 12 bit color table ( set by double_buffer ).  The respective color table values set by define_color_table will be those for the table which is currently active depending on the current indexing mode (e.g., 8 bit color table values set when in 8 bit indexing mode, 12 bit color table values set in 12 bit indexing mode). 

For multibank graphics devices:

16 Planes Each bank of 8 has the same color map. 

24 Planes If the mode parameter of shade_mode is set to CMAP_FULL, when the color table is written, the blue entries are the intensities in bank 1, the green are in bank 2, and the red are in bank 3.  If the device supports 12 bit indexing and is currently in 12 bit indexing mode, then the 12 bit color table values are set.  Otherwise the device appears to be a standard 8-plane graphics device. 

Multibank graphics devices that support video blending may allow separate color map definitions for different banks. See the Starbase Device Drivers Library Manual for details. 

See the Starbase Graphics Techniques chapter, Programming in X11, for more information about using this function with windows. 

If double buffering is enabled, set CMAP in both buffers based on the number of planes returned. 

DEFAULTS

All color maps are device-dependent. 

SEE ALSO

inquire_color_table(3G), inquire_size(3G), inquire_display_mode(3G), shade_mode(3G), shade_range(3G), Starbase Device Drivers Library Manual, Starbase Graphics Techniques Concepts and Tutorials. 

Hewlett-Packard Company  —  HP-UX Release 9.03: April 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026