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>getdefaultpalette() get the current palette</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getdefaultpalette()     Get the Current Palette

 #include   <graphics.h>

 struct palettetype *far getdefaultpalette(void);

        This function fills a structure of type palettetype as
        initialized by a previous call to initgraph():

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


    Returns:    A pointer to a structure of type palettetype.

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

    The following statements draw three rectangles, then get the
    default palette and store it in a structure named my_pal.

           #include <graphics.h>
           #include <conio.h>

           int gdriver = DETECT;
           int gmode;
           struct palettetype far *my_pal = (void *) 0;

           main()
           {
               int whcolor;

               initgraph(&gdriver,&gmode,"");
               whcolor = getcolor();
               rectangle(100,100,200,150);
               setcolor(4);
               rectangle(300,100,400,150);
               setcolor(whcolor);
               rectangle(100,250,200,300);
               my_pal = getdefaultpalette();
               getch();
               closegraph();
           }


See Also: getpalette() getcolor() initgraph()

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