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

 #include   <graph.h>

 long far _setbkcolor( color );
  long color;       Desired color value

    _setbkcolor() sets the current background color to the current pixel
    value or color. The default background color value is 0.

       Returns:     _setbkcolor() returns the value of the old background
                    color.

         Notes:     The meaning of the color argument varies according to
                    whether the current video mode is color text or color
                    graphics. In color text mode, _setbkcolor() accepts
                    (and _getbkcolor() returns) an attribute, or pixel
                    value. In color graphics mode, _setbkcolor() accepts
                    (and _getbkcolor() returns) a color (as used in
                    _remappalette).

                    The actual colors displayed depend on the current
                    palette mapping. The following manifest constants,
                    defined in graph.h, can be used as a convenience in
                    defining and manipulating the most common colors, but
                    there will generally be many more available:

                    _BLACK          _BLUE           _GREEN
                    _CYAN           _RED            _MAGENTA
                    _BROWN          _WHITE          _GRAY
                    _LIGHTBLUE      _LIGHTGREEN     _LIGHTCYAN
                    _LIGHTRED       _LIGHTMAGENTA   _LIGHTYELLOW
                    _BRIGHTWHITE

                    Unlike _remappalette(), _setbkcolor() does not
                    require an EGA, MCGA, or VGA adapter, but performs a
                    similar function. However, _setbkcolor() only affects
                    subsequent output, not currently displayed output as
                    does _remappalette().

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

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

    This program sets a new background color then restores the original
    on exit.

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

           main()
           {
              long oldcolor;

              _setvideomode( _MRES4COLOR );
              oldcolor = _setbkcolor( _BLUE );

              . . . output images . . .

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


See Also: _getbkcolor() _remappalette() _selectpalette()

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