DDA_Line
Procedure DDA(x1,y1,x2,y2,color : integer);
var
dx,dy,step: integer;
x_inc, y_inc,x,y: real;
begin
dx:=x2-x1;
dy:=y2-y1;
if abs(dx)>(abs(y2) then step:=abs(dx)
else step:=abs(dy);
x_inc:=dx/step;
y_inc:=dy/step;
x:=x1;
y:=y1;
putpixel(round(x), round(y),color);
for k:=1 to step do
begin
x:=x+x_inc;
y:=y+y_inc;
putpixel(round(x), round(y), color);
end;
end;
Bạn đang đọc truyện trên: Truyen247.Pro