Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <graph.h>
    short _FAR _setpixel( short x, short y );

    short _FAR _setpixel_w( double x, double y );

Description:
    The _setpixel function sets the pixel value of the point (x,y) using the
    current plotting action with the current color.  The _setpixel function
    uses the view coordinate system.  The _setpixel_w function uses the
    window coordinate system.

    A pixel value is associated with each point.  The values range from 0 to
    the number of colors (less one) that can be represented in the palette
    for the current video mode.  The color displayed at the point is the
    color in the palette corresponding to the pixel number.  For example, a
    pixel value of 3 causes the fourth color in the palette to be displayed
    at the point in question.

Returns:
    The _setpixel functions return the previous value of the indicated pixel
    if the pixel value can be set; otherwise, (-1) is returned.

Example:
    #include <conio.h>
    #include <graph.h>
    #include <stdlib.h>

    main()
    {
        int x, y;
        unsigned i;

        _setvideomode( _VRES16COLOR );
        _rectangle( _GBORDER, 100, 100, 540, 380 );
        for( i = 0; i <= 60000; ++i ) {
            x = 101 + rand() % 439;
            y = 101 + rand() % 279;
            _setcolor( _getpixel( x, y ) + 1 );
            _setpixel( x, y );
        }
        getch();
        _setvideomode( _DEFAULTMODE );
    }

Classification:
    _setpixel is PC Graphics

Systems:
     _setpixel - DOS, QNX

    _setpixel_w - DOS, QNX

See Also:
    _getpixel, _setcolor, _setplotaction

See Also: _setcolor _setplotaction

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson