Syntax
[C/C++:]
void gDefineRGB(int col, float red, float green, float blue);
[F90:]
subroutine gDefineRGB(col, red, green, blue)
integer, intent(in) :: col
real, intent(in) :: red,green,blue
Arguments
col
Colour index
|
> 0, |
Index up to device capability |
red
Red intensity, 0.0 to 1.0
green
Green intensity, 0.0 to 1.0
blue
Blue intensity, 0.0 to 1.0
Description
The routine gDefineRGB() redefines the colour and intensity identified by
col in terms of red, green, blue intensities.
col=0 identifies the background colour. gDefineRGB() has no effect if the device does not allow variations of colour or intensity or if
col is out of range for the device.
red,
green and
blue are clipped to the range 0.0 to 1.0 If any value is clipped a warning message is output.
The action of gDefineRGB() depends on the colour capabilities of the device and whether gSetColourInfo() has been called. The default action is for gDefineRGB() to set a colour definition into a table indexed by
col ready for being selected by the routine gSetLineColour().  If the device is operating in 24-bit direct-colour mode however, gDefineRGB() changes the values of a pseudo palette from which RGB values are extracted if colour indices are used in gSetLineColour().
When using gDefineRGB() to change the colour of the background (col = 0) on static or true/direct colour devices, note that the colour change only takes effect at the next call to gNewDrawing() when the background is refreshed.
Note that communication of colour values, to all devices, is done using the RGB system. All other colour coordinate systems are converted to the RGB system. Setting
col <0 stores the
red,
green and
blue values but does not transmit them to the device.
Devices with colour tables set the values in the table to a default set of colours at initialization (see gSetLineColour()), however gDefineRGB() can be used as a device qualifying routine (i.e. called before any drawing routine) to change the table before initialization and thus preventing the screen from flashing when changing from one colour to another.
See Also
gDefineRGB UsagegEnqColourInfogSetColourInfogSetLineColour