Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

COLOUR(7P)  —  Kubota Pacfic Computer Inc. (29 February 1991)

NAME

COLOUR − introduction to using colour in the PEX-SI

DESCRIPTION

This page provides an overview of using the capabilities of a colour system from the PHIGS API to PEX.  The topics covered are:

•  Standard PHIGS: Indexed Colour
•  PHIGS+: General Colour
•  Setting a Workstation’s Colour Table
•  How Colour Maps Are Set Up

Standard PHIGS: Indexed Colour

Standard PHIGS supports only indexed colour. Structure elements select a colour for a primitive by using an integer colour index, such as that selected by SET POLYLINE COLOUR INDEX(3P).  When a primitive is displayed on a workstation, the colour index is used to select a colour value (called a colour representation) from the workstation’s colour table.  The colour representation is what is actually seen by the observer.  The default colour index for all primitives is 1. 

PHIGS PLUS: General Colour

PHIGS PLUS allows the specification  of colour either as indexed colours, or as RGB colours directly.  When a colour is specified as an index, it is called indirect colour, since the colours are indirectly specified through the workstation colour table.  When a colour is specified as an RGB triple, it is called direct colour.  General colour is an abstraction that allows colour or direct colour to be specified as a single aspect.  A general colour consists of a type and a value.  If the type is indirect, then the value is interpreted as an index into the workstation colour table.  If the type RGB, then the value is interpreted as an RGB value.  In addition to RGB type, PHIGS+ allows specification of direct color in other types, for example HLS, HSV and CIELUV. In the PEX-SI, however, only the type RGB is allowed. 

Using the PEX-SI primitives and attributes, the colour for a primitive can be set using either attribute elements, such as SET POLYLINE COLOUR (3P+), or primitives with one or more colours as part of the primitive, such as POLYLINE SET 3 WITH DATA (3P+).  In either case, the colour is specified as a general colour, so that an index or direct colour can be used.  This functionality supercedes the standard PHIGS functionality.  Standard PHIGS primitives will be rendered using the PHIGS+ attributes, and standard PHIGS attributes affect PHIGS+ primitives. For example, SET POLYLINE COLOUR INDEX(3P) is equivalent to calling SET POLYLINE COLOUR(3P+) with the type set to indirect, both elements set the same attribute.  The default colour for all primitives is indirect colour, index 1.  If a primitive or attribute specifies direct colour on an indexed colour workstation, then indirect colour, index 1 is used instead. 

Setting a Workstation’s Colour Table

In PHIGS, an application can use the function SET COLOUR REPRESENTATION to specify a colour representation by a triple of real values whose meaning depends on the current colour model.  PEX-SI supports only the RGB colour model.  The colour coordinate space is [0,1] in all three dimensions.  No intensity is 0.0 and is mapped to X11 colour value 0.  Maximum intensity is 1.0  and is mapped to X11 colour value 65535.  The RGB values for the default colour definitions are given above. 

A change to a colour representation will show up during the next regeneration. 

A PHIGS application can inquire for any colour index, either the value it sets into the workstation’s colour table or the values that will be Realized on the display, after mapping to available X11 colour values.  See INQUIRE COLOUR REPRESENTATION (3P). 

Other colour models PHIGS+ defines are CIE (Commission Internationale de l’Eclairage’s universal colour definition system), HSV (Hue, Saturation, and Value), and HLS (Hue, Lightness, and Saturation). 

Colour representations 0 and 1 can be set on a monochrome workstation, to produce either normal or inverse video. 

How Colormaps Are Set Up

The API tries to manage PEX colour and colour approximation lookup tables and X colormaps when implementing the PHIGS colourmap.  Ideally, you should take the following steps before creating a window:

1.Find the most appropriate visual. 

2.See if there is a StandardColormap property defined on that visual. 

3.Set up the colormap on that visual or use an existing colormap. 

However, X doesn’t provide a mechanism by which StandardColormap properties can be queried on an individual visual class if a window on that visual doesn’t exist. Therefore, heursitics are used heavily to determine this. The following process takes place. 

1.If the workstation is of type x_tool, determine the “best” visual for PEX and open the window on that visual. The best visual is the avaiable visual with the largest colormap size and the highest numbered class (DirectColor > TrueColor > PseudoColor > StaticColor).  As an attempt to cut down on colormap flashing, the default visual is used if it has a StandardColormap with at least the same number of entries as the best visual. 

If the workstation is of type x_drawable, it is the application’s responsibility to determine the most appropriate visual and open up the window on that visual. 

An error is returned if a read-only visual with no StandardColormaps defined is available. 

2.The StandardColormap’s colorcube is used if it is large enough to hold a 5/9/5 colorcube for an 8-bit display. The characteristics of the StandardColormap are set in the workstation’s ColourApprox lookup table. 

If there is no StandardColormap defined, an attempt is made to define a contiguous colormap in the existing colormap using XallocColorCells().  If this fails, than a new colormap is created. In either case, the colormap is filled with the appropriate entries and the ColorApprox lookup table is set.  The colorcube is set up to use about the same percentage of the colormap that a 5/9/5 colorcube uses of a 256 entry colormap (about 85%). For example, a 7/14/7 colorcube is used in a colormap which has 1024 entries. 

SEE ALSO

INQUIRE COLOUR FACILITIES (3P)
INQUIRE COLOUR MODEL FACILITIES (3P)
INQUIRE DIRECT COLOUR MODEL FACILITIES (3P+)
SET COLOUR MODEL (3P)
SET COLOUR REPRESENTATION (3P)
INQUIRE COLOUR REPRESENTATION (3P)
INQUIRE PREDEFINED COLOUR REPRESENTATION (3P)
SET POLYLINE COLOUR INDEX (3P)
SET POLYLINE COLOUR (3P+)

BUGS

The PHIGS standard uses the “international” (in other words, British) spelling of “colour.” X11 and American usage spell “colormap” without the “u.”
 
 

September 02, 1992

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