.


:




:

































 

 

 

 





, . : , , , -. , . - . , , .

. 28. .

 

pixel (picture element - ) - . , . , . , , : . , , 0 1. , , . . . . , . , . :

,

, , , , . . . , .

. 29.

. 29. .

 

, . , . , , , , . . - . . , , , , , .

, ,

.

, . , .

, . , .

. :

, .

, .

 

Procedure Bresenham(x1,y1,x2,y2,Color: integer);

var

dx,dy,incr1,incr2,d,x,y,xend: integer;

begin

dx:= ABS(x2-x1);

dy:= Abs(y2-y1);

d:=2*dy-dx; { d}

incr1:=2*dy; { d<0}

incr2:=2*(dy-dx); { d>=0}

if x1>x2 then { . x}

begin

x:=x2;

y:=y2;

xend:=x1;

end

else

begin

x:=x1;

y:=y1;

xend:=x2;

end;

PutPixel(x,y,Color); { }

While x<xend do

begin

x:=x+1;

if d<0 then

d:=d+incr1 { }

else

begin

y:=y+1;

d:=d+incr2; { , y-}

end;

PutPixel(x,y,Color);

end;{while}

end;{procedure}

 

, , , , . , , , , , . . , , . , . , , , . - , . :

 

.

, . , . x ,





:


: 2015-05-07; !; : 505 |


:

:

- , , .
==> ...

1530 - | 1340 -


© 2015-2024 lektsii.org - -

: 0.017 .