The COLOR_CONVERT procedure converts colors to and from the RGB (Red Green Blue), HLS (Hue Lightness Saturation), and HSV (Hue Saturation Value) color systems. A keyword parameter indicates the type of conversion to be performed (one of the keywords must be specified). The first three parameters contain the input color triple(s) which may be scalars or arrays of the same size. The result is returned in the last three parameters, O0, O1, and O2. RGB values are bytes in the range 0 to 255.
Hue is measured in degrees, from 0 to 360. Saturation, Lightness, and Value are floating-point numbers in the range 0 to 1. A Hue of 0 degrees is the color red. Green is 120 degrees. Blue is 240 degrees. A reference containing a discussion of the various color systems is: Foley and Van Dam, Fundamentals of Interactive Computer Graphics, Addison-Wesley Publishing Co., 1982.
COLOR_CONVERT, I0, I1, I2, O0, O1, O2 {, /HLS_RGB | , /HSV_RGB | , /RGB_HLS | , /RGB_HSV}
The input color triple(s). These arguments may be either scalars or arrays of the same length.
The variables to receive the result. Their structure is copied from the input parameters.
Set this keyword to convert from HLS to RGB.
Set this keyword to convert from HSV to RGB.
Set this keyword to convert from RGB to HLS.
Set this keyword to convert from RGB to HSV.
The command:
COLOR_CONVERT, 255, 255, 0, h, s, v, /RGB_HSV
converts the RGB color triple (255, 255, 0), which is the color yellow at full intensity and saturation, to the HSV system. The resulting hue in the variable h is 60.0 degrees. The saturation and value, s and v, are set to 1.0.
Introduced: Pre 4.0