Shri Rawatpura Sarkar University,
Raipur
Computer Graphics Lab
BENCS607P
Department of Computer Science & Engineering
Shri
hri Rawatpura Sarkar University,
Raipur
LAB MANUAL
OF
“COMPUTER GRAPHICS”
GRAPHICS
NAME:
ROLLNO:
SEMESTER /YEAR:
DEPARTMENT
EPARTMENT OF COMPUTER SCIENCE
Shri Rawatpura Sarkar University, Raipur
CERTIFICATE
This is to certify that Mr./Ms. ____________ has
satisfactorily completed the required number of experiments
in Computer Graphics Laboratory as per syllabus of B.TECH.
6th semester Computer Science & Engineering prescribed by
Shri Rawatpura Sarkar University University, Raipur for the
academic session 2021-22.
Signature of Head Signature of Teacher
Date: Date:
INDEX
Date of Date of Sign. Of Sign of
S.No
Name of Experiment Practical Submission Student Teacher
1. PROGRAM TO DRAW AN ARC
2. PROGRAM OF 2D BAR
3. PROGRAM OF BAR 3D
4. PROGRAM OF CIRCLE
DRAW A CIRCLE USING
5. POLYNOMIAL METHOD
ALGORITHM
6. PROGRAM OF ELLIPSE
7. PROGRAM OF FILL ELLIPSE
PROGRAM OF LINE
8.
PROGRAM OF OUT TEXT XY
9.
10. PROGRAM OF PUTPIXEL
AIM:1 PROGRAM TO DRAW AN ARC
#include<graphics.h>
#include<iostream.h>
#include<dos.h>
#include<conio.h>
void main()
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\BGI");
arc(200,200,180,360,40);
getch();
closegraph();
}
AIM:2. PROGRAM OF 2D BAR
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
intgd=DETECT,gm;
initgraph(&gd,&gm,"c:/turboc3/BGI");
outtextxy(200,10,"This is program to show bargraphHardeepsingh");
bar(100,100,150,250);
bar(160,150,210,250);
bar(220,80,270,250);
bar(280,200,330,250);
line(100,250,330,250);
outtextxy(100,260,"2007 2008 2009 2010");
outtextxy(200,280,"years");
outtextxy(30,180,"Rate of");
outtextxy(20,190,"illteracy");
getch();
closegraph();
}
AIM:3. PROGRAM OF BAR 3D
#include<graphics.h>
#include<conio.h>
main()
intgd = DETECT, gm;
initgraph(&gd, &gm, "C:/turboc3/BGI");
outtextxy(150,10,"This is program 3d Bar Hardeep Singh");
bar3d(100, 100, 200, 200, 20, 1);
getch();
closegraph();
Return 0;
}
AIM:4. PROGRAM OF CIRCLE
#include<graphics.h>
#include<conio.h>
main()
intgd = DETECT, gm;
initgraph(&gd, &gm, "C:/turboc3/BGI");
outtextxy(150,10," This is the program of circle www.bcanotes.com");
circle(100, 100, 50);
getch();
closegraph();
return 0;
}
AIM:5. DRAW A CIRCLE USING POLYNOMIAL METHOD
ALGORITHM
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
void main()
int gd=DETECT,gm;
int h=0,k=0,r;
float c,x=0,y=0;
initgraph(&gd,&gm,"c:\\BGI");
outtextxy(130,10,"Polynomial Method Algorithm for circle Www.Bcanotes.com");
cout<<endl<<endl<<endl;
cout<<"enter the values of centre of circle ";
cin>>h>>k;
cout<<"enter the value of radius of circle ";
cin>>r;
c=(r/M_SQRT2);
while(x<=c)
x=x+1;
y=sqrt(pow(r,2)-pow(x,2));
putpixel(x+h,y+k,RED);
putpixel(-x+h,y+k,RED);
delay(100);
putpixel(-x+h,-y+k,RED);
putpixel(x+h,-y+k,RED);
delay(100);
putpixel(y+h,x+k,RED);
putpixel(-y+h,x+k,RED);
delay(100);
putpixel(-y+h,-x+k,RED);
putpixel(y+h,-x+k,RED);
getch();
closegraph();
}
AIM:6. PROGRAM OF ELLIPSE
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
intgd=DETECT,gm;
initgraph(&gd,&gm,"c:/turboc3/BGI");
outtextxy(150,10,"This is program to draw an ellipse Www.bcanotes.com");
ellipse(320,200,0,360,50,20);
setfillstyle(1,RED);
floodfill(350,200,WHITE);
getch();
closegraph();
}
AIM:7. PROGRAM OF FILL ELLIPSE
#include<graphics.h>
#include<conio.h>
main()
intgd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
outtextxy(150,10," This is the program of Fill Ellipse Www.bcanotes.com");
fillellipse(100, 100, 50, 25);
getch();
closegraph();
return 0;
}
AIM:8. PROGRAM OF LINE
#include<graphics.h>
#include<conio.h>
main()
intgd = DETECT, gm;
initgraph(&gd, &gm, "C:/turboc3/BGI");
outtextxy(150,10,"This is program Of Line Www.bcanotes.com");
line(100, 100, 200, 200);
getch();
closegraph();
return 0;
}
AIM:9. PROGRAM OF OUT TEXT XY
#include<graphics.h>
#include<conio.h>
main()
intgd = DETECT, gm;
initgraph(&gd,&gm,"C:/turboc3/BGI");
outtextxy(100, 100, "This is Outtextxy function");
getch();
closegraph();
return 0;
}
AIM:10. PROGRAM OF PUTPIXEL
#include<graphics.h>
#include<conio.h>
main()
intgd = DETECT, gm;
initgraph(&gd, &gm, "C:\\Turboc3\\BGI");
putpixel(25, 25, RED);
getch();
closegraph();
return 0;