1.Applying the visual properties to a dos application is called Graphics.
2.Whenever we work with graphics application, always we require including "graphics.h"
3.Whenever we work with graphics application then we require finding out "EGAVGA.BGI" file location. It will install all the resources of graphics to the application.
4.Generally the file is available in "C:\TC\BGI" directory.
5.Whenever we work with graphics application then we require initializing graphics properties properly.
6.By using "initgraph()" function we can initialize graphics property.
7.At the time of initializing the graphics due to graphics resource we can get initialization related errors also.
8.Initialization related errors can be found by using "graphicresult()" function.
9."graphicresult()" function returns error code, if the graphics are not initialized properly, if it is initialized properly then we will get "grOK".
10.By using "grapherrormsg()" function we can display error message.
11.By using "closegraph()" function we can close all properties of the graphics.
Example 1:
#include<graphics.h>
#include<conio.h>
void main()
{
int gd = DETECT,
gm;
/* initialization
of graphic mode */
initgraph(&gd,
&gm, "");
line(100,100,200,200);
getch();
closegraph();
}
Example 2:
#include<graphics.h>
#include<conio.h>
void main()
{
int gd =
DETECT, gm;
initgraph(&gd,
&gm, "");
circle(300,
300, 50);
getch();
closegraph();
}
Example:3
#include<graphics.h>
#include<stdio.h>
void main()
{
int gdriver =
DETECT, gmode;
int x = 200, y =
200;
initgraph(&gdriver, &gmode, "");
outtextxy(x, y,
"Hello World");
closegraph();
}
Example 4:
#include<graphics.h>
#include<conio.h>
void main()
{
int gd =
DETECT, gm;
initgraph(&gd,
&gm, "");
ellipse(100,
100, 0, 360, 50, 25);
getch();
closegraph();
}

No comments:
Post a Comment