Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

The graphics.h file is used in C language to get basic graphics working in C.

POSITION TRACKING

The positioning is done from the top left corner as shown in the image below,

INCLUDING GRAPHICS LIBRARY

#include<stdio.h> #include<graphics.h> void main() { }


LOADING THE GRAPHICS DRIVER

#include<stdio.h> #include<conio.h> #include<graphics.h> void main() { int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode," "); }


REFERENCES OF COMMON FUNCTIONS

Cleardevice() Clears screen gotoxy() Moves the cursor to a specific location on screen putpixel() Puts a small pixel(a very small dot) at the location mentioned in the function. outtextxy() Prints a text on the screen. rectangle()

Draws a rectangle, given its starting and ending diagonal co-ordinates. circle() Draws a circle, given the coordinates of centre and the radius. line() Draws a line, given the starting and ending co-ordinates of the line. moveto() Moves the cursor, from one place to the position mentioned in the function. lineto() Draws a line from the current position to the co-ordinates specified. ellipse() Draws the ellipse using the specified angles and coordinates. drawpoly() Draws a polygon. settextstyle() Sets the font style. The available fonts are,
1. TRIPLEX_FONT 2. SMALL_FONT 3. SANS_SERIE_FONT 4. GOTHIC_FONT You may change the direction of the text to be displayed horizontally or vertically using HORIZ_DIR or VERT_DIR respectively.

You may also change the size. The size is from 1 to 10. setfillstyle() Sets a style to fill up a shape. Styles available are SOLID_FILL, LINE_FILL, HATCH_FILL, SLASH_FILL etc. setcolor() Sets the color floodfill() Fills up the selected area with color. itoa() Converts from integer to alphabet. delay() Causes a delay in the execution of the program. The delay is given in

miliseconds. closegraph() To close the graphics library.

You might also like