Showing posts with label Bresenham. Show all posts
Showing posts with label Bresenham. Show all posts

Thursday, April 14, 2011

C implementation of Bresenham's Line Drawing Algorithm

Hello friends,following is the another program from Computer Graphics subject for Bresenham's Line Drawing Algorithm .Screenshoots shown are taken by running the programs in virtual machine os.

PROGRAM CODE
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
int round(float x);
void bresenham(int x1,int y1,int x2,int y2,int color);
void main ()
{
clrscr();
int gd=DETECT,gm;
int x1,x2,y1,y2;
printf("\nEnter Starting Point(X1,Y1) :");
scanf("%d%d",&x1,&y1);
printf("\nEnter End Point(X2,Y2) :");
scanf("%d%d",&x2,&y2);
clrscr();
initgraph(&gd,&gm,"C:\\TC\\BGI");