Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rgb_to_inde(3G) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

define_color_table(3G)

inquire_color_table(3G)

shade_mode(3G)

rgb_to_index(3G)

NAME

rgb_to_index − find the index of the closest color in the color map

SYNOPSIS

C Syntax:

int rgb_to_index(fildes,red,green,blue)
int fildes;
float red,green,blue;

FORTRAN77 Syntax:

integer*4 function rgb_to_index(fildes,red,green,blue)
integer*4 fildes
real red,green,blue

Pascal Syntax:

function rgb_to_index(fildes:integer;red,green,blue:real):integer;

DESCRIPTION

Input Parameters

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

red,green,blue Color values (in the range of 0.0 to 1.0) of the desired color. 

Discussion

This call searches the color table for the closest color to (red,green,blue) and returns its index.  The distance between colors is defined by the Euclidean metric--see the "Color" Chapter of the Starbase Graphics Techniques; HP-UX Concepts and Tutorials manual for details. 

This routine cannot be used in CMAP_FULL color mapping mode. 

If the color map or double buffer mode is modified, previously returned indices may be invalidated. 

For grayscale devices, the (red, green, blue) values will be transformed to a grayscale intensity using the formula:

 I = 0.30 * red + 0.59 * green + 0.11 * blue
 

before the color table is searched. 

SEE ALSO

define_color_table(3G), inquire_color_table(3G), shade_mode(3G)

Hewlett-Packard Company  —  HP-UX Release 9.10: April 1995

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