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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

SETPIXEL, SETPIXEL_W

Graphics Functions: Set a pixel at a specified location to the current graphics color index. These routines are only available for Windows.

Module

USE IFQWIN

result = SETPIXEL (x,y)

result = SETPIXEL_W (wx, wy)

x, y

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

wx, wy

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

Results

The result type is INTEGER(2). The result is the previous color index of the target pixel if successful; otherwise, -1 (for example, if the pixel lies outside the clipping region).

SETPIXEL sets the specified pixel to the current graphics color index. The current graphics color index is set with SETCOLOR and retrieved with GETCOLOR. The non-RGB color functions (such as SETCOLOR and SETPIXELS) 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 Red-Green-Blue (RGB) value with an RGB color function, rather than a palette index with a non-RGB color function. SETPIXELRGB and SETPIXELRGB_W give access to the full color capacity of the system by using direct color values rather than indexes to a palette.

NOTE:

The SETPIXEL routine described here is a QuickWin routine. If you are trying to use the Microsoft* Platform SDK version of the SetPixel routine by including the IFWIN module, you need to specify the routine name as MSFWIN$SetPixel.

Example

 ! Build as a Graphics ap.
 USE IFQWIN
 INTEGER(2) status, x, y
 status = SETCOLOR(INT2(2))
 x = 10
 ! Draw pixels.
 DO y = 50, 389, 3
    status = SETPIXEL( x, y )
    x = x + 2
 END DO
 READ (*,*) ! Wait for ENTER to be pressed
 END