#include <graphics.h>
void InterBresenhamline(int x0, int y0, int x1, int y1, int color)
{
int dx, dy ,x, y, e,i;
dx = x1 - x0;
dy = y1 -y0;
e = -dx;
x = x0;
y = y0;
for(i = 0; i <= dx; i ++)
{
putpixel(x, y, color);
x++;
e = e+2*dy;
if(e >= 0)
{
y++;
e = e- 2*dx;
}
}
}
main()
{ int gdriver, gmode;
gdriver = DETECT;
initgraph(&gdriver, &gmode, "C://tc.include");
setbkcolor(6);
InterBresenhamline(0, 0,100, 200, 12);
}
void InterBresenhamline(int x0, int y0, int x1, int y1, int color)
{
int dx, dy ,x, y, e,i;
dx = x1 - x0;
dy = y1 -y0;
e = -dx;
x = x0;
y = y0;
for(i = 0; i <= dx; i ++)
{
putpixel(x, y, color);
x++;
e = e+2*dy;
if(e >= 0)
{
y++;
e = e- 2*dx;
}
}
}
main()
{ int gdriver, gmode;
gdriver = DETECT;
initgraph(&gdriver, &gmode, "C://tc.include");
setbkcolor(6);
InterBresenhamline(0, 0,100, 200, 12);
}