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>_getbkcolor() get current background color</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _getbkcolor()           Get current background color

 #include   <graph.h>

 long far _getbkcolor( void );

    _getbkcolor() gets the pixel value or color of the current
    background. The default value is 0.

       Returns:     The background pixel value in color text mode, or the
                    background color in color graphics mode.

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

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

    This program draws a dotted line through a pie-shape, reversing the
    line where it intersects the pie.

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

           main()
           {
              struct xycoord xy;
              short color;
              int i;

              _setvideomode( _MRES4COLOR );
              color = _getcolor();
              _pie( _GFILLINTERIOR, 90, 60, 250, 160, 250, 22, 10, 160 );
              xy = _getviewcoord( 0, 0 );
              _moveto ( xy.xcoord, xy.ycoord );

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

                 /* test and reverse foreground and background colors */
                 if( _getpixel( xy.xcoord,  xy.ycoord) ==
                     (short) _getbkcolor() )
                    _setcolor( color );
                 else
                    _setcolor( (short) _getbkcolor() );

                 _setpixel( xy.xcoord,  xy.ycoord);
                 }

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


See Also: _setcolor() _setbkcolor() _getpixel()

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