SETPIXEL, SETPIXEL_W

Graphics Function: Sets a pixel at a specified location to the current graphics color index.

Module: USE DFLIB

Syntax

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 is of type 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 Win32 SDK version of the SetPixel routine by including the DFWIN module, you need to specify the routine name as MSFWIN$SetPixel. For more information, see Special Naming Convention for Certain QuickWin and Win32 Graphics Routines in the Programmer's Guide.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

See Also: SETPIXELRGB, GETPIXEL, SETPIXELS, GETPIXELS, GETCOLOR, SETCOLOR

Example

 ! Build as a Graphics ap.
 USE DFLIB
 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