List of Graphics Functions in C
initgraph( ); Initializes the graphics system. Declaration: void far initgraph (int far *graphdriver, int far *graphmode, char far *path to driver); Remarks: To start the graphics system, you must first call initgraph. Initgraph Initializes the graphics system by loading a graphics driver from Disk (or validating a registered driver) then putting the system into graphics mode
setbkcolor( ); It sets the current background color using palette. Declaration: void far setbkcolor (int color); Remarks: setbkcolor sets the background to the color specified by color.
setcolor( ); setcolor sets the current drawing color. Declaration: void far setcolor (int color); Remarks: It sets the current drawing color to color, which can range from 0 to getmaxcolor.
rectangle( ); Draws a rectangle (graphics mode) Declaration: void far rectangle (int left, int top, int right, int bottom); Remarks: rectangle draws a rectangle in the current line style, thickness and (right, bottom) is its lower right corner.
settextstyle( ); Sets the current text characteristics. Declaration: void far settextstyle (int font, int direction, int charsize); Remarks: It sets the text font, the direction in which text is displayed and the size of the characters.
putimage( ); putimage outputs a bit image onto the screen. Declaration: void far putimage (int left, int top, void far *bitmap, int top); Remarks: putimage puts the bit image previously saved with getimage back onto the screen, with the upper left corner of the image placed at (left, top)
getimage ( ); getimage saves a bit image of the specified region into memory. Declaration: void far getimage (int left, int top, int right, int bottom, void far * bitmap); Remarks: getimage copies an image from the screen to memory
malloc( ); It allocates the memory. Declaration: void *malloc(size_t size) ; Remarks: It allocates a back of size bytes from the memory heap. It allows a program to allocate memory explicitly as its needed and in the exact amount needed
floodfill( ); Flood_fills a bounded region. Declaration: void far floodfill (int x, int y, int border); Remarks: floodfill fills an enclosed area on bitmap devices. The areas bounded by the color border are flooded with the current fill pattern and fill color.
Closegraph( ); Shut down the graphics system. Declaration: void far closegraph(void); Remarks: It reallocates all memory allocated by the graphics system
cleardevice( ); It clears the graphics screen. Declaration: void far cleardevice(void); Remarks: It erases the entire graphics screen and moves the current position (CP) to home(0, 0)
sleep( ); Suspends execution for interval. Declaration: void sleep(unsigned seconds); Remarks: With a call to sleep, the current program is suspended from execution for the number of seconds specified by the argument seconds
exit( ); exit terminates the program. Declaration: void exit(int status); Remarks: Exit terminates the calling process.
sound( ); sounds turns the PC speaker on at the specified frequency. Declaration: void sound(unsigned frequency); Remarks: Sound turns on the PC’s speaker at a given frequency.
nosound( ); sounds turns the PC speaker off. Declaration: void sound(void ); Remarks: Sound turns on the PC’s speaker off after it has been turned on by a call to sound
textcolor( ); It selects a new character color in text mode. Declaration: void textcolor(int newcolor); Remarks: This function works that procedure text-mode output directly to the screen (console output functions), textcolor selects the foreground character color
delay( ); It suspends execution for interval (milliseconds). Declaration: void delay(unsigned milliseconds); Remarks: With a call to delay, the current program is suspended from execution for the time specified by the argument milliseconds. It is not necessary to make a calibration call to delay before using it. It is accurate to one milliseconds
imagesize( ); Returns the number of bytes required to store a bit image. Declaration: unsigned far imagesize(int left, int top, int right, int bottom); Remarks: determines the size of memory area required storing a bit images.
gotoxy( ); Positions cursor in text window. Declaration: void gotoxy(int x, int y); Remarks: gotoxy moves the cursor to the given position in the current text window. If the coordinates are invalid, the call to gotoxy is ignored.
line( ); line draws a line between two specified points. Declaration: void far line(int x1, inty1, intx2, inty2); Remarks: line draws a line from (x1, y1) to (x2,y2) using the current color, line style and thickness. It does not update the current position (CP)