Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_setpixel() set a pixel value</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _setpixel()             Set a pixel value

 #include   <graph.h>

 short far _setpixel( x, y );
  short x;     x coordinate (horizontal)
  short y;     y coordinate (vertical)

    _setpixel() sets the pixel at logical point (x,y) to the current
    color.

       Returns:     _setpixel() returns the previous color value of the
                    pixel (x,y). If it fails (for example, if the point
                    lies outside of the clipping region), it will return
                    a -1.

   Portability:     MS-DOS only, true MDPA, CGA, EGA, MCGA, or VGA video
                    compatibles

 -------------------------------- Example ---------------------------------

    This program gets the current image output position and successively
    displaces it to draw a diagonal dotted line.

           #include <conio.h>
           #include <graph.h>

           main()
           {
              struct xycoord xy;
              int i;

              _setvideomode( _MRES4COLOR );
              xy = _getviewcoord( 0, 0 );
              _moveto ( xy.xcoord, xy.ycoord );

              for ( i = 0; i < 72; i++ )
                 {
                 xy = _getcurrentposition( );
                 _moveto( xy.xcoord + 4, xy.ycoord + 2 );
                 _setpixel( xy.xcoord,  xy.ycoord);
                 }

              while ( !kbhit() );
              _setvideomode( _DEFAULTMODE );
           }


See Also: _getpixel()

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