1 {
2   This file is part of the Free Pascal run time library.
3 
4   A file in Amiga system run time library.
5   Copyright (c) 2003 by Nils Sj�holm.
6   member of the Amiga RTL development team.
7 
8   This is a unit for guigfx.library
9 
10   See the file COPYING.FPC, included in this distribution,
11   for details about the copyright.
12 
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 **********************************************************************}
18 {
19   History:
20 
21   First version of this unit.
22   15 Jan 2003.
23 
24   Changed cardinal > longword.
25   Changed startcode for unit.
26   12 Feb 2003.
27 
28   nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
29 }
30 
31 
32 UNIT GUIGFX;
33 
34 INTERFACE
35 USES Exec,utility,agraphics;
36 
37 VAR GuiGFXBase : pLibrary;
38 
39 const
40     GUIGFXNAME : PChar = 'guigfx.library';
41 
42 
43   {
44         $VER: guigfx.h 17.2 (9.2.2000)
45 
46         guigfx.library definitions
47 
48         � 1997-2000 TEK neoscientists
49    }
50 
51   {
52         Tags
53     }
54 
55   const
56      GGFX_Dummy = 4567 + TAG_USER;
57   { strictly private  }
58      GGFX_Owner = GGFX_Dummy + 0;
59      GGFX_HSType = GGFX_Dummy + 1;
60      GGFX_DitherMode = GGFX_Dummy + 2;
61      GGFX_DitherAmount = GGFX_Dummy + 3;
62      GGFX_AutoDither = GGFX_Dummy + 4;
63      GGFX_DitherThreshold = GGFX_Dummy + 5;
64      GGFX_AspectX = GGFX_Dummy + 6;
65      GGFX_AspectY = GGFX_Dummy + 7;
66      GGFX_PixelFormat = GGFX_Dummy + 8;
67      GGFX_Palette = GGFX_Dummy + 9;
68      GGFX_PaletteFormat = GGFX_Dummy + 10;
69      GGFX_NumColors = GGFX_Dummy + 11;
70      GGFX_Precision = GGFX_Dummy + 12;
71      GGFX_Weight = GGFX_Dummy + 13;
72      GGFX_Ratio = GGFX_Dummy + 14;
73      GGFX_SourceWidth = GGFX_Dummy + 15;
74      GGFX_SourceHeight = GGFX_Dummy + 16;
75      GGFX_SourceX = GGFX_Dummy + 17;
76      GGFX_SourceY = GGFX_Dummy + 18;
77      GGFX_DestWidth = GGFX_Dummy + 19;
78      GGFX_DestHeight = GGFX_Dummy + 20;
79      GGFX_DestX = GGFX_Dummy + 21;
80      GGFX_DestY = GGFX_Dummy + 22;
81      GGFX_CallBackHook = GGFX_Dummy + 23;
82      GGFX_ErrorCode = GGFX_Dummy + 24;
83      GGFX_MaxAllocPens = GGFX_Dummy + 25;
84      GGFX_BufferSize = GGFX_Dummy + 26;
85      GGFX_AlphaPresent = GGFX_Dummy + 27;
86      GGFX_Independent = GGFX_Dummy + 28;
87      GGFX_ModeID = GGFX_Dummy + 29;
88      GGFX_PenTable = GGFX_Dummy + 30;
89   { obsolete  }
90      GGFX_License = GGFX_Dummy + 31;
91      GGFX_BGColor = GGFX_Dummy + 32;
92      GGFX_UseMask = GGFX_Dummy + 33;
93      GGFX_RastLock = GGFX_Dummy + 34;
94      GGFX_FormatName = GGFX_Dummy + 35;
95   {
96         Picture Attributes
97     }
98      PICATTR_Dummy = 123 + TAG_USER;
99      PICATTR_Width = PICATTR_Dummy + 0;
100      PICATTR_Height = PICATTR_Dummy + 1;
101      PICATTR_RawData = PICATTR_Dummy + 2;
102      PICATTR_PixelFormat = PICATTR_Dummy + 3;
103      PICATTR_AspectX = PICATTR_Dummy + 4;
104      PICATTR_AspectY = PICATTR_Dummy + 5;
105      PICATTR_AlphaPresent = PICATTR_Dummy + 6;
106   {
107         Picture Methods
108     }
109      PICMTHD_CROP = 1;
110      PICMTHD_RENDER = 2;
111      PICMTHD_SCALE = 3;
112      PICMTHD_MIX = 4;
113      PICMTHD_SETALPHA = 5;
114      PICMTHD_MIXALPHA = 6;
115      PICMTHD_MAPDRAWHANDLE = 7;
116      PICMTHD_CREATEALPHAMASK = 8;
117      PICMTHD_TINT = 9;
118      PICMTHD_TEXTURE = 10;
119      PICMTHD_SET = 11;
120      PICMTHD_TINTALPHA = 12;
121      PICMTHD_INSERT = 13;
122      PICMTHD_FLIPX = 14;
123      PICMTHD_FLIPY = 15;
124      PICMTHD_CHECKAUTODITHER = 16;
125      PICMTHD_NEGATIVE = 17;
126      PICMTHD_AUTOCROP = 18;
127      PICMTHD_CONVOLVE = 19;
128   {
129         hook message types
130     }
131      GGFX_MSGTYPE_LINEDRAWN = 1;
132   {
133         picture locking
134     }
135      LOCKMODE_DRAWHANDLE = 1;
136      LOCKMODE_FORCE = 1 shl 8;
137      LOCKMODE_MASK = $ff;
138 
139   {
140         bitmap attributes
141         (strictly internal)
142     }
143 
144   const
145      BMAPATTR_Width = 0 + TAG_USER;
146      BMAPATTR_Height = 1 + TAG_USER;
147      BMAPATTR_Depth = 2 + TAG_USER;
148      BMAPATTR_CyberGFX = 3 + TAG_USER;
149      BMAPATTR_BitMapFormat = 4 + TAG_USER;
150      BMAPATTR_PixelFormat = 5 + TAG_USER;
151      BMAPATTR_Flags = 6 + TAG_USER;
152 
153 
AddPaletteAnull154 FUNCTION AddPaletteA(psm : POINTER location 'a0'; palette : POINTER location 'a1'; tags : pTagItem location 'a2') : POINTER; syscall GuiGFXBase 72;
AddPictureAnull155 FUNCTION AddPictureA(psm : POINTER location 'a0'; pic : POINTER location 'a1'; tags : pTagItem location 'a2') : POINTER; syscall GuiGFXBase 66;
AddPixelArrayAnull156 FUNCTION AddPixelArrayA(psm : POINTER location 'a0'; _array : POINTER location 'a1'; width : WORD location 'd0'; height : WORD location 'd1'; tags : pTagItem location 'a2') : POINTER; syscall GuiGFXBase 78;
ClonePictureAnull157 FUNCTION ClonePictureA(pic : POINTER location 'a0'; tags : pTagItem location 'a1') : POINTER; syscall GuiGFXBase 48;
CreateDirectDrawHandleAnull158 FUNCTION CreateDirectDrawHandleA(drawhandle : POINTER location 'a0'; sw : WORD location 'd0'; sh : WORD location 'd1'; dw : WORD location 'd2'; dh : WORD location 'd3'; tags : pTagItem location 'a1') : POINTER; syscall GuiGFXBase 168;
CreatePenShareMapAnull159 FUNCTION CreatePenShareMapA(tags : pTagItem location 'a0') : POINTER; syscall GuiGFXBase 90;
CreatePictureBitMapAnull160 FUNCTION CreatePictureBitMapA(drawhandle : POINTER location 'a0'; pic : POINTER location 'a1'; tags : pTagItem location 'a2') : pBitMap; syscall GuiGFXBase 132;
CreatePictureMaskAnull161 FUNCTION CreatePictureMaskA(pic : POINTER location 'a0'; mask : pCHAR location 'a1'; maskwidth : WORD location 'd0'; tags : pTagItem location 'a2') : BOOLEAN; syscall GuiGFXBase 186;
162 PROCEDURE DeleteDirectDrawHandle(ddh : POINTER location 'a0'); syscall GuiGFXBase 174;
163 PROCEDURE DeletePenShareMap(psm : POINTER location 'a0'); syscall GuiGFXBase 96;
164 PROCEDURE DeletePicture(pic : POINTER location 'a0'); syscall GuiGFXBase 54;
DirectDrawTrueColorAnull165 FUNCTION DirectDrawTrueColorA(ddh : POINTER location 'a0'; _array : pULONG location 'a1'; x : WORD location 'd0'; y : WORD location 'd1'; tags : pTagItem location 'a2') : BOOLEAN; syscall GuiGFXBase 180;
DoPictureMethodAnull166 FUNCTION DoPictureMethodA(pic : POINTER location 'a0'; method : longword location 'd0'; arguments : pULONG location 'a1') : longword; syscall GuiGFXBase 138;
DrawPictureAnull167 FUNCTION DrawPictureA(drawhandle : POINTER location 'a0'; pic : POINTER location 'a1'; x : WORD location 'd0'; y : WORD location 'd1'; tags : pTagItem location 'a2') : BOOLEAN; syscall GuiGFXBase 114;
GetPictureAttrsAnull168 FUNCTION GetPictureAttrsA(pic : POINTER location 'a0'; tags : pTagItem location 'a1') : longword; syscall GuiGFXBase 144;
IsPictureAnull169 FUNCTION IsPictureA(filename : pCHAR location 'a0'; tags : pTagItem location 'a1') : BOOLEAN; syscall GuiGFXBase 162;
LoadPictureAnull170 FUNCTION LoadPictureA(filename : pCHAR location 'a0'; tags : pTagItem location 'a1') : POINTER; syscall GuiGFXBase 36;
LockPictureAnull171 FUNCTION LockPictureA(pic : POINTER location 'a0'; mode : longword location 'd0'; args : pULONG location 'a1') : longword; syscall GuiGFXBase 150;
MakePictureAnull172 FUNCTION MakePictureA(_array : POINTER location 'a0'; width : WORD location 'd0'; height : WORD location 'd1'; tags : pTagItem location 'a1') : POINTER; syscall GuiGFXBase 30;
MapPaletteAnull173 FUNCTION MapPaletteA(drawhandle : POINTER location 'a0'; palette : POINTER location 'a1'; pentab : pCHAR location 'a2'; tags : pTagItem location 'a3') : BOOLEAN; syscall GuiGFXBase 120;
MapPenAnull174 FUNCTION MapPenA(drawhandle : POINTER location 'a0'; rgb : longword location 'a1'; tags : pTagItem location 'a2') : LONGINT; syscall GuiGFXBase 126;
ObtainDrawHandleAnull175 FUNCTION ObtainDrawHandleA(psm : POINTER location 'a0'; a1arg : pRastPort location 'a1'; cm : pColorMap location 'a2'; tags : pTagItem location 'a3') : POINTER; syscall GuiGFXBase 102;
ReadPictureAnull176 FUNCTION ReadPictureA(a0arg : pRastPort location 'a0'; colormap : pColorMap location 'a1'; x : WORD location 'd0'; y : WORD location 'd1'; width : WORD location 'd2'; height : WORD location 'd3'; tags : pTagItem location 'a2') : POINTER; syscall GuiGFXBase 42;
177 PROCEDURE ReleaseDrawHandle(drawhandle : POINTER location 'a0'); syscall GuiGFXBase 108;
178 PROCEDURE RemColorHandle(colorhandle : POINTER location 'a0'); syscall GuiGFXBase 84;
179 PROCEDURE UnLockPicture(pic : POINTER location 'a0'; mode : longword location 'd0'); syscall GuiGFXBase 156;
180 {
181  Functions and procedures with array of PtrUInt go here
182 }
AddPalettenull183 FUNCTION AddPalette(psm : POINTER; palette : POINTER; const tags : array of PtrUInt) : POINTER;
AddPicturenull184 FUNCTION AddPicture(psm : POINTER; pic : POINTER; const tags : array of PtrUInt) : POINTER;
AddPixelArraynull185 FUNCTION AddPixelArray(psm : POINTER; _array : POINTER; width : WORD; height : WORD; const tags : array of PtrUInt) : POINTER;
ClonePicturenull186 FUNCTION ClonePicture(pic : POINTER; const tags : array of PtrUInt) : POINTER;
CreateDirectDrawHandlenull187 FUNCTION CreateDirectDrawHandle(drawhandle : POINTER; sw : WORD; sh : WORD; dw : WORD; dh : WORD; const tags : array of PtrUInt) : POINTER;
CreatePenShareMapnull188 FUNCTION CreatePenShareMap(const tags : array of PtrUInt) : POINTER;
CreatePictureBitMapnull189 FUNCTION CreatePictureBitMap(drawhandle : POINTER; pic : POINTER; const tags : array of PtrUInt) : pBitMap;
CreatePictureMasknull190 FUNCTION CreatePictureMask(pic : POINTER; mask : pCHAR; maskwidth : WORD; const tags : array of PtrUInt) : BOOLEAN;
DirectDrawTrueColornull191 FUNCTION DirectDrawTrueColor(ddh : POINTER; _array : pULONG; x : WORD; y : WORD; const tags : array of PtrUInt) : BOOLEAN;
DoPictureMethodnull192 FUNCTION DoPictureMethod(pic : POINTER; method : longword; const arguments : array of PtrUInt) : longword;
DrawPicturenull193 FUNCTION DrawPicture(drawhandle : POINTER; pic : POINTER; x : WORD; y : WORD; const tags : array of PtrUInt) : BOOLEAN;
GetPictureAttrsnull194 FUNCTION GetPictureAttrs(pic : POINTER; const tags : array of PtrUInt) : longword;
IsPicturenull195 FUNCTION IsPicture(filename : pCHAR; const tags : array of PtrUInt) : BOOLEAN;
LoadPicturenull196 FUNCTION LoadPicture(filename : pCHAR; const tags : array of PtrUInt) : POINTER;
LockPicturenull197 FUNCTION LockPicture(pic : POINTER; mode : longword; const args : array of PtrUInt) : longword;
MakePicturenull198 FUNCTION MakePicture(_array : POINTER; width : WORD; height : WORD; const tags : array of PtrUInt) : POINTER;
MapPalettenull199 FUNCTION MapPalette(drawhandle : POINTER; palette : POINTER; pentab : pCHAR; const tags : array of PtrUInt) : BOOLEAN;
MapPennull200 FUNCTION MapPen(drawhandle : POINTER; rgb : longword; const tags : array of PtrUInt) : LONGINT;
ObtainDrawHandlenull201 FUNCTION ObtainDrawHandle(psm : POINTER; a1arg : pRastPort; cm : pColorMap; const tags : array of PtrUInt) : POINTER;
ReadPicturenull202 FUNCTION ReadPicture(a0arg : pRastPort; colormap : pColorMap; x : WORD; y : WORD; width : WORD; height : WORD; const tags : array of PtrUInt) : POINTER;
203 
204 IMPLEMENTATION
205 
206 {
207  Functions and procedures with array of PtrUInt go here
208 }
AddPalettenull209 FUNCTION AddPalette(psm : POINTER; palette : POINTER; const tags : array of PtrUInt) : POINTER;
210 begin
211     AddPalette := AddPaletteA(psm , palette , @tags);
212 end;
213 
AddPicturenull214 FUNCTION AddPicture(psm : POINTER; pic : POINTER; const tags : array of PtrUInt) : POINTER;
215 begin
216     AddPicture := AddPictureA(psm , pic , @tags);
217 end;
218 
AddPixelArraynull219 FUNCTION AddPixelArray(psm : POINTER; _array : POINTER; width : WORD; height : WORD; const tags : array of PtrUInt) : POINTER;
220 begin
221     AddPixelArray := AddPixelArrayA(psm , _array , width , height , @tags);
222 end;
223 
ClonePicturenull224 FUNCTION ClonePicture(pic : POINTER; const tags : array of PtrUInt) : POINTER;
225 begin
226     ClonePicture := ClonePictureA(pic , @tags);
227 end;
228 
CreateDirectDrawHandlenull229 FUNCTION CreateDirectDrawHandle(drawhandle : POINTER; sw : WORD; sh : WORD; dw : WORD; dh : WORD; const tags : array of PtrUInt) : POINTER;
230 begin
231     CreateDirectDrawHandle := CreateDirectDrawHandleA(drawhandle , sw , sh , dw , dh , @tags);
232 end;
233 
CreatePenShareMapnull234 FUNCTION CreatePenShareMap(const tags : array of PtrUInt) : POINTER;
235 begin
236     CreatePenShareMap := CreatePenShareMapA(@tags);
237 end;
238 
CreatePictureBitMapnull239 FUNCTION CreatePictureBitMap(drawhandle : POINTER; pic : POINTER; const tags : array of PtrUInt) : pBitMap;
240 begin
241     CreatePictureBitMap := CreatePictureBitMapA(drawhandle , pic , @tags);
242 end;
243 
CreatePictureMasknull244 FUNCTION CreatePictureMask(pic : POINTER; mask : pCHAR; maskwidth : WORD; const tags : array of PtrUInt) : BOOLEAN;
245 begin
246     CreatePictureMask := CreatePictureMaskA(pic , mask , maskwidth , @tags);
247 end;
248 
DirectDrawTrueColornull249 FUNCTION DirectDrawTrueColor(ddh : POINTER; _array : pULONG; x : WORD; y : WORD; const tags : array of PtrUInt) : BOOLEAN;
250 begin
251     DirectDrawTrueColor := DirectDrawTrueColorA(ddh , _array , x , y , @tags);
252 end;
253 
DoPictureMethodnull254 FUNCTION DoPictureMethod(pic : POINTER; method : longword; const arguments : array of PtrUInt) : longword;
255 begin
256     DoPictureMethod := DoPictureMethodA(pic , method , @arguments);
257 end;
258 
DrawPicturenull259 FUNCTION DrawPicture(drawhandle : POINTER; pic : POINTER; x : WORD; y : WORD; const tags : array of PtrUInt) : BOOLEAN;
260 begin
261     DrawPicture := DrawPictureA(drawhandle , pic , x , y , @tags);
262 end;
263 
GetPictureAttrsnull264 FUNCTION GetPictureAttrs(pic : POINTER; const tags : array of PtrUInt) : longword;
265 begin
266     GetPictureAttrs := GetPictureAttrsA(pic , @tags);
267 end;
268 
IsPicturenull269 FUNCTION IsPicture(filename : pCHAR; const tags : array of PtrUInt) : BOOLEAN;
270 begin
271     IsPicture := IsPictureA(filename , @tags);
272 end;
273 
LoadPicturenull274 FUNCTION LoadPicture(filename : pCHAR; const tags : array of PtrUInt) : POINTER;
275 begin
276     LoadPicture := LoadPictureA(filename , @tags);
277 end;
278 
LockPicturenull279 FUNCTION LockPicture(pic : POINTER; mode : longword; const args : array of PtrUInt) : longword;
280 begin
281     LockPicture := LockPictureA(pic , mode , @args);
282 end;
283 
MakePicturenull284 FUNCTION MakePicture(_array : POINTER; width : WORD; height : WORD; const tags : array of PtrUInt) : POINTER;
285 begin
286     MakePicture := MakePictureA(_array , width , height , @tags);
287 end;
288 
MapPalettenull289 FUNCTION MapPalette(drawhandle : POINTER; palette : POINTER; pentab : pCHAR; const tags : array of PtrUInt) : BOOLEAN;
290 begin
291     MapPalette := MapPaletteA(drawhandle , palette , pentab , @tags);
292 end;
293 
MapPennull294 FUNCTION MapPen(drawhandle : POINTER; rgb : longword; const tags : array of PtrUInt) : LONGINT;
295 begin
296     MapPen := MapPenA(drawhandle , rgb , @tags);
297 end;
298 
ObtainDrawHandlenull299 FUNCTION ObtainDrawHandle(psm : POINTER; a1arg : pRastPort; cm : pColorMap; const tags : array of PtrUInt) : POINTER;
300 begin
301     ObtainDrawHandle := ObtainDrawHandleA(psm , a1arg , cm , @tags);
302 end;
303 
ReadPicturenull304 FUNCTION ReadPicture(a0arg : pRastPort; colormap : pColorMap; x : WORD; y : WORD; width : WORD; height : WORD; const tags : array of PtrUInt) : POINTER;
305 begin
306     ReadPicture := ReadPictureA(a0arg , colormap , x , y , width , height , @tags);
307 end;
308 
309 const
310     { Change VERSION and LIBVERSION to proper values }
311     VERSION : string[2] = '0';
312     LIBVERSION : longword = 0;
313 
314 initialization
315   GuiGFXBase := OpenLibrary(GUIGFXNAME,LIBVERSION);
316 finalization
317   if Assigned(GuiGFXBase) then
318     CloseLibrary(GuiGFXBase);
319 END. (* UNIT GUIGFX *)
320 
321 
322 
323