- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
pocedure TForm1.line(x, y, N: integer; l: real; d: boolean);
var
x1,x2,x3,x4,y1,y2,y3,y4: integer;
begin
if l>2 then
begin
if d then
case N of
1: begin
x1:=x; y1:=y;
x2:=x1; y2:=y1-round(1);
x3:=x1+round(1); y3:=y1-round(1);
x4:=x1+round(1); y4:=y1;
end;
2: begin
x2:=x; y2:=y;
x1:=x2; y1:=y2+round(1);
x3:=x2+Round(1); y3:=y2;
x4:=x2+Round(1); y4:=y2+round(1);
end;
3: begin
x3:=x; y3:=y;
x1:=x3-round(1); y1:=y3+round(1);
x2:=x3-round(1); y2:=y3;
x4:=x2+round(1); y4:=y2+round(1);
end;
4: begin
x4:=x; y4:=y;
x1:=x4-round(1); y1:=y4;
x2:=x4-round(1); y2:=y4-round(1);
x3:=x4; y3:=y4-round(1);
end;
end
else
case N of
1: begin
x1:=x; y1:=y;
x2:=x1; y2:=y1+round(1);
x3:=x1+round(1); y3:=y1+round(1);
x4:=x1+round(1); y4:=y1;
end;
2: begin
x2:=x; y2:=y;
x1:=x2; y1:=y2-round(1);
x3:=x2-Round(1); y3:=y2;
x4:=x2-Round(1); y4:=y2-round(1);
end;
3: begin
x3:=x; y3:=y;
x1:=x3+round(1); y1:=y3-round(1);
x2:=x3+round(1); y2:=y3;
x4:=x2-round(1); y4:=y2-round(1);
end;
4: begin
x4:=x; y4:=y;
x1:=x4+round(1); y1:=y4;
x2:=x4+round(1); y2:=y4+round(1);
x3:=x4; y3:=y4+round(1);
end;
end;
with Canvas do
begin
Pen.Color :=RGB(Random(256),Random(256),Random(256));
MoveTo(x1,y1);
LineTo(x2,y2);
LineTo(x3,y3);
LineTo(x4,y4);
LineTo(x1,y1);
Brush.Color:=Pen.Color;
FloodFill((x2+x3) div 2, (y2+y1) div 2, Pen.Color,fsBorder);
if l=200 then line (x1,y1,1,1/2, not d);
if n<>1 then line (x1,y1,1,1/2, not d);
if n<>2 then line (x2,y2,2,1/2, not d);
if n<>3 then line (x3,y3,3,1/2, not d);