Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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. This routine is only available for Windows.

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:

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