From: Boreas
function PointsOfLine(x1,y1,x2,y2:integer): tpointarray;
var slope,yint:extended;
i:integer;
begin
slope:=(y2-y1)/(x2-x1);
writeln(floattostr(slope));
yint:=(y1-(x1*(slope)));
if abs(slope) >1.0 then
begin
setarraylength(result,round(abs(y2-y1))+1);
for i:=0 to getarraylength(result)-1 do
begin
result[i].y:=y1-i;
result[i].x:=round((result[i].y-yint)/slope);
end;
exit;
end
setarraylength(result,round(abs(x2-x1))+1);
for i:=0 to getarraylength(result)-1 do
begin
result[i].x:=x1+i;
result[i].y:=round((result[i].x*slope)+yint);
end;
end;
close but needs tweaking
Or you could do my way :p
function DrawLine(Sx, Sy, Ex, Ey, Step : Integer) : TPointArray;
var t, ta : Extended;
x, y, i : Integer;
begin
t := (Step / hypot(ex - sx, ey - sy));
SetLength(Result, Trunc((1 / t)+1));
repeat
ta := ta + t;
Result[i].x := round((ex * ta) + (sx * (1-ta)));
Result[i].y := round((ey * ta) + (sy * (1-ta)));
inc(i);
until ta >= 1;
SetLength(Result, i);
end;