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
397
398
399
400
401
402
403
404
|
{
This file is part of the Free Pascal run time library.
A file in Amiga system run time library.
Copyright (c) 2003 by Nils Sjöholm.
member of the Amiga RTL development team.
This is a unit for mysticview.library
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{
History:
First version of this unit.
16 Jan 2003.
Changed startcode for unit.
12 Feb 2003.
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
}
{$mode objfpc}
{$I useamigasmartlink.inc}
{$ifdef use_amiga_smartlink}
{$smartlink on}
{$endif use_amiga_smartlink}
UNIT MYSTICVIEW;
INTERFACE
USES Exec,graphics,utility,intuition;
VAR MysticBase : pLibrary;
const
MYSTICVIEWNAME : PChar = 'mysticview.library';
{
$VER: mysticview.h 4.2 (1.6.99)
mysticview.library definitions
© 1997-99 TEK neoscientists
}
{
Tags
}
const
MVIEW_Dummy = TAG_USER + 765432;
{ left edge in rastport }
MVIEW_DestX = MVIEW_Dummy + 1;
{ top edge in rastport }
MVIEW_DestY = MVIEW_Dummy + 2;
{ width in rastport }
MVIEW_DestWidth = MVIEW_Dummy + 3;
{ height in rastport }
MVIEW_DestHeight = MVIEW_Dummy + 4;
{ background color }
MVIEW_BackColor = MVIEW_Dummy + 5;
{ OBP_Precision (view.h) }
MVIEW_Precision = MVIEW_Dummy + 6;
{ aspect mode - see definitions below }
MVIEW_DisplayMode = MVIEW_Dummy + 7;
{ preview mode - see definitions below }
MVIEW_PreviewMode = MVIEW_Dummy + 8;
{ a guigfx.library picture }
MVIEW_Picture = MVIEW_Dummy + 9;
{ simple text line }
MVIEW_Text = MVIEW_Dummy + 10;
{ static palette }
MVIEW_StaticPalette = MVIEW_Dummy + 11;
{ dither activation mode (see below) }
MVIEW_Dither = MVIEW_Dummy + 12;
{ histogram type }
MVIEW_HSType = MVIEW_Dummy + 13;
{ screen aspect horizontal }
MVIEW_ScreenAspectX = MVIEW_Dummy + 14;
{ screen aspect vertical }
MVIEW_ScreenAspectY = MVIEW_Dummy + 15;
{ dither mode }
MVIEW_DitherMode = MVIEW_Dummy + 16;
{ display cursor }
MVIEW_ShowCursor = MVIEW_Dummy + 17;
{ zoom factor (0.1 ... 10) }
MVIEW_Zoom = MVIEW_Dummy + 18;
{ x position (0 ... 1) }
MVIEW_XPos = MVIEW_Dummy + 19;
{ y position (0 ... 1) }
MVIEW_YPos = MVIEW_Dummy + 20;
{ rotation (0 ... 1) }
MVIEW_Rotation = MVIEW_Dummy + 21;
{ do not use }
MVIEW_AutoDither = MVIEW_Dummy + 22;
{ picture fully drawn }
MVIEW_ReadySignal = MVIEW_Dummy + 23;
{ picture X inside the rastport }
MVIEW_PictureX = MVIEW_Dummy + 24;
{ picture Y inside the rastport }
MVIEW_PictureY = MVIEW_Dummy + 25;
{ picture Width inside the rastport }
MVIEW_PictureWidth = MVIEW_Dummy + 26;
{ picture Height inside the rastport }
MVIEW_PictureHeight = MVIEW_Dummy + 27;
{ indicate scrollability }
MVIEW_DrawArrows = MVIEW_Dummy + 28;
{ show PIP layer }
MVIEW_ShowPip = MVIEW_Dummy + 29;
{ text/grid color }
MVIEW_TextColor = MVIEW_Dummy + 30;
{ color for pip-border, cursor, arrows... }
MVIEW_MarkColor = MVIEW_Dummy + 31;
{ rastport semaphore (MV_Create() only) }
MVIEW_RPSemaphore = MVIEW_Dummy + 32;
{ set task priority (MV_Create() only) }
MVIEW_Priority = MVIEW_Dummy + 33;
{
Types
}
{ image fits exactly into view }
MVDISPMODE_FIT = 0;
{ image is fully visible }
MVDISPMODE_KEEPASPECT_MIN = 1;
{ width or height is fully visible }
MVDISPMODE_KEEPASPECT_MAX = 2;
{ the image aspect is ignored }
MVDISPMODE_ONEPIXEL = 3;
{ aspect ratios are ignored }
MVDISPMODE_IGNOREASPECT = 4;
{ no realtime refresh }
MVPREVMODE_NONE = 0;
{ grid realtime refresh }
MVPREVMODE_GRID = 1;
{ opaque realtime refresh }
MVPREVMODE_OPAQUE = 2;
{ dithering on }
MVDITHERMODE_ON = 0;
{ dithering off }
MVDITHERMODE_OFF = 1;
{ auto dithering }
MVDITHERMODE_AUTO = 2;
FUNCTION MV_CreateA(screen : pScreen; a1arg : pRastPort; tags : pTagItem) : POINTER;
PROCEDURE MV_Delete(mview : POINTER);
PROCEDURE MV_DrawOff(mview : POINTER);
FUNCTION MV_DrawOn(mview : POINTER) : BOOLEAN;
PROCEDURE MV_GetAttrsA(mview : POINTER; tags : pTagItem);
PROCEDURE MV_Refresh(mview : POINTER);
PROCEDURE MV_SetAttrsA(mview : POINTER; tags : pTagItem);
PROCEDURE MV_SetViewRelative(mview : POINTER; x : LONGINT; y : LONGINT);
PROCEDURE MV_SetViewStart(mview : POINTER; x : LONGINT; y : LONGINT);
{
Functions and procedures with array of const go here
}
FUNCTION MV_Create(screen : pScreen; a1arg : pRastPort; const tags : Array Of Const) : POINTER;
PROCEDURE MV_GetAttrs(mview : POINTER; const tags : Array Of Const);
PROCEDURE MV_SetAttrs(mview : POINTER; const tags : Array Of Const);
{You can remove this include and use a define instead}
{$I useautoopenlib.inc}
{$ifdef use_init_openlib}
procedure InitMYSTICVIEWLibrary;
{$endif use_init_openlib}
{This is a variable that knows how the unit is compiled}
var
MYSTICVIEWIsCompiledHow : longint;
IMPLEMENTATION
uses
{$ifndef dont_use_openlib}
msgbox,
{$endif dont_use_openlib}
tagsarray;
FUNCTION MV_CreateA(screen : pScreen; a1arg : pRastPort; tags : pTagItem) : POINTER;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L screen,A0
MOVEA.L a1arg,A1
MOVEA.L tags,A2
MOVEA.L MysticBase,A6
JSR -030(A6)
MOVEA.L (A7)+,A6
MOVE.L D0,@RESULT
END;
END;
PROCEDURE MV_Delete(mview : POINTER);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVEA.L MysticBase,A6
JSR -036(A6)
MOVEA.L (A7)+,A6
END;
END;
PROCEDURE MV_DrawOff(mview : POINTER);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVEA.L MysticBase,A6
JSR -054(A6)
MOVEA.L (A7)+,A6
END;
END;
FUNCTION MV_DrawOn(mview : POINTER) : BOOLEAN;
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVEA.L MysticBase,A6
JSR -048(A6)
MOVEA.L (A7)+,A6
TST.W D0
BEQ.B @end
MOVEQ #1,D0
@end: MOVE.B D0,@RESULT
END;
END;
PROCEDURE MV_GetAttrsA(mview : POINTER; tags : pTagItem);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVEA.L tags,A1
MOVEA.L MysticBase,A6
JSR -066(A6)
MOVEA.L (A7)+,A6
END;
END;
PROCEDURE MV_Refresh(mview : POINTER);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVEA.L MysticBase,A6
JSR -060(A6)
MOVEA.L (A7)+,A6
END;
END;
PROCEDURE MV_SetAttrsA(mview : POINTER; tags : pTagItem);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVEA.L tags,A1
MOVEA.L MysticBase,A6
JSR -042(A6)
MOVEA.L (A7)+,A6
END;
END;
PROCEDURE MV_SetViewRelative(mview : POINTER; x : LONGINT; y : LONGINT);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVE.L x,D0
MOVE.L y,D1
MOVEA.L MysticBase,A6
JSR -078(A6)
MOVEA.L (A7)+,A6
END;
END;
PROCEDURE MV_SetViewStart(mview : POINTER; x : LONGINT; y : LONGINT);
BEGIN
ASM
MOVE.L A6,-(A7)
MOVEA.L mview,A0
MOVE.L x,D0
MOVE.L y,D1
MOVEA.L MysticBase,A6
JSR -072(A6)
MOVEA.L (A7)+,A6
END;
END;
{
Functions and procedures with array of const go here
}
FUNCTION MV_Create(screen : pScreen; a1arg : pRastPort; const tags : Array Of Const) : POINTER;
begin
MV_Create := MV_CreateA(screen , a1arg , readintags(tags));
end;
PROCEDURE MV_GetAttrs(mview : POINTER; const tags : Array Of Const);
begin
MV_GetAttrsA(mview , readintags(tags));
end;
PROCEDURE MV_SetAttrs(mview : POINTER; const tags : Array Of Const);
begin
MV_SetAttrsA(mview , readintags(tags));
end;
const
{ Change VERSION and LIBVERSION to proper values }
VERSION : string[2] = '0';
LIBVERSION : longword = 0;
{$ifdef use_init_openlib}
{$Info Compiling initopening of mysticview.library}
{$Info don't forget to use InitMYSTICVIEWLibrary in the beginning of your program}
var
mysticview_exit : Pointer;
procedure ClosemysticviewLibrary;
begin
ExitProc := mysticview_exit;
if MysticBase <> nil then begin
CloseLibrary(MysticBase);
MysticBase := nil;
end;
end;
procedure InitMYSTICVIEWLibrary;
begin
MysticBase := nil;
MysticBase := OpenLibrary(MYSTICVIEWNAME,LIBVERSION);
if MysticBase <> nil then begin
mysticview_exit := ExitProc;
ExitProc := @ClosemysticviewLibrary;
end else begin
MessageBox('FPC Pascal Error',
'Can''t open mysticview.library version ' + VERSION + #10 +
'Deallocating resources and closing down',
'Oops');
halt(20);
end;
end;
begin
MYSTICVIEWIsCompiledHow := 2;
{$endif use_init_openlib}
{$ifdef use_auto_openlib}
{$Info Compiling autoopening of mysticview.library}
var
mysticview_exit : Pointer;
procedure ClosemysticviewLibrary;
begin
ExitProc := mysticview_exit;
if MysticBase <> nil then begin
CloseLibrary(MysticBase);
MysticBase := nil;
end;
end;
begin
MysticBase := nil;
MysticBase := OpenLibrary(MYSTICVIEWNAME,LIBVERSION);
if MysticBase <> nil then begin
mysticview_exit := ExitProc;
ExitProc := @ClosemysticviewLibrary;
MYSTICVIEWIsCompiledHow := 1;
end else begin
MessageBox('FPC Pascal Error',
'Can''t open mysticview.library version ' + VERSION + #10 +
'Deallocating resources and closing down',
'Oops');
halt(20);
end;
{$endif use_auto_openlib}
{$ifdef dont_use_openlib}
begin
MYSTICVIEWIsCompiledHow := 3;
{$Warning No autoopening of mysticview.library compiled}
{$Warning Make sure you open mysticview.library yourself}
{$endif dont_use_openlib}
END. (* UNIT MYSTICVIEW *)
|