Intel® Fortran Compiler 17.0 Developer Guide and Reference

RGBTOINTEGER (W*S)

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 IFQWIN

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 type is 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:

RGB value's internal structure

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

Example

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

See Also