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>_remapallpalette() assign colors to all pixel values</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _remapallpalette()      Assign colors to all pixel values

 #include   <graph.h>

 short far _remapallpalette( colors );
  long far *colors;      Color number array

    _remapallpalette() assigns all available pixel values simultaneously
    to an array of color numbers that is available on the display
    hardware and selected mode. In graphics mode, a pixel can be
    represented as a one-, two-, or four-bit value depending on the mode
    selected. There is also a separate ordinal color representation,
    where each color that can be displayed by a particular video mode is
    represented by a unique ordinal value. The mapping of pixel values to
    display colors creates a "palette" of colors that can be displayed.

    When a palette is remapped, all images, including those already
    displayed, immediately show the new palette.

       Returns:     If successful, _remapallpalette() returns a non-zero
                    value. If unsuccessful it returns 0.

         Notes:     _remapallpalette() requires an EGA, MCGA, or VGA
                    display system.

                    The default array of color numbers, with no
                    remapping, is as follows:

                    No.   Color                No.   Color
                    ---   ---------------      ---   ---------------
                     0    Black                 8    Dark gray
                     1    Blue                  9    Light blue
                     2    Green                10    Light green
                     3    Cyan                 11    Light cyan
                     4    Red                  12    Light red
                     5    Magenta              13    Light magenta
                     6    Brown                14    Yellow
                     7    White                15    Bright white

                    The actual number of colors mapped depends on the
                    number of colors supported by the active video mode.

                    The MCGA and VGA color graphics modes support a
                    palette of 256k colors, using separate blue, green
                    and red bytes. Since colors are split between bytes,
                    the color numbers are not continuous. To provide
                    compatibility with EGA conventions the following
                    manifest constants, defined in graph.h, are available
                    to represent the default color numbers:

                    No.   Color                 No.   Color
                    ---   ---------------       ---   ---------------
                     0    _BLACK                 8    _GRAY
                     1    _BLUE                  9    _LIGHTBLUE
                     2    _GREEN                10    _LIGHTGREEN
                     3    _CYAN                 11    _LIGHTCYAN
                     4    _RED                  12    _LIGHTRED
                     5    _MAGENTA              13    _LIGHTMAGENTA
                     6    _BROWN                14    _LIGHTYELLOW
                     7    _WHITE                15    _BRIGHTWHITE

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

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

    This program remaps pixel colors green and light green to magenta and
    light magenta.

           #include <graph.h>

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

           main()
           {
              . . . select video mode . . .

              _remapallpalette( colors );

              . . . display images . . .
           }


See Also: _remappalette() _selectpalette() _setvideomode()

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