Set Color


 

Purpose

The Set Color function changes the color to be used when rendering geometric primitives with the draw functions.

 

Syntax

Opcode format Opcode

[ASCII] (Hex)

Operand Format Comments
Single-byte, readable operand [C] (43) [<ws>]<IIndex> Specifies an indexed color.
Single-byte, binary operand [c] (63) <BIndex> Specifies an indexed color.
[Ctrl-C] (03) <BR><BG><BB><BA> Specifies an RGBA color
Extended ASCII (Color <ws><IR>,<IG>,<IB>,<IA>[<ws>]) Specifies an RGBA color.

 

Index The offset in the current color map where the desired color is found; legal values range from 0 (for the first color in the color map) to one less than the number of colors in the current color map (to a maximum value of 255)

R, G, B, A Defines a color by the red, green, blue, and alpha components

 

Details

The Set Color attribute function changes the color that subsequent drawing functions use when rendering primitives. Colors can either be explicitly specified as red, green, blue, or alpha (RGBA) intensity values, or colors can be indirectly specified as an index into a color map.

When directly specifying a color, the legal range for the intensity integers (or bytes) is from 0 (indicating zero intensity) to 255 (indicating full intensity). A zero intensity alpha indicates that this color is totally transparent (not actually drawn) so that the background is unchanged. A full intensity alpha (255) indicates that this color is completely opaque, such that the color fully overwrites its background. Alpha values between 0 and 255 indicate that, when the color is drawn, it is blended to a varying degree with the background color.

When indirectly specifying a color using a color index, a full RGBA color is retrieved from the indexth position in the currently active Color Map, see the Set Color Map function.

 

Notes

In the case where a color index is selected, it is possible that a new color map may be assigned later. In this case, the index might refer to the new color map, rather than to the indexth color in the original color map (depending upon the reading application's behaviour).

In the case that an illegal index is selected (one that is less than zero or exceeds one less than the number of colors in the active color map), the color selected is decided by the file reading application.

Default

The default value for the color attribute is a fully opaque "white" which is the equivalent of executing the following opcode:

(Color 255,255,255,255)

 

Implementation in WHIP! Versions

Toolkit Function

TBD

Partial

Full

Revised in

Set Color

-

-

8 bit colors

1.03

-

 

 

See Also

Set Color Map