getmaxcolor() function in C
Last Updated :
23 Jan, 2018
The header file graphics.h contains getmaxcolor() function, which returns maximum color value for current graphics mode and driver. As color numbering starts from zero, total number of colors available for current graphics mode and driver are ( getmaxcolor() + 1 ) .
Syntax :
int getmaxcolor();
Below is the implementation of getmaxcolor() function.
#include <graphics.h>
#include <stdio.h>
int main()
{
int gd = DETECT, gm;
char arr[100];
initgraph(&gd, &gm, "" );
sprintf (arr, "Maximum number of colors for "
"current graphics mode and "
"driver = %d" , getmaxcolor() + 1);
outtextxy(20, 100, arr);
getch();
closegraph();
return 0;
}
|
Output :
Share your thoughts in the comments
Please Login to comment...