Sub line(x1,y1,x2,y2,col)
 Dim byti,bytx,byty,bytd,bytd1,bytd2,
bytdx,bytdy,bytsx,bytsy
 dx=Abs(x2-x1)  
 dy=Abs(y2-y1)  
 if x2>=x1 then sx=1 else sx=-1 end if
 if y2>=y1 then sy=1 else sy=-1 end if
 if dy<=dx then
 d=dy*2-dx
 d1=dy*2
 d2=(dy-dx)*2
 display(x1,y1)=col
 x=x1+sx
 y=y1
 for i=1 to dx
 if d>0 then
  d=d+d2 
  y=y+sy
 else d=d+d1
 end if
 display(x,y)=col
 x=x+sx
 next
 else
 d=dx*2-dy
 d1=dx*2
 d2=(dx-dy)*2
 display(x1,y1)=col
 x=x1
 y=y1+sy
 for i=1 to dy
 if d>0 then
 d=d+d2
 x=x+sx
 else d=d+d1
 end if
 display(x,y)=col
 y=y+sy
 next 
 end if
End Sub

назад