RGB Function

Purpose

Returns a single color value from a set of red, green, and blue color components.

Syntax

x% = RGB( r, g, b)

x% : iexp
r, g, b : iexp

Description

Specifies the intensity of the red, green, and blue color components. The values can range from 0 to 255. Zero is the minimum color intensity; 255 is the maximum colour intensity.

RGB doesn't perform overflow checking. For instance, the value 256 is converted to 1.

Example

OpenW 1

Local col%

Line 10, 10, 10, 150

Auto

col% = RGB(150, 150, 150)

Color col%

Circle 30, 30, 100

Color RGB(-3, 510, -10)

Circle 100, 100, 150

Remarks

The other function to create a RGB color value _RGB() clips the passed values to the range 0 .. 255. Wrong values are corrected automatically. For instance, the value 257 is set to 255, and for negative values the colour value is rounded to zero.

RGB() is a bit faster, but doesn't perform overflow checking. Incrementing the color value will not result in an end color of white (255, 255, 255) like _RGB().

Another way to create the RGB value is by using the function MakeL3L().

See Also

_RGB, RGBColor, Color, RGBPoint

{Created by Sjouke Hamstra; Last updated: 22/10/2014 by James Gaite}