Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>setalllpalette() change all palette color</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 setalllpalette()        Change All Palette Color

 #include   <graphics.h>

 void far               setallpalette(palette);
 struct palettetype far *palette;

    setallpalette() sets all of the palette entries to the values in the
    palettetype structure pointed to by 'palette'. The palettetype
    structure is defined in <graphics.h> as:

     struct palettetype {
          unsigned char size;
          signed char colors[MAXCOLORS+1];
     };

    MAXCOLORS is defined in <graphics.h> as:

     #define MAXCOLORS 15

    The elements in the 'colors' array can be one of the values or
    symbolic constants defined in <graphics.h>:

                         COLOR TABLE
          CGA                           EGA/VGA
    Name            Value          Name                Value

    BLACK             0            EGA_BLACK             0
    BLUE              1            EGA_BLUE              1
    GREEN             2            EGA_GREEN             2
    CYAN              3            EGA_CYAN              3
    RED               4            EGA_RED               4
    MAGENTA           5            EGA_MAGENTA           5
    BROWN             6            EGA_BROWN            20
    LIGHTGRAY         7            EGA_LIGHTGRAY         7
    DARKGRAY          8            EGA_DARKGRAY         56
    LIGHTBLUE         9            EGA_LIGHTBLUE        57
    LIGHTGREEN       10            EGA_LIGHTGREEN       58
    LIGHTCYAN        11            EGA_LIGHTCYAN        59
    LIGHTRED         12            EGA_LIGHTRED         60
    LIGHTMAGENTA     13            EGA_LIGHTMAGENTA     61
    YELLOW           14            EGA_YELLOW           62
    WHITE            15            EGA_WHITE            63

    The values and symbolic constants used depend on the specific
    graphics driver and graphics mode.  If one of the elements in the
    'colors' array is given the value -1, that color entry is not
    changed.

    Returns:    Nothing.

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

    On an EGA or VGA, the following statements change the color the
    string is printed in from white to yellow and then restore the
    palette.

           #include <graphics.h>

           int gdriver = DETECT;
           int gmode;

           main()
           {
               int whcolor;
               struct palettetype palette;

               initgraph(&gdriver,&gmode,"");
               getpalette(&palette);
               printf("Changes made to the palette are immediately seen.\n");
               delay(1000);
               setpalette(7,62);
               delay(2000);
               setallpalette(&palette);
               delay(2000);
               closegraph();
           }


See Also: getbkcolor() getcolor() getpalette()

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