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

 #include   <graphics.h>

 int far getpalettesize(void);

        The getpalettesize() function returns the number of palette
        entries allowed for the current palette.

    Returns:    The number of allowed palette entries.

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

    The following statements fill a rectangle with all the available
    colors.

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

           int gdriver = DETECT;
           int gmode;

           main()
           {
               int whcolor, palsize;

               initgraph(&gdriver,&gmode,"");
               palsize = getpalettesize());
               for (whcolor = 0; whcolor < palsize; whcolor++) {
                   setfillstyle(SOLID_FILL,whcolor);
                   rectangle(100,100,200,150);
                   floodfill(110,110,WHITE);
                   getch();
               }
               closegraph();
           }


See Also: getpalette() setallpalette() setpalette()

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