Graphics

C Program to for Midpoint Line algorithm

Program to implement the Midpoint Line algorithm to generate a line of given slope and thickness. Implement the polyline (many lines) command using this algorithm as a routine that display a set of straight lines between N input points. For n=1 the routine displays a single point.


C program to for Moving Car

line(80+i,300,90+i,270);
line(90+i,270,120+i,270);
line(120+i,270,160+i,240);
line(160+i,240,230+i,240);
line(230+i,240,275+i,270);


C Program to impliment Fish Movement

x+=5;
y+=1;
arc(x,y,stangle,endangle+35,radius);
arc(x,y-110,190,323,radius+2);
circle(x+40,y-60,5);
line(x-90,y-90,x-90,y-8);


C program to implement Spiral Model

setcolor(YELLOW);
printf(“ENTER THE NUMBER OF RINGS IN THE SPIRAL MODEL\n”);
scanf(“%d”,&n);
printf(“Enter the origin point of the spiral”);
scanf(“%d%d”,&x,&y);


C program to implement Bar Graph

setcolor(CYAN);
printf(“ENTER THE NUMBER OF DATA ELEMENTS\n”);
scanf(“%d”,&n);

line(1,1,1,479);// Y axis
line(1,479,640,479);// X axis


C Program to implement Kite flying

void main()
{
int gd=DETECT,gm;
int x=10,y=480;
initgraph(&gd,&gm,”..\\bgi”);
while(!kbhit())
{
cleardevice();
if(y==0)