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>
    long _FAR _remappalette( short pixval, long color );

Description:
    The _remappalette function sets (or remaps) the palette color pixval to
    be the color color.  This function is supported in all video modes, but
    only works with EGA, MCGA and VGA adapters.

    The argument pixval is an index in the color palette of the current
    video mode.  The argument color specifies the actual color displayed on
    the screen by pixels with pixel value pixval.  Color values are selected
    by specifying the red, green and blue intensities that make up the
    color.  Each intensity can be in the range from 0 to 63, resulting in
    262144 possible different colors.  A given color value can be
    conveniently specified as a value of type long.  The color value is of
    the form 0x00bbggrr, where bb is the blue intensity, gg is the green
    intensity and rr is the red intensity of the selected color.  The file
    graph.h defines constants containing the color intensities of each of
    the 16 default colors.

    The _remappalette function takes effect immediately.  All pixels on the
    complete screen which have a pixel value equal to the value of pixval
    will now have the color indicated by the argument color.

Returns:
    The _remappalette function returns the previous color for the pixel
    value if the palette is remapped successfully; otherwise, (-1) is
    returned.

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

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

    main()
    {
        int col;

        _setvideomode( _VRES16COLOR );
        for( col = 0; col < 16; ++col ) {
            _remappalette( 0, colors[ col ] );
            getch();
        }
        _setvideomode( _DEFAULTMODE );
    }

Classification:
    PC Graphics

Systems:
    DOS, QNX

See Also:
    _remapallpalette, _setvideomode

See Also: _remapallpalette _setvideomode

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