-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.pas
More file actions
263 lines (195 loc) · 4.51 KB
/
Copy pathexample.pas
File metadata and controls
263 lines (195 loc) · 4.51 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
program example;
uses
osxbgi;
//wingraph, wincrt;
//
// TESTING app
//
var
gd,gm: SmallInt;
tmpcolor,etaloncolor : Longint;
r,g,b: word;
i: integer;
polyPoints: array [1..5] of PointType;
key: Char;
procedure ReadKeyTest();
begin
writeln('Readkey test. Press Esc to exit');
key := readkey();
while key <> chr(27) do
begin
writeln(ord(key),' *',key,'*');
key := readkey();
end;
end;
procedure TestText();
begin
//SetColor(white);
OutTextXY(10,200, 'the quick brown fox jumps over the lazy dog 1234567890');
//OutTextXY(10,200, 's');
SetColor(yellow);
OutTextXY(10,400, 'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 1234567890');
//OutTextXY(10,400, 'S');
end;
procedure TestBorders();
var
i: Integer;
begin
for i := 0 to 480 do
begin
if (i mod 2) = 0 then
line(-10, i, 300, i);
end;
SetColor(yellow);
Rectangle(0,0,99,99);
Rectangle(500,-1,640,99);
Rectangle(500,300,639,480);
Rectangle(-1,300,99,479);
end;
var
img1,img2: pointer;
begin
gd := nopalette;
gm := m640x480;
InitGraph(gd,gm,'Hello World');
if (GraphResult <> grOK) then
begin
writeln('Cannot init graphics');
exit;
end;
LoadImage(img1, 'dog.bmp');
LoadImage(img2, 'cat.bmp');
UpdateGraph(UpdateOff);
SetFillStyle(SolidFill, olive);
bar(150, 150, 250, 250);
PutImage(100,100, img1);
PutImageTransparent(100,200, img1);
PutImage(200,100, img2);
PutImageTransparent(200,200, img2);
UpdateGraph(UpdateNow);
readkey;
SetBkColor(red);
ClearDevice();
SetBkColor(darkred);
ClearDevice();
line(10,10,20,20);
LineTo(0,50);
//readkey;
SetLineStyle(0,0,3);
LineTo(0,0);
LineTo(320,0);
//readkey;
SetColor(BLue);
SetBkColor(green);
ClearDevice();
//readkey;
LineTo(640,480);
SetColor(BlazeOrange);
LineTo(100,480);
//readkey;
Ellipse(200,200, 20, 300, 40, 60);
//readkey;
SetColor(Bronze);
SetLineStyle(0,0,1);
Circle(200,250, 50);
//readkey;
SetColor(white);
SetLineStyle(0,0,5);
Arc(100,150, 90, 270, 20);
//readkey;
Rectangle(500, 20, 600, 40);
//readkey;
SetFillStyle(SolidFill, yellow);
bar(500, 120, 590, 140);
//readkey;
SetFillStyle(EmptyFill, yellow);
SetBkColor(lightgray);
bar(520, 140, 610, 160);
UpdateGraph(UpdateNow);
readkey;
SetBkColor(black);
SetFillStyle(SolidFill, darkgreen);
SetLineStyle(SolidLn,0,1);
SetColor(yellow);
ClearDevice();
bar3d(400, 300, 470, 320, 10, true);
bar3d(400, 360, 470, 380, 5, true);
bar3d(500, 300, 570, 320, 10, false);
bar3d(500, 360, 570, 380, 5, false);
FillRect(300, 300, 370, 320);
bar(300, 360, 370, 380);
//InvertRect(300, 420, 370, 440);
for i := 0 to 6 do
begin
RoundRect(250 + i*50, 420, 250 + i*50 + 40, 440, i*5);
end;
FillEllipse(100, 50, 20, 30);
Chord(200, 40, 0, 90, 20, 30);
Chord(300, 40, 0, 135, 20, 30);
Chord(400, 40, 0, 180, 20, 30);
Chord(500, 40, 0, 270, 20, 30);
Chord(600, 40, 45, 180, 20, 30);
Sector(200, 140, 0, 90, 20, 30);
Sector(300, 140, 0, 135, 20, 30);
Sector(400, 140, 0, 180, 20, 30);
Sector(500, 140, 0, 270, 20, 30);
Sector(600, 140, 45, 180, 20, 30);
PieSlice(200, 240, 0, 90, 30);
PieSlice(300, 240, 0, 135, 30);
PieSlice(400, 240, 0, 180, 30);
PieSlice(500, 240, 0, 270, 30);
PieSlice(600, 240, 45, 180, 30);
polyPoints[1].x := 100; polyPoints[1].y := 400;
polyPoints[2].x := 140; polyPoints[2].y := 420;
polyPoints[3].x := 120; polyPoints[3].y := 425;
polyPoints[4].x := 122; polyPoints[4].y := 440;
polyPoints[5].x := 80; polyPoints[5].y := 480;
FillPoly(5, polyPoints);
inc(polyPoints[1].x, 50);
inc(polyPoints[2].x, 50);
inc(polyPoints[3].x, 50);
inc(polyPoints[4].x, 50);
inc(polyPoints[5].x, 50);
DrawPoly(5, polyPoints);
UpdateGraph(UpdateNow);
readkey;
(*
UpdateGraph(UpdateOff);
SetBkColor(black);
ClearDevice();
SetLineStyle(0,0,1);
for i := 0 to 255 do
begin
SetColor(getRgBColor(0,i,0));
line(10+i, 30, 10+i, 230);
end;
UpdateGraph(UpdateNow);
UpdateGraph(UpdateOn);
readkey;
*)
tmpcolor := 500;
etaloncolor := 500;
SetBkColor(tmpcolor);
etaloncolor := getbkColor();
writeln('bkColor check', tmpcolor:6, etaloncolor:6);
SetColor(tmpcolor);
etaloncolor := getColor();
writeln('frColor check', tmpcolor:6, etaloncolor:6);
etalonColor := getRgBColor(50, 100, 150);
getRGBComponents(etalonColor, r,g,b);
writeln('get rgb check (50,100,150) ', r:6, g:6, b:6);
readkey;
TestText();
UpdateGraph(UpdateNow);
readkey;
writeln('REadkey test. Press Shift+R to exit');
key := readkey();
while key <> 'R' do
begin
writeln(ord(key),' *',key,'*');
key := readkey();
end;
CloseGraph();
writeln('7');
readkey();
end.