0% found this document useful (0 votes)
66 views

The Graphics.h File Is Used in C Language To Get Basic Graphics Working in C

The graphics.h file is used in C to enable basic graphics. It includes functions like putpixel(), outtextxy(), rectangle(), circle(), line(), gotoxy() and cleardevice() for drawing pixels, text, shapes, and cursor positioning. The graphics library is included using #include<graphics.h>, graphics mode is set up using initgraph(), and the driver is closed with closegraph(). Fonts, colors, fills and delays can be set or adjusted for graphics output.

Uploaded by

Abhilash Nair
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

The Graphics.h File Is Used in C Language To Get Basic Graphics Working in C

The graphics.h file is used in C to enable basic graphics. It includes functions like putpixel(), outtextxy(), rectangle(), circle(), line(), gotoxy() and cleardevice() for drawing pixels, text, shapes, and cursor positioning. The graphics library is included using #include<graphics.h>, graphics mode is set up using initgraph(), and the driver is closed with closegraph(). Fonts, colors, fills and delays can be set or adjusted for graphics output.

Uploaded by

Abhilash Nair
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 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