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>getmaxcolor() get the maximum color value for current mode</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getmaxcolor()           Get the Maximum Color Value for Current Mode

 #include   <graphics.h>

 int far    getmaxcolor(void);

    getmaxcolor() returns the highest valid pixel value for the current
    graphics driver and mode.  A pixel value is an index into a color
    table called a 'palette'.  The range of pixel values (0 - (size-1))
    is determined by the size of the palette.

    Returns:    The highest color value for the current driver and mode.

       Note:    The maximum value returned is 15 even though IBM 8514
                supports 256.
   -------------------------------- Example ---------------------------------

    The following statements get the number of colors available for the
    current graphics driver.

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

           int gdriver = DETECT;
           int gmode;

           main()
           {
               int maxcolors;

               initgraph(&gdriver,&gmode,"");
               maxcolors = getmaxcolor();
               printf("max colors available: %d \n",maxcolors+1);
               getch();
               closegraph();
           }


See Also: getbkcolor() getpalette()

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