Graphics with c/c++

Graphics with c/c++...............

In this type of programming, we can draw different kinds of geometrical shapes circle, rectangle, square, lines, etc with different colors .we can also create animation and games by writing and compiling some programming code with the help of c/c++ compiler

So here i am trying to provide you some important point which we will use in whole graphics programming 

#include<graphics.h>

*graphics.h library function is used to include and facilitate graphical operation in the program 
*there are many predefined functions in graphics.h library,such as line( ),circle( ),arc( ) and many more function .we will use these functions according to the need and requirement.

The main programming section to initialize the graph................





gd - gd means graphic driver

gm - gm means graphic mode, which is a computer display mode that generates images using pixels

DETECT - DETECT is a macro defined in "graphics.h" header file.

initgraph - initgraph is a predefined function that is used to initialize the graphics system by loading from disk. It has three parameters, It loads the passed graphic driver then changes the system into the graphic mode.  

"c:\\tc\\bgi" - it means driver_directory_path .It specifies the directory where all the graphics driver files are located.

* A simple programming code to draw a line 
#include<conio.h>
#include<graphics.h>  
void main( );
{
clrscr( );
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
line(100,200,500,150);
line(100,250,500,250);
getch( );
closegraph( );
}



if your system is not giving any output after compiling the source code then please click on the link below












Comments

Post a Comment

Popular posts from this blog