1 |
james |
32 |
REM > JLibraries:Draw.2 |
2 |
|
|
REM © James Bursa, 1997 |
3 |
|
|
|
4 |
|
|
REM JB 05 Dec 1997 created |
5 |
|
|
|
6 |
|
|
|
7 |
|
|
DEF PROCDraw_Init |
8 |
|
|
cm = 18141.73228 :REM 46080 / 2.54 |
9 |
|
|
ENDPROC |
10 |
|
|
|
11 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
12 |
|
|
|
13 |
|
|
DEF PROCDraw_InitFile(Word%, Name$, Crea$, Font$(), Land%, Mult%, Divi%) |
14 |
|
|
LOCAL Draw%, Size%, Loop%, Obje% |
15 |
|
|
|
16 |
|
|
cm = 46080 / 2.54 |
17 |
|
|
|
18 |
|
|
Size% = SUMLEN Font$() + 2 * (DIM(Font$(), 1) + 1) |
19 |
|
|
Size% = ((Size% - 1) AND NOT(3)) + 4 |
20 |
|
|
|
21 |
|
|
IF NOT FNHeap_Grab(4+40+8+Size%, Word%, Name$) THEN ERROR Erro_Memo%, "" |
22 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
23 |
|
|
Draw%!00 = 40+8+Size% :REM file length |
24 |
|
|
|
25 |
|
|
$(Draw% + 04) = "Draw" :REM file header |
26 |
|
|
Draw%!08 = 201 |
27 |
|
|
Draw%!12 = 0 |
28 |
|
|
$(Draw% + 16) = LEFT$(Crea$ + " ", 12) |
29 |
|
|
Draw%!28 = 0 |
30 |
|
|
Draw%!32 = 0 |
31 |
|
|
Draw%!36 = 0 |
32 |
|
|
Draw%!40 = 0 |
33 |
|
|
|
34 |
|
|
Obje% = Draw% + 44 |
35 |
|
|
Obje%!00 = 0 :REM font table object |
36 |
|
|
Obje%!04 = Size% + 8 |
37 |
|
|
Obje% += 8 |
38 |
|
|
FOR Loop% = 0 TO DIM(Font$(), 1) |
39 |
|
|
Obje%?00 = Loop% + 1 |
40 |
|
|
$(Obje% + 01) = Font$(Loop%) |
41 |
|
|
Obje%?(1 + LEN Font$(Loop%)) = 0 |
42 |
|
|
Obje% += 2 + LEN Font$(Loop%) |
43 |
|
|
NEXT |
44 |
|
|
WHILE (Obje% MOD 4) |
45 |
|
|
?Obje% = 0 |
46 |
|
|
Obje% += 1 |
47 |
|
|
ENDWHILE |
48 |
|
|
|
49 |
|
|
Obje% = FNDraw_Object(Word%, Name$, 64, 11, 0, 0, 0, 0) |
50 |
|
|
Obje%!00 = &500 |
51 |
|
|
IF Land% THEN |
52 |
|
|
Obje%!04 = %100010001 |
53 |
|
|
ELSE |
54 |
|
|
Obje%!04 = %100000001 |
55 |
|
|
ENDIF |
56 |
|
|
Obje%!08 = &3FF00000 |
57 |
|
|
Obje%!12 = 0 |
58 |
|
|
Obje%!16 = 2 |
59 |
|
|
Obje%!20 = 0 |
60 |
|
|
Obje%!24 = 1 |
61 |
|
|
Obje%!28 = 0 |
62 |
|
|
Obje%!32 = 0 |
63 |
|
|
Obje%!36 = 1 |
64 |
|
|
Obje%!40 = Mult% |
65 |
|
|
Obje%!44 = Divi% |
66 |
|
|
Obje%!48 = 0 |
67 |
|
|
Obje%!52 = 1 |
68 |
|
|
Obje%!56 = 1<<7 |
69 |
|
|
Obje%!60 = 0 |
70 |
|
|
ENDPROC |
71 |
|
|
|
72 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
73 |
|
|
|
74 |
|
|
DEF FNDraw_Object(Word%, Name$, Size%, Type%, MinX%, MinY%, MaxX%, MaxY%) |
75 |
|
|
LOCAL Draw%, Obje% |
76 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
77 |
|
|
IF NOT FNHeap_ReAlloc(Draw%, 4 + !Draw% + 24 + Size%) THEN ERROR Erro_Memo%, "" |
78 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
79 |
|
|
Obje% = 4 + Draw% + !Draw% |
80 |
|
|
!Draw% += 24 + Size% |
81 |
|
|
Obje%!00 = Type% |
82 |
|
|
Obje%!04 = 24 + Size% |
83 |
|
|
Obje%!08 = MinX% |
84 |
|
|
Obje%!12 = MinY% |
85 |
|
|
Obje%!16 = MaxX% |
86 |
|
|
Obje%!20 = MaxY% |
87 |
|
|
=Obje% + 24 |
88 |
|
|
|
89 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
90 |
|
|
|
91 |
|
|
DEF PROCDraw_Text(Word%, Name$, Font%, Font$, Text$, Xpts, Ypts, XPos%, YPos%, XJus%, YJus%, FCol%, BCol%, Mat1%, Mat2%, Mat3%, Mat4%) |
92 |
|
|
LOCAL Hand%, Wide, High, Obje%, Size%, MinX%, MinY%, MaxX%, MaxY% |
93 |
|
|
|
94 |
|
|
B%!400 = 0 |
95 |
|
|
B%!404 = 0 |
96 |
|
|
B%!408 = 0 |
97 |
|
|
B%!412 = 0 |
98 |
|
|
B%!416 = -1 |
99 |
|
|
|
100 |
|
|
B%!440 = Mat1% |
101 |
|
|
B%!444 = Mat2% |
102 |
|
|
B%!448 = Mat3% |
103 |
|
|
B%!452 = Mat4% |
104 |
|
|
B%!456 = 0 |
105 |
|
|
B%!460 = 0 |
106 |
|
|
|
107 |
|
|
SYS"Font_FindFont",, Font$, Xpts * 16, Ypts * 16 TO Hand% |
108 |
|
|
SYS"Font_ScanString", Hand%, Text$, %1000000001001100000, &FFFFFFFF, &FFFFFFFF, B% + 400, B% + 440 |
109 |
|
|
SYS"Font_LoseFont", Hand% |
110 |
|
|
|
111 |
|
|
MinX% = B%!420 / 1.5625 |
112 |
|
|
MinY% = B%!424 / 1.5625 |
113 |
|
|
MaxX% = B%!428 / 1.5625 |
114 |
|
|
MaxY% = B%!432 / 1.5625 |
115 |
|
|
REMPROCBUG("MinX% = "+STR$MinX%+", MinY% = "+STR$MinY%) |
116 |
|
|
Wide = MaxX% - MinX% |
117 |
|
|
High = MaxY% - MinY% |
118 |
|
|
REMPROCBUG("Wide = "+STR$Wide+", High = "+STR$High) |
119 |
|
|
XPos% -= MinX% |
120 |
|
|
IF XJus% = 2 THEN XPos% -= Wide / 2 |
121 |
|
|
IF XJus% = 3 THEN XPos% -= Wide |
122 |
|
|
YPos% -= MinY% |
123 |
|
|
IF YJus% = 2 THEN YPos% -= High / 2 |
124 |
|
|
IF YJus% = 3 THEN YPos% -= High |
125 |
|
|
REMPROCBUG("XPos% = "+STR$XPos%+", YPos% = "+STR$YPos%) |
126 |
|
|
|
127 |
|
|
Size% = ((LEN Text$) AND NOT(3)) + 4 |
128 |
|
|
Obje% = FNDraw_Object(Word%, Name$, 56 + Size%, 12, XPos%, YPos%, XPos% + Wide, YPos% + High) |
129 |
|
|
|
130 |
|
|
Obje%!00 = Mat1% |
131 |
|
|
Obje%!04 = Mat2% |
132 |
|
|
Obje%!08 = Mat3% |
133 |
|
|
Obje%!12 = Mat4% |
134 |
|
|
Obje%!16 = 0 |
135 |
|
|
Obje%!20 = 0 |
136 |
|
|
Obje%!24 = 1 |
137 |
|
|
|
138 |
|
|
Obje%!28 = FCol% |
139 |
|
|
Obje%!32 = BCol% |
140 |
|
|
Obje%!36 = Font% |
141 |
|
|
Obje%!40 = Xpts * 640 |
142 |
|
|
Obje%!44 = Ypts * 640 |
143 |
|
|
Obje%!48 = XPos% |
144 |
|
|
Obje%!52 = YPos% |
145 |
|
|
$(Obje% + 56) = Text$ |
146 |
|
|
Obje%?(56 + LENText$) = 0 |
147 |
|
|
|
148 |
|
|
ENDPROC |
149 |
|
|
|
150 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
151 |
|
|
|
152 |
|
|
DEF PROCDraw_Sector(Word%, Name$, XPos%, YPos%, Radi%, SAng, EAng, FCol%, OCol%, Wide%) |
153 |
|
|
LOCAL Path%, Arcs%, Loop%, LAng |
154 |
|
|
|
155 |
|
|
PROCDraw_PathStart(Word%, Name$, XPos%, YPos%, XPos% + Radi%, YPos% + Radi%, FCol%, OCol%, Wide%) |
156 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos% + Radi% * SIN(RAD(SAng)), YPos% + Radi% * COS(RAD(SAng))) |
157 |
|
|
|
158 |
|
|
LAng = EAng - SAng |
159 |
|
|
Arcs% = INT(LAng / 90) + 1 |
160 |
|
|
FOR Loop% = 1 TO Arcs% |
161 |
|
|
PROCDraw_PathArc(Word%, Name$, XPos%, YPos%, Radi%, SAng + (LAng / Arcs%) * (Loop% - 1), SAng + (LAng / Arcs%) * Loop%) |
162 |
|
|
NEXT |
163 |
|
|
|
164 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos%, YPos%) |
165 |
|
|
PROCDraw_PathClose(Word%, Name$) |
166 |
|
|
ENDPROC |
167 |
|
|
|
168 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
169 |
|
|
|
170 |
|
|
DEF PROCDraw_PathStart(Word%, Name$, XPos%, YPos%, MaxX%, MaxY%, FCol%, OCol%, Wide%) |
171 |
|
|
LOCAL Draw%, Obje% |
172 |
|
|
Obje% = FNDraw_Object(Word%, Name$, 28, 2, XPos%, YPos%, MaxX%, MaxY%) |
173 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
174 |
|
|
_Draw_Path% = (Obje% - 24) - Draw% |
175 |
|
|
Obje%!00 = FCol% |
176 |
|
|
Obje%!04 = OCol% |
177 |
|
|
Obje%!08 = Wide% |
178 |
|
|
Obje%!12 = 0 |
179 |
|
|
Obje%!16 = 2 |
180 |
|
|
Obje%!20 = XPos% |
181 |
|
|
Obje%!24 = YPos% |
182 |
|
|
ENDPROC |
183 |
|
|
|
184 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
185 |
|
|
|
186 |
|
|
DEF PROCDraw_PathLine(Word%, Name$, XPos%, YPos%) |
187 |
|
|
LOCAL Draw%, Obje% |
188 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
189 |
|
|
IF NOT FNHeap_ReAlloc(Draw%, 4 + !Draw% + 12) THEN ERROR Erro_Memo%, "" |
190 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
191 |
|
|
Obje% = 4 + Draw% + !Draw% |
192 |
|
|
!Draw% += 12 |
193 |
|
|
Obje%!00 = 8 |
194 |
|
|
Obje%!04 = XPos% |
195 |
|
|
Obje%!08 = YPos% |
196 |
|
|
ENDPROC |
197 |
|
|
|
198 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
199 |
|
|
|
200 |
|
|
DEF PROCDraw_PathClose(Word%, Name$) |
201 |
|
|
LOCAL Draw%, Obje% |
202 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
203 |
|
|
IF NOT FNHeap_ReAlloc(Draw%, 4 + !Draw% + 8) THEN ERROR Erro_Memo%, "" |
204 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
205 |
|
|
Obje% = 4 + Draw% + !Draw% |
206 |
|
|
!Draw% += 8 |
207 |
|
|
Obje%!00 = 5 |
208 |
|
|
Obje%!04 = 0 |
209 |
|
|
!(Draw% + _Draw_Path% + 4) = Obje% + 8 - (Draw% + _Draw_Path%) |
210 |
|
|
ENDPROC |
211 |
|
|
|
212 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
213 |
|
|
|
214 |
|
|
DEF PROCDraw_PathArc(Word%, Name$, XPos%, YPos%, Radi%, SAn1, EAn1) |
215 |
|
|
LOCAL Ang1, Ang2, x0, y0, x1, y1, x2, y2, x3, y3, SAng, EAng |
216 |
|
|
LOCAL Draw%, Obje% |
217 |
|
|
|
218 |
|
|
SAng = RAD(SAn1) |
219 |
|
|
EAng = RAD(EAn1) |
220 |
|
|
Radi = Radi% / 256 |
221 |
|
|
Ang1 = SAng + (EAng - SAng) / 3 |
222 |
|
|
Ang2 = SAng + (EAng - SAng) / 1.5 |
223 |
|
|
x0 = Radi * SIN(SAng) |
224 |
|
|
y0 = Radi * COS(SAng) |
225 |
|
|
x1 = Radi * SIN(Ang1) |
226 |
|
|
y1 = Radi * COS(Ang1) |
227 |
|
|
x2 = Radi * SIN(Ang2) |
228 |
|
|
y2 = Radi * COS(Ang2) |
229 |
|
|
x3 = Radi * SIN(EAng) |
230 |
|
|
y3 = Radi * COS(EAng) |
231 |
|
|
|
232 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
233 |
|
|
IF NOT FNHeap_ReAlloc(Draw%, 4 + !Draw% + 28) THEN ERROR Erro_Memo%, "" |
234 |
|
|
Draw% = FNHeap_Find(Word%, Name$) |
235 |
|
|
Obje% = 4 + Draw% + !Draw% |
236 |
|
|
!Draw% += 28 |
237 |
|
|
Obje%!00 = 6 |
238 |
|
|
Obje%!04 = XPos% + 256 * (-5 * x0 / 6 - 1.5 * x2 + 3 * x1 + x3 / 3) |
239 |
|
|
Obje%!08 = YPos% + 256 * (-5 * y0 / 6 - 1.5 * y2 + 3 * y1 + y3 / 3) |
240 |
|
|
Obje%!12 = XPos% + 256 * (-5 * x3 / 6 - 1.5 * x1 + 3 * x2 + x0 / 3) |
241 |
|
|
Obje%!16 = YPos% + 256 * (-5 * y3 / 6 - 1.5 * y1 + 3 * y2 + y0 / 3) |
242 |
|
|
Obje%!20 = XPos% + Radi% * SIN(RAD(EAn1)) |
243 |
|
|
Obje%!24 = YPos% + Radi% * COS(RAD(EAn1)) |
244 |
|
|
ENDPROC |
245 |
|
|
|
246 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
247 |
|
|
|
248 |
|
|
DEF PROCDraw_Box(Word%, Name$, XPos%, YPos%, Wide%, High%, FCol%, OCol%, LWid%) |
249 |
|
|
PROCDraw_PathStart(Word%, Name$, XPos%, YPos%, XPos% + Wide%, YPos% + High%, FCol%, OCol%, LWid%) |
250 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos%, YPos%) |
251 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos% + Wide%, YPos%) |
252 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos% + Wide%, YPos% + High%) |
253 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos%, YPos% + High%) |
254 |
|
|
PROCDraw_PathLine(Word%, Name$, XPos%, YPos%) |
255 |
|
|
PROCDraw_PathClose(Word%, Name$) |
256 |
|
|
ENDPROC |
257 |
|
|
|
258 |
|
|
REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜ |
259 |
|
|
|
260 |
|
|
DEF PROCDraw_Line(Word%, Name$, x1%, y1%, x2%, y2%, OCol%, LWid%) |
261 |
|
|
PROCDraw_PathStart(Word%, Name$, x1%, y1%, x2%, y2%, -1, OCol%, LWid%) |
262 |
|
|
PROCDraw_PathLine(Word%, Name$, x2%, y2%) |
263 |
|
|
PROCDraw_PathClose(Word%, Name$) |
264 |
|
|
ENDPROC |