インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

SETPIXELRGB, SETPIXELRGB_W (W*S)

Graphics Functions: Set a pixel at a specified location to the specified Red-Green-Blue (RGB) color value.

Module

USE IFQWIN

result = SETPIXELRGB (x,y,color)

result = SETPIXELRGB_W (x,y,color)

x, y

(Input) INTEGER(2). Viewport coordinates for target pixel.

wx, wy

(Input) REAL(8). Window coordinates for target pixel.

color

(Input) INTEGER(4). RGB color value to set the pixel to. Range and result depend on the system's display adapter.

Results

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

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 you specify with SETPIXELRGB or SETPIXELRGB_W, 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.

If any of the pixels are outside the clipping region, those pixels are ignored.

SETPIXELRGB (and the other RGB color selection functions such as SETPIXELSRGB, SETCOLORRGB) sets the color to a value chosen from the entire available range. The non-RGB color functions (such as SETPIXELS and SETCOLOR) use color indexes rather than true color values.

If you use color indexes, you are restricted to the colors available in the palette, at most 256. Some display adapters (SVGA and true color) are capable of creating 262,144 (256K) colors or more. To access any available color, you need to specify an explicit RGB value with an RGB color function, rather than a palette index with a non-RGB color function.

Example

 ! Build as a Graphics ap.
 USE IFQWIN
 INTEGER(2) x, y
 INTEGER(4) color
 DO i = 10, 30, 10
   SELECT CASE (i)
     CASE(10)
       color = Z'0000FF'
     CASE(20)
       color = Z'00FF00'
     CASE (30)
       color = Z'FF0000'
   END SELECT
 ! Draw pixels.
   DO y = 50, 180, 2
     status = SETPIXELRGB( x, y, color )
     x      = x + 2
   END DO
 END DO
 READ (*,*) ! Wait for ENTER to be pressed
 END

See Also