RGBTOINTEGER

QuickWin Function: Converts three integers specifying red, green, and blue color intensities into a four-byte RGB integer for use with RGB functions and subroutines.

Module: USE DFLIB

Syntax

result = RGBTOINTEGER (red, green, blue)

red
(Input) INTEGER(4). Intensity of the red component of the RGB color value. Only the lower 8 bits of red are used.


green
(Input) INTEGER(4). Intensity of the green component of the RGB color value. Only the lower 8 bits of green are used.


blue
(Input) INTEGER(4). Intensity of the blue component of the RGB color value. Only the lower 8 bits of blue are used.

Results:

The result is of type INTEGER(4). The result is the combined RGB color value.

In each RGB color value, each of the three colors, red, green, and blue, is represented by an eight-bit value (2 hex digits). In the value returned with RGBTOINTEGER, red is the rightmost byte, followed by green and blue. The RGB value's internal structure is as follows:

Larger numbers correspond to stronger color intensity with binary 1111111 (hex FF) the maximum for each of the three components. For example, #0000FF yields full-intensity red, #00FF00 full-intensity green, #FF0000 full-intensity blue, and #FFFFFF full-intensity for all three, resulting in bright white.

Compatibility

QUICKWIN GRAPHICS LIB

See Also: Using QuickWin, INTEGERTORGB, SETCOLORRGB, SETBKCOLORRGB, SETPIXELRGB, SETPIXELSRGB, SETTEXTCOLORRGB

Example

 ! Build as a QuickWin App.
 USE DFLIB
 INTEGER r, g, b, rgb, result
 INTEGER(2) status
 r = #F0
 g = #F0
 b = 0
 rgb = RGBTOINTEGER(r, g, b)
 result = SETCOLORRGB(rgb)
 status = ELLIPSE($GFILLINTERIOR,INT2(40), INT2(55), &
                   INT2(90), INT2(85))
 END