void bresline(Point start,Point end,Color thisColor){
int x,y,endl,steps=0,p,dx,dy ,c=0,current=0;
dx=abs(end.x -start.x ); //abs of delta x
dy=abs(end.y -start.y ); //abs of delta y
if(dx>dy)
{
p=2*dy-dx;
if(start.x<end.x)
{
x=start.x;
y=start.y;
endl=end.x;
if(start.y x at start
{
x=end.x;
y=end.y;
endl=start.x;
if(end.y<start.y)
steps=1;
else
steps=-1;
}
while(x<=endl)
{
setPixel(x,y,thisColor);
if(pdx
{
p=2*dx-dy;
if(start.y<end.y)
{
y=start.y;
x=start.x;
endl=end.y;
if(start.x<end.x)
steps=1;
else
steps=-1;
}
else
{
y=end.y;
x=end.x;
endl=start.y;
if(end.x<start.x)
steps=1;
else
steps=-1;
}
while(y<=endl)
{
setPixel(x,y,thisColor);
if(p<0)
p=p+2*dx;
else
{
x=x+steps;
p=p+2*(dx-dy);
}
y++;
if(current==0&&c==10)
{
current=1;
c=-1;
}
if(current==1&&c==6)
{
current=0;
c=-1;
}
c++;
}//while
}//1st if
}//bresline
This entry was posted on Tuesday, August 5th, 2008 at 7:54 am and is filed under Computer Graphics Codes. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
July 24, 2009 at 10:26 am |
hm.. nice..