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/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <graph.h>
    short _FAR _remapallpalette( long _FAR *colors );

Description:
    The _remapallpalette function sets (or remaps) all of the colors in the
    palette.  The color values in the palette are replaced by the array of
    color values given by the argument colors.  This function is supported
    in all video modes, but only works with EGA, MCGA and VGA adapters.

    The array colors must contain at least as many elements as there are
    supported colors.  The newly mapped palette will cause the complete
    screen to change color wherever there is a pixel value of a changed
    color in the palette.

    The representation of colors depends upon the hardware being used.  The
    number of colors in the palette can be determined by using the
     _getvideoconfig function.

Returns:
    The _remapallpalette function returns (-1) if the palette is remapped
    successfully and zero otherwise.

See Also:
    _remappalette, _getvideoconfig

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

    long colors[ 16 ] = {
       _BRIGHTWHITE, _YELLOW, _LIGHTMAGENTA, _LIGHTRED,
       _LIGHTCYAN, _LIGHTGREEN, _LIGHTBLUE, _GRAY, _WHITE,
       _BROWN, _MAGENTA, _RED, _CYAN, _GREEN, _BLUE, _BLACK,
    };

    main()
    {
        int x, y;

        _setvideomode( _VRES16COLOR );
        for( y = 0; y < 4; ++y ) {
            for( x = 0; x < 4; ++x ) {
                _setcolor( x + 4 * y );
                _rectangle( _GFILLINTERIOR,
                        x * 160, y * 120,
                        ( x + 1 ) * 160, ( y + 1 ) * 120 );
            }
        }
        getch();
        _remapallpalette( &colors );
        getch();
        _setvideomode( _DEFAULTMODE );
    }

Classification:
    PC Graphics

Systems:
    DOS, QNX

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