-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNormalize.sb
396 lines (388 loc) · 17.5 KB
/
Normalize.sb
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
' Shapes Normalize Sample
' Copyright © 2019-2020 Nonki Takahashi. The MIT License.
SB_Workaround()
Shapes_Init_Logo()
name = "Logo"
Group_Add()
Shapes_Normalize()
Shapes_Dump()
Sub Group_Add
' Group | add shapes to a group
' param name - group name
' param shX, shY, origin of shape array
' param shape[] - shape array
' param nGroup - number of group
' return nGroup - updated number of group
' return group - group array
Stack.PushValue("local", i)
Stack.PushValue("local", x)
Stack.PushValue("local", y)
nGroup = nGroup + 1
grp = ""
grp["name"] = name
grp["x"] = shX
grp["y"] = shY
grp["angle"] = 0
grp["dir"] = 1
Shapes_CalcWidthAndHeight()
grp["width"] = shWidth
grp["height"] = shHeight
grp["cx"] = shWidth / 2
grp["cy"] = shHeight / 2
s = 1
grp["scale"] = s
For i = 1 To Array.GetItemCount(shape)
shp = shape[i]
GraphicsWindow.PenWidth = shp["pw"] * s
If shp["pw"] > 0 Then
GraphicsWindow.PenColor = shp["pc"]
EndIf
If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then
GraphicsWindow.BrushColor = shp["bc"]
EndIf
If Text.IsSubText("text|btn", shp["func"]) Then
If silverlight Then
fs = Math.Floor(shp["fs"] * 0.9)
Else
fs = shp["fs"]
EndIf
GraphicsWindow.FontSize = fs * s
GraphicsWindow.FontName = shp["fn"]
If shp["fb"] = "False" Then
GraphicsWindow.FontBold = "False"
Else
GraphicsWindow.FontBold = "True"
EndIf
EndIf
If shp["func"] = "rect" Then
shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s)
ElseIf shp["func"] = "ell" Then
shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s)
ElseIf shp["func"] = "tri" Then
shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s)
ElseIf shp["func"] = "line" Then
shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s)
ElseIf shp["func"] = "text" Then
shp["obj"] = Shapes.AddText(shp["text"])
EndIf
x = shp["x"]
y = shp["y"]
shp["rx"] = x
shp["ry"] = y
If silverlight And Text.IsSubText("tri|line", shp["func"]) Then
alpha = Math.GetRadians(shp["angle"])
SB_RotateWorkaround()
shp["wx"] = x
shp["wy"] = y
EndIf
If shp["func"] = "btn" Then
shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s)
Else
Shapes.Move(shp["obj"], shX + x * s, shY + y * s)
EndIf
If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then
Shapes.Rotate(shp["obj"], shp["angle"])
EndIf
shape[i] = shp
EndFor
grp["shape"] = shape
group[nGroup] = grp
y = Stack.PopValue("local")
x = Stack.PopValue("local")
i = Stack.PopValue("local")
EndSub
Sub SB_RotateWorkaround
' Small Basic | rotate workaround For Silverlight
' param shp - current shape
' param x, y - original coordinate
' param alpha - angle [radian]
' returns x, y - workaround coordinate
If shp["func"] = "tri" Then
x1 = -Math.Floor(shp["x3"] / 2)
y1 = -Math.Floor(shp["y3"] / 2)
ElseIf shp["func"] = "line" Then
x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2)
y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2)
EndIf
ox = x - x1
oy = y - y1
x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox
y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy
EndSub
Sub SB_Workaround
' Small Basic | workaround for Silverlight
' returns silverlight - "True" if in remote
color = GraphicsWindow.GetPixel(0, 0)
If Text.GetLength(color) > 7 Then
silverlight = "True"
msWait = 300
Else
silverlight = "False"
EndIf
EndSub
Sub Shapes_CalcWidthAndHeight
' Shapes | calculate total width and height of shapes
' param shape[] - shape array
' return shWidth, shHeight - total size of shapes
For i = 1 To Array.GetItemCount(shape)
shp = shape[i]
If shp["func"] = "tri" Or shp["func"] = "line" Then
xmin = shp["x1"]
xmax = shp["x1"]
ymin = shp["y1"]
ymax = shp["y1"]
If shp["x2"] < xmin Then
xmin = shp["x2"]
EndIf
If xmax < shp["x2"] Then
xmax = shp["x2"]
EndIf
If shp["y2"] < ymin Then
ymin = shp["y2"]
EndIf
If ymax < shp["y2"] Then
ymax = shp["y2"]
EndIf
If shp["func"] = "tri" Then
If shp["x3"] < xmin Then
xmin = shp["x3"]
EndIf
If xmax < shp["x3"] Then
xmax = shp["x3"]
EndIf
If shp["y3"] < ymin Then
ymin = shp["y3"]
EndIf
If ymax < shp["y3"] Then
ymax = shp["y3"]
EndIf
EndIf
shp["width"] = xmax - xmin
shp["height"] = ymax - ymin
EndIf
If i = 1 Then
shWidth = shp["x"] + shp["width"]
shHeight = shp["y"] + shp["height"]
Else
If shWidth < shp["x"] + shp["width"] Then
shWidth = shp["x"] + shp["width"]
EndIf
If shHeight < shp["y"] + shp["height"] Then
shHeight = shp["y"] + shp["height"]
EndIf
EndIf
shape[i] = shp
EndFor
EndSub
Sub Shapes_Dump
' Shapes | dump shapes data
order = "1=func;2=x;3=y;4=width;5=height;6=x1;7=y1;8=x2;9=y2;"
order = order + "10=x3;11=y3;12=txt;13=fn;14=fs;15=fb;16=fi;"
order = order + "17=angle;18=pw;19=pc;20=bc;"
nOrder = Array.GetItemCount(order)
WQ = Text.GetCharacter(34)
LF = Text.GetCharacter(10)
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontName = "Consolas"
GraphicsWindow.FontSize = 14
tbox = Controls.AddMultiLineTextBox(gw / 2, 10)
Controls.SetSize(tbox, gw / 2 - 10, gh - 20)
buf = " shX = " + shX + " ' x offset" + LF
buf = buf + " shY = " + shY + " ' y offset" + LF
buf = buf + " shape = " + WQ + WQ + LF
For i = 1 To Array.GetItemCount(shape)
buf = buf + " shape[" + i + "] = " + WQ
shp = shape[i]
For j = 1 To nOrder
If shp[order[j]] <> "" Then
buf = buf + order[j] + "=" + shp[order[j]] + ";"
EndIf
EndFor
buf = buf + WQ + LF
EndFor
Controls.SetTextBoxText(tbox, buf)
Shapes.SetOpacity(tbox, 50)
EndSub
Sub Shapes_Init_Logo
' Shapes | initialize sample shapes data
' return shX, shY - current position of shapes
' return shape - array of shapes
shX = 100 ' x offset
shY = 100 ' y offset
shape = ""
shape[1] = "func=tri;x=30;y=0;width=14;height=1;x1=7;y1=0;x2=0;y2=1;x3=14;y3=1;pw=0;bc=#F4501F;"
shape[2] = "func=tri;x=36;y=0;width=14;height=1;x1=7;y1=0;x2=0;y2=1;x3=14;y3=1;pw=0;bc=#7CB70A;"
shape[3] = "func=rect;x=37;y=0;width=3;height=1;pw=0;bc=#F4501F;"
shape[4] = "func=rect;x=40;y=0;width=3;height=1;pw=0;bc=#7CB70A;"
shape[5] = "func=tri;x=23;y=1;width=14;height=3;x1=7;y1=0;x2=0;y2=3;x3=14;y3=3;pw=0;bc=#F4501F;"
shape[6] = "func=tri;x=43;y=1;width=14;height=3;x1=7;y1=0;x2=0;y2=3;x3=14;y3=3;pw=0;bc=#7CB70A;"
shape[7] = "func=rect;x=30;y=1;width=10;height=3;pw=0;bc=#F4501F;"
shape[8] = "func=rect;x=40;y=1;width=10;height=3;pw=0;bc=#7CB70A;"
shape[9] = "func=tri;x=17;y=4;width=12;height=3;x1=6;y1=0;x2=0;y2=3;x3=12;y3=3;pw=0;bc=#F4501F;"
shape[10] = "func=tri;x=51;y=4;width=12;height=3;x1=6;y1=0;x2=0;y2=3;x3=12;y3=3;pw=0;bc=#7CB70A;"
shape[11] = "func=rect;x=23;y=4;width=17;height=3;pw=0;bc=#F4501F;"
shape[12] = "func=rect;x=40;y=4;width=17;height=3;pw=0;bc=#7CB70A;"
shape[13] = "func=tri;x=12;y=7;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;pw=0;bc=#F4501F;"
shape[14] = "func=tri;x=58;y=7;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;pw=0;bc=#7CB70A;"
shape[15] = "func=rect;x=17;y=7;width=23;height=5;pw=0;bc=#F4501F;"
shape[16] = "func=rect;x=40;y=7;width=23;height=5;pw=0;bc=#7CB70A;"
shape[17] = "func=tri;x=7;y=12;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;pw=0;bc=#F4501F;"
shape[18] = "func=tri;x=63;y=12;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;pw=0;bc=#7CB70A;"
shape[19] = "func=rect;x=12;y=12;width=28;height=5;pw=0;bc=#F4501F;"
shape[20] = "func=rect;x=40;y=12;width=28;height=5;pw=0;bc=#7CB70A;"
shape[21] = "func=tri;x=4;y=17;width=6;height=6;x1=3;y1=0;x2=0;y2=6;x3=6;y3=6;pw=0;bc=#F4501F;"
shape[22] = "func=tri;x=70;y=17;width=6;height=6;x1=3;y1=0;x2=0;y2=6;x3=6;y3=6;pw=0;bc=#7CB70A;"
shape[23] = "func=rect;x=7;y=17;width=33;height=6;pw=0;bc=#F4501F;"
shape[24] = "func=rect;x=40;y=17;width=33;height=6;pw=0;bc=#7CB70A;"
shape[25] = "func=tri;x=1;y=23;width=6;height=7;x1=3;y1=0;x2=0;y2=7;x3=6;y3=7;pw=0;bc=#F4501F;"
shape[26] = "func=tri;x=73;y=23;width=6;height=7;x1=3;y1=0;x2=0;y2=7;x3=6;y3=7;pw=0;bc=#7CB70A;"
shape[27] = "func=rect;x=4;y=23;width=36;height=7;pw=0;bc=#F4501F;"
shape[28] = "func=rect;x=40;y=23;width=36;height=7;pw=0;bc=#7CB70A;"
shape[29] = "func=tri;x=0;y=30;width=2;height=7;x1=1;y1=0;x2=0;y2=7;x3=2;y3=7;pw=0;bc=#F4501F;"
shape[30] = "func=tri;x=78;y=30;width=2;height=7;x1=1;y1=0;x2=0;y2=7;x3=2;y3=7;pw=0;bc=#7CB70A;"
shape[31] = "func=rect;x=1;y=30;width=39;height=7;pw=0;bc=#F4501F;"
shape[32] = "func=rect;x=40;y=30;width=39;height=7;pw=0;bc=#7CB70A;"
shape[33] = "func=rect;x=0;y=37;width=40;height=3;pw=0;bc=#F4501F;"
shape[34] = "func=rect;x=40;y=37;width=40;height=3;pw=0;bc=#7CB70A;"
shape[35] = "func=rect;x=0;y=40;width=40;height=3;angle=180;pw=0;bc=#03A3ED;"
shape[36] = "func=rect;x=40;y=40;width=40;height=3;angle=180;pw=0;bc=#FCB901;"
shape[37] = "func=tri;x=0;y=43;width=2;height=7;x1=1;y1=0;x2=0;y2=7;x3=2;y3=7;angle=180;pw=0;bc=#03A3ED;"
shape[38] = "func=tri;x=78;y=43;width=2;height=7;x1=1;y1=0;x2=0;y2=7;x3=2;y3=7;angle=180;pw=0;bc=#FCB901;"
shape[39] = "func=rect;x=1;y=43;width=39;height=7;angle=180;pw=0;bc=#03A3ED;"
shape[40] = "func=rect;x=40;y=43;width=39;height=7;angle=180;pw=0;bc=#FCB901;"
shape[41] = "func=tri;x=1;y=50;width=6;height=7;x1=3;y1=0;x2=0;y2=7;x3=6;y3=7;angle=180;pw=0;bc=#03A3ED;"
shape[42] = "func=tri;x=73;y=50;width=6;height=7;x1=3;y1=0;x2=0;y2=7;x3=6;y3=7;angle=180;pw=0;bc=#FCB901;"
shape[43] = "func=rect;x=4;y=50;width=36;height=7;angle=180;pw=0;bc=#03A3ED;"
shape[44] = "func=rect;x=40;y=50;width=36;height=7;angle=180;pw=0;bc=#FCB901;"
shape[45] = "func=tri;x=4;y=57;width=6;height=6;x1=3;y1=0;x2=0;y2=6;x3=6;y3=6;angle=180;pw=0;bc=#03A3ED;"
shape[46] = "func=tri;x=70;y=57;width=6;height=6;x1=3;y1=0;x2=0;y2=6;x3=6;y3=6;angle=180;pw=0;bc=#FCB901;"
shape[47] = "func=rect;x=7;y=57;width=33;height=6;angle=180;pw=0;bc=#03A3ED;"
shape[48] = "func=rect;x=40;y=57;width=33;height=6;angle=180;pw=0;bc=#FCB901;"
shape[49] = "func=tri;x=7;y=63;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;angle=180;pw=0;bc=#03A3ED;"
shape[50] = "func=tri;x=63;y=63;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;angle=180;pw=0;bc=#FCB901;"
shape[51] = "func=rect;x=12;y=63;width=28;height=5;angle=180;pw=0;bc=#03A3ED;"
shape[52] = "func=rect;x=40;y=63;width=28;height=5;angle=180;pw=0;bc=#FCB901;"
shape[53] = "func=tri;x=12;y=68;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;angle=180;pw=0;bc=#03A3ED;"
shape[54] = "func=tri;x=58;y=68;width=10;height=5;x1=5;y1=0;x2=0;y2=5;x3=10;y3=5;angle=180;pw=0;bc=#FCB901;"
shape[55] = "func=rect;x=17;y=68;width=23;height=5;angle=180;pw=0;bc=#03A3ED;"
shape[56] = "func=rect;x=40;y=68;width=23;height=5;angle=180;pw=0;bc=#FCB901;"
shape[57] = "func=tri;x=17;y=73;width=12;height=3;x1=6;y1=0;x2=0;y2=3;x3=12;y3=3;angle=180;pw=0;bc=#03A3ED;"
shape[58] = "func=tri;x=51;y=73;width=12;height=3;x1=6;y1=0;x2=0;y2=3;x3=12;y3=3;angle=180;pw=0;bc=#FCB901;"
shape[59] = "func=rect;x=23;y=73;width=17;height=3;angle=180;pw=0;bc=#03A3ED;"
shape[60] = "func=rect;x=40;y=73;width=17;height=3;angle=180;pw=0;bc=#FCB901;"
shape[61] = "func=tri;x=23;y=76;width=14;height=3;x1=7;y1=0;x2=0;y2=3;x3=14;y3=3;angle=180;pw=0;bc=#03A3ED;"
shape[62] = "func=tri;x=43;y=76;width=14;height=3;x1=7;y1=0;x2=0;y2=3;x3=14;y3=3;angle=180;pw=0;bc=#FCB901;"
shape[63] = "func=rect;x=30;y=76;width=10;height=3;angle=180;pw=0;bc=#03A3ED;"
shape[64] = "func=rect;x=40;y=76;width=10;height=3;angle=180;pw=0;bc=#FCB901;"
shape[65] = "func=tri;x=30;y=79;width=14;height=1;x1=7;y1=0;x2=0;y2=1;x3=14;y3=1;angle=180;pw=0;bc=#03A3ED;"
shape[66] = "func=tri;x=36;y=79;width=14;height=1;x1=7;y1=0;x2=0;y2=1;x3=14;y3=1;angle=180;pw=0;bc=#FCB901;"
shape[67] = "func=rect;x=37;y=79;width=3;height=1;angle=180;pw=0;bc=#03A3ED;"
shape[68] = "func=rect;x=40;y=79;width=3;height=1;angle=180;pw=0;bc=#FCB901;"
shape[69] = "func=tri;x=22;y=14;width=36;height=8;x1=18;y1=0;x2=0;y2=8;x3=36;y3=8;pw=0;bc=White;"
shape[70] = "func=tri;x=14;y=22;width=16;height=18;x1=8;y1=0;x2=0;y2=18;x3=16;y3=18;pw=0;bc=White;"
shape[71] = "func=tri;x=50;y=22;width=16;height=18;x1=8;y1=0;x2=0;y2=18;x3=16;y3=18;pw=0;bc=White;"
shape[72] = "func=rect;x=22;y=22;width=36;height=18;pw=0;bc=White;"
shape[73] = "func=tri;x=14;y=40;width=16;height=18;x1=8;y1=0;x2=0;y2=18;x3=16;y3=18;angle=180;pw=0;bc=White;"
shape[74] = "func=tri;x=50;y=40;width=16;height=18;x1=8;y1=0;x2=0;y2=18;x3=16;y3=18;angle=180;pw=0;bc=White;"
shape[75] = "func=rect;x=22;y=40;width=36;height=18;angle=180;pw=0;bc=White;"
shape[76] = "func=tri;x=22;y=58;width=36;height=8;x1=18;y1=0;x2=0;y2=8;x3=36;y3=8;angle=180;pw=0;bc=White;"
shape[77] = "func=tri;x=24;y=18;width=32;height=6;x1=16;y1=0;x2=0;y2=6;x3=32;y3=6;pw=0;bc=DimGray;"
shape[78] = "func=tri;x=18;y=24;width=12;height=16;x1=6;y1=0;x2=0;y2=16;x3=12;y3=16;pw=0;bc=DimGray;"
shape[79] = "func=tri;x=50;y=24;width=12;height=16;x1=6;y1=0;x2=0;y2=16;x3=12;y3=16;pw=0;bc=DimGray;"
shape[80] = "func=rect;x=24;y=24;width=32;height=16;pw=0;bc=DimGray;"
shape[81] = "func=tri;x=18;y=40;width=12;height=16;x1=6;y1=0;x2=0;y2=16;x3=12;y3=16;angle=180;pw=0;bc=DimGray;"
shape[82] = "func=tri;x=50;y=40;width=12;height=16;x1=6;y1=0;x2=0;y2=16;x3=12;y3=16;angle=180;pw=0;bc=DimGray;"
shape[83] = "func=rect;x=24;y=40;width=32;height=16;angle=180;pw=0;bc=DimGray;"
shape[84] = "func=tri;x=24;y=56;width=32;height=6;x1=16;y1=0;x2=0;y2=6;x3=32;y3=6;angle=180;pw=0;bc=DimGray;"
shape[85] = "func=tri;x=28;y=23;width=24;height=5;x1=12;y1=0;x2=0;y2=5;x3=24;y3=5;pw=0;bc=White;"
shape[86] = "func=tri;x=23;y=28;width=10;height=12;x1=5;y1=0;x2=0;y2=12;x3=10;y3=12;pw=0;bc=White;"
shape[87] = "func=tri;x=47;y=28;width=10;height=12;x1=5;y1=0;x2=0;y2=12;x3=10;y3=12;pw=0;bc=White;"
shape[88] = "func=rect;x=28;y=28;width=24;height=12;pw=0;bc=White;"
shape[89] = "func=tri;x=23;y=40;width=10;height=12;x1=5;y1=0;x2=0;y2=12;x3=10;y3=12;angle=180;pw=0;bc=White;"
shape[90] = "func=tri;x=47;y=40;width=10;height=12;x1=5;y1=0;x2=0;y2=12;x3=10;y3=12;angle=180;pw=0;bc=White;"
shape[91] = "func=rect;x=28;y=40;width=24;height=12;angle=180;pw=0;bc=White;"
shape[92] = "func=tri;x=28;y=52;width=24;height=5;x1=12;y1=0;x2=0;y2=5;x3=24;y3=5;angle=180;pw=0;bc=White;"
shape[93] = "func=line;x=0;y=40;width=16;height=0;x1=0;y1=0;x2=16;y2=0;pw=3.2;pc=White;"
shape[94] = "func=line;x=11.71;y=11.71;width=11.31;height=11.31;x1=0.00;y1=0.00;x2=11.31;y2=11.31;pw=3.2;pc=White;"
shape[95] = "func=line;x=40;y=0;width=0;height=16;x1=0;y1=0;x2=0;y2=16;pw=3.2;pc=White;"
shape[96] = "func=line;x=56.97;y=11.71;width=11.31;height=11.31;x1=11.31;y1=0.00;x2=0.00;y2=11.31;pw=3.2;pc=White;"
shape[97] = "func=line;x=64;y=39.99;width=16;height=0.00;x1=16;y1=0.00;x2=0;y2=0.00;pw=3.2;pc=White;"
shape[98] = "func=line;x=56.97;y=56.97;width=11.31;height=11.31;x1=11.31;y1=11.31;x2=0.00;y2=0.00;pw=3.2;pc=White;"
shape[99] = "func=line;x=40;y=64;width=0;height=16;x1=0;y1=16;x2=0;y2=0;pw=3.2;pc=White;"
shape[100] = "func=line;x=11.71;y=56.97;width=11.31;height=11.31;x1=0.00;y1=11.31;x2=11.31;y2=0.00;pw=3.2;pc=White;"
shape[101] = "func=line;x=0;y=40;width=16;height=0;x1=0;y1=0;x2=16;y2=0;pw=3.2;pc=White;"
shape[102] = "func=line;x=23.2;y=40;width=33.6;height=0;x1=0.0;y1=0;x2=33.6;y2=0;pw=5.6;pc=DimGray;"
shape[103] = "func=line;x=40;y=23.2;width=0;height=33.6;x1=0;y1=0.0;x2=0;y2=33.6;pw=14.4;pc=DimGray;"
shape[104] = "func=line;x=40;y=14.4;width=0;height=51.2;x1=0;y1=0.0;x2=0;y2=51.2;pw=3.2;pc=White;"
shape[105] = "func=line;x=31.2;y=35.6;width=8.8;height=0.0;x1=0.0;y1=0.0;x2=8.8;y2=0.0;pw=3.2;pc=White;"
shape[106] = "func=line;x=17.6;y=44.4;width=8.8;height=0.0;x1=0.0;y1=0.0;x2=8.8;y2=0.0;pw=3.2;pc=White;"
EndSub
Sub Shapes_Normalize
' Shapes | normalize shapes data
iMax = Array.GetItemCount(shape)
For i = 1 To iMax
shp = shape[i]
If Text.IsSubText("line|tri", shp["func"]) Then
xmin = shp["x1"]
ymin = shp["y1"]
If shp["x2"] < xmin Then
xmin = shp["x2"]
EndIf
If shp["y2"] < ymin Then
ymin = shp["y2"]
EndIf
If shp["func"] = "tri" Then
If shp["x3"] < xmin Then
xmin = shp["x3"]
EndIf
If shp["y3"] < ymin Then
ymin = shp["y3"]
EndIf
shp["x3"] = shp["x3"] - xmin
shp["y3"] = shp["y3"] - ymin
EndIf
shp["x"] = shp["x"] + xmin
shp["y"] = shp["y"] + ymin
shp["x1"] = shp["x1"] - xmin
shp["y1"] = shp["y1"] - ymin
shp["x2"] = shp["x2"] - xmin
shp["y2"] = shp["y2"] - ymin
shape[i] = shp
EndIf
EndFor
If 0 < iMax Then
shp = shape[1]
xmin = shp["x"]
ymin = shp["y"]
xmax = shp["x"]
ymax = shp["y"]
EndIf
For i = 2 To iMax
shp = shape[i]
If shp["x"] < xmin Then
xmin = shp["x"]
EndIf
If shp["y"] < ymin Then
ymin = shp["y"]
EndIf
If xmax < shp["x"] Then
xmax = shp["x"]
EndIf
If ymax < shp["y"] Then
ymax = shp["y"]
EndIf
EndFor
shX = xmin
shY = ymin
For i = 1 To iMax
shp = shape[i]
shp["x"] = shp["x"] - xmin
shp["y"] = shp["y"] - ymin
If shp["angle"] = 0 Then
shp["angle"] = ""
EndIf
shape[i] = shp
EndFor
EndSub