1
2
3
4
5
6
7
8
9
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
77
78
79
80
81
82
83
|
{
test for graph unit's DrawPoly and FillPoly procedures
compiles with Turbo Pascal 7 and Free Pascal
used for TP7 compatibily testing
}
program PolyTest;
uses
graph;
const
MaxPoints = 1000;
var
InF: Text;
NumPoints: Integer;
Poly: array [1..MaxPoints] of PointType;
procedure ReadPoly;
var
I: Integer;
begin
Readln(InF, NumPoints);
for I := 1 to NumPoints do
Readln(InF, Poly[I].X, Poly[I].Y);
end;
procedure CheckGraphResult;
var
ErrorCode: Integer;
begin
ErrorCode := GraphResult;
if ErrorCode <> grOk then
begin
CloseGraph;
Writeln(ErrorCode, ': ', GraphErrorMsg(ErrorCode));
Readln;
Halt(1);
end;
end;
procedure Tralala;
var
I: Integer;
IStr: string;
begin
if ParamStr(1) <> '' then
Assign(InF, ParamStr(1))
else
Assign(InF, 'polytest.txt');
Reset(InF);
I := 1;
while not Eof(InF) do
begin
ReadPoly;
ClearDevice;
Str(I, IStr);
OutTextXY(0, 0, IStr);
DrawPoly(NumPoints, Poly);
CheckGraphResult;
Readln;
ClearDevice;
OutTextXY(0, 0, IStr + ' fill');
FillPoly(NumPoints, Poly);
CheckGraphResult;
Readln;
Inc(I);
end;
Close(InF);
end;
var
GraphDriver, GraphMode: Integer;
begin
GraphDriver := VGA;
GraphMode := VGAHi;
InitGraph(GraphDriver, GraphMode, '');
SetFillStyle(SolidFill, 9);
Tralala;
CloseGraph;
end.
|