Introduction to Canvas Graphics in C++ by R4R Team

What is Graphics programming ?

Graphics programming is the area of programming where we can draw the object structure like circles, lines and all geometry object.

Which header file we use ?
#include< graphics.h> header file will include in you program to make a graphics object.


Function that are define in graphics.h :

putpixel() : to display the pixel
line() : to display the line
circle() : to display the circle
setcolor() : to set the color of object
setbkcolor() : to set the color of the background
floodfill() : to fill the color inside the object
outtextxy() : to display the text on the screen
getpixel() : to get the pixel of the object
ecllipse() : to draw a eclipse object
rectangle() : to draw a rectangle object
etc.

To load the graphics in System:

program-

#include
#include< conio.h>
#include< graphics.h>
void main()
{
int gd=DETECT,gm=0;
initgraph(&gd,&gm,"")
getch();
}

-In this program, we just load the graphics driver.
-Here, 'gd' is graphics driver and 'gm' is graphics mode.
-initgraph() is the function that bind the graphics driver.




Leave a Comment: