graphdefaults() function

graphdefaults function resets all graphics settings to their defaults. 

Declaration of graphdefaults() function

void graphdefaults();

It resets the following graphics settings :-

  • Sets the viewport to the entire screen.
  • Moves the current position to (0,0).
  • Sets the default palette colors, background color, and drawing color.
  • Sets the default fill style and pattern.
  • Sets the default text font and justification.

C programming source code for graph defaults

#include <graphics.h> 
#include <conio.h>
main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\ TurboC3\\BGI"); 
setcolor(RED);
setbkcolor(YELLOW);
circle(250, 250, 50);
getch(); 
graphdefaults();
getch(); 
closegraph(); 
return 0;
}