if Abs(DeltaY)<Abs(DeltaX) then
begin
if DeltaX<0 then
begin
i := x1; x1 := x2; x2 := i;
i := y1; y1 := y2; y2 := i;
DeltaX := x2 - x1;
DeltaY := y2 - y1;
end;
if DeltaY<0 then Flag := -1
else Flag := 1;
DeltaY := Abs(DeltaY);
HalfCount := DeltaX shr 1;
ErrorTerm := 0;
x := x1;
y := y1;
for i:=0 to DeltaX do
begin
Plot(X, Y);
Inc(x);
ErrorTerm := ErrorTerm + DeltaY;
if ErrorTerm>HalfCount then
begin
ErrorTerm := ErrorTerm - DeltaX;
y := y + Flag;
end;
end;
end
else
begin
if DeltaY<0 then
begin
i := x1; x1 := x2; x2 := i;
i := y1; y1 := y2; y2 := i;
DeltaX := x2 - x1;
DeltaY := y2 - y1;
end;
if DeltaX<0 then Flag := -1
else Flag := 1;
DeltaX := Abs(DeltaX);
HalfCount := DeltaY shr 1;
ErrorTerm := 0;
x := x1;
y := y1;
for i:=0 to DeltaY do
begin
Plot(X, Y);
Inc(y);
ErrorTerm := ErrorTerm + DeltaX;
if ErrorTerm>HalfCount then
begin
ErrorTerm := ErrorTerm - DeltaY;
x := x + Flag;
end;
end;
end;
end;
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |