Computer Graphics Course
Wrote the Code in C with the help of graphics.h headerfile
First and formost step is to include graphics.h
header file which provide us access to call predefined functions like: line
, rectangle
, arc
, ellipse
, polygon
, circle
, etc.,
Second step to initialize the graphics drivers in our computer using initgraph
function from the graphics.h
header file.
void initgraph(int *graphicsDriver, int *graphicsMode, char *driverDirectoryPath);
If your using Turbocpp means:
initgraph(&gd, &gm, "C:\\Turboc3\\BGI");
It initializes the graphics system by loading the passed graphics driver then changing the system into graphics mode. It also resets or initializes all graphics settings like color, palette, current position etc, to their default values. Below is the description of input parameters of initgraph function.
graphics.h
to create a amazing graphics.
If we want to draw a straight line we need to call line()
function.
line(x1,y1 ,x2,y2);
Here Elements in the parament are the x and y coordinates of the first point and second point. This line()
function will draw a line joining these two points.