next up previous contents index
Next: Coordinates and Transformations Up: The Output Attributes Previous: Specifying Text

Specifying Colour

Colour is specified separately for each primitive type by a colour index value.

Polyline
CALL GSPLCI(PLCI)
Polymarker
CALL GSPMCI(PMCI)
Text
CALL GSTXCI(TXCI)
Fill Area
CALL GSFACI(FACI)
The colour index, instead of defining a colour directly, points to an entry in a colour look-up table which is workstation-dependent. If the colour is an attribute of a primitive, then one can specify a colour index either as an individual attribute or as part of a bundle table. The size of the colour table is workstation-dependent, but the table always contains the entries 0 and 1. The background colour is 0, and the default foreground colour is 1. Each entry greater than 1 defines an additional foreground colour. If a colour index greater than the maximum is specified, then the default value 1 is taken, which ensures that a program written using colour will run on a monochrome device.

To set entries in the colour look-up table one must call the function Set Colour Representation (GSCR). It takes as parameters the workstation identifier, the colour index to be set, and a value (from 0 to 1.0) for each of the red, blue, and green intensities. The workstation then uses the closest available colour to that which has been requested.

CALL GSCR(WKID, INDEX, RED, GREEN, BLUE)

The highest possible value for the colour index (NCOLI) depends on the capabilities of the device and can be inquired using GQCF and specifying the workstation type:

CALL GQCF(WTYPE, ERRIND, NCOLI, COLA, NPCI)
The parameter COLA ('GMONOC' or 'GCOLOR') indicates whether or not colour is available, and NPCI specifies the number of pre-defined colour indices.

The colour index can also be used if part of a previously drawn picture is to be erased. The part to be erased should be re-drawn in the background colour (index=0). All other attribute settings and transformations must be exactly as they where when the picture was produced initially. However, even in this case, the trick may not work if the primitive being erased overlays another primitive, and not just the background.

Colour may be part of a fill area pattern, in which case different parts of the pattern may be defined to be different colours. For the cell array primitive an array of colours is specified as part of the primitive itself.


next up previous contents index
Next: Coordinates and Transformations Up: The Output Attributes Previous: Specifying Text


Janne Saarela
Mon Apr 3 17:00:12 METDST 1995