1 { Converted by Sven Hilscher eMail sven@rufus.lan-ks.de
2 from header file grx20.h
3
4 grx20.h ---- GRX 2.x API functions and data structure declarations
5
6 Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
7 [e-mail: csaba@vuse.vanderbilt.edu]
8
9 This file is part of the GRX graphics library.
10
11 The GRX graphics library is free software; you can redistribute it
12 and/or modify it under some conditions; see the "copying.grx" file
13 for details.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. }
18
19 { Define this if you want to use the Linux console version.
20 (Ignored on non-Linux systems.) }
21 {.$define LINUX_CONSOLE}
22 {and this if you use the svgalib (instead of only the framebuffer) driver}
23 {.$define SVGALIB}
24
25 { Define this if you want to use the SDL driver in mingw or x11}
26 {.$define __SDL__}
27
28 {$gnu-pascal,I-}
29 {$ifdef __DJGPP__}
30 {$L grx20}
31 {$elif defined (__MINGW32__)}
32 {$ifdef __SDL__}
33 {$L grx20S, SDL}
34 {$else}
35 {$L grx20}
36 {$endif}
37 {$elif defined (_WIN32)}
38 {$L grxW32, vfs.c, user32, gdi32}
39 {$elif defined (linux) and defined (LINUX_CONSOLE)}
40 {$L grx20}
41 {$ifdef SVGALIB}
42 {$L vga}
43 {$endif}
44 {$else}
45 {$ifdef __SDL__}
46 {$L grx20S, SDL, pthread, X11}
47 {$else}
48 {$L grx20X, X11}
49 {$endif}
50 {$endif}
51
52 { Uncomment those of the following libraries that you need }
53 {.$L tiff}
54 {.$L jpeg}
55 {.$L png}
56 {.$L z}
57 {.$L socket}
58
59 unit GRX;
60
61 interface
62
63 {$if __GPC_RELEASE__ >= 20030303}
64 {$define asmname external name}
65 {$define varasmname external name}
66 {$else}
67 {$define varasmname external; asmname}
68 {$endif}
69 {$if __GPC_RELEASE__ < 20040917}
70 type
71 CInteger = Integer;
72 CCardinal = Cardinal;
73 {$endif}
74
75 const
76 MaxVarSize = MaxInt div 8;
77
78 type
79 MemPtr = ^Char;
80 {$if __GPC_RELEASE__ >= 20030424}
81 GrColor = Integer attribute (Size = 32); { color and operation type, must be 32bit }
82 {$else}
83 GrColor = Integer (32); { color and operation type, must be 32bit }
84 {$endif}
85 GrColorPtr = ^GrColor;
86 GrColors = array [0 .. MaxVarSize div SizeOf (GrColor) - 1] of GrColor;
87 GrColorsPtr = ^GrColors;
88
89 { This definition is compatible with the grx
90 definition 'int pts[][2]' used to define polygons }
91 PointType = record
92 x, y: CInteger
93 end;
94
95 const
96 { these are the supported configurations: }
97 GRX_Version_TCC_8086_DOS = 1; { also works with BCC }
98 GRX_Version_GCC_386_GO32 = 2; { DJGPP }
99 GRX_Version_GCC_386_Linux = 3; { the real stuff }
100 GRX_Version_Generic_X11 = 4; { generic X11 version }
101 GRX_Version_Watcom_DOS4GW = 5; { Watcom C++ 11.0 32 Bit }
102 GRX_VERSION_GCC_386_WIN32 = 7; { WIN32 using Mingw32 }
103 GRX_VERSION_MSC_386_WIN32 = 8; { WIN32 using MS-VC }
104 GRX_VERSION_GCC_386_CYG32 = 9; { WIN32 using CYGWIN }
105 GRX_VERSION_GCC_386_X11 = 10; { X11 version }
106 GRX_VERSION_GCC_X86_64_LINUX = 11; { console framebuffer 64 }
107 GRX_VERSION_GCC_X86_64_X11 = 12; { X11 version 64 }
108
109 { available video modes (for 'GrSetMode') }
110
111 Gr_Unknown_Mode = -1; { initial state }
112 { ============= modes which clear the video memory ============= }
113 Gr_80_25_Text = 0; { Extra parameters for GrSetMode: }
114 Gr_Default_Text = 1;
115 Gr_Width_Height_Text = 2; { Integer w,Integer h }
116 Gr_Biggest_Text = 3;
117 Gr_320_200_Graphics = 4;
118 Gr_Default_Graphics = 5;
119 Gr_Width_Height_Graphics = 6; { Integer w,Integer h }
120 Gr_Biggest_Noninterlaced_Graphics = 7;
121 Gr_Biggest_Graphics = 8;
122 Gr_Width_Height_Color_Graphics = 9; { Integer w,Integer h,Cardinal nc }
123 Gr_Width_Height_Color_Text = 10; { Integer w,Integer h,Cardinal nc }
124 Gr_Custom_Graphics = 11; { Integer w,Integer h,Cardinal nc,Integer vx,Integer vy }
125 { ==== equivalent modes which do not clear the video memory ==== }
126 Gr_NC_80_25_Text = 12;
127 Gr_NC_Default_Text = 13;
128 Gr_NC_Width_Height_Text = 14; { Integer w,Integer h }
129 Gr_NC_Biggest_Text = 15;
130 Gr_NC_320_200_Graphics = 16;
131 Gr_NC_Default_Graphics = 17;
132 Gr_NC_Width_Height_Graphics = 18; { Integer w,Integer h }
133 Gr_NC_Biggest_Noninterlaced_Graphics = 19;
134 Gr_NC_Biggest_Graphics = 20;
135 Gr_NC_Width_Height_Color_Graphics = 21; { Integer w,Integer h,Cardinal nc }
136 Gr_NC_Width_Height_Color_Text = 22; { Integer w,Integer h,Cardinal nc }
137 Gr_NC_Custom_Graphics = 23; { Integer w,Integer h,Cardinal nc,Integer vx,Integer vy }
138 { ==== plane instead of color based modes ==== }
139 { colors = 1 << bpp >>> resort enum for GRX3 <<< }
140 Gr_Width_Height_BPP_Graphics = 24; { Integer w,Integer h,Integer bpp }
141 Gr_Width_Height_BPP_Text = 25; { Integer w,Integer h,Integer bpp }
142 Gr_Custom_BPP_Graphics = 26; { Integer w,Integer h,Integer bpp,Integer vx,Integer vy }
143 Gr_NC_Width_Height_BPP_Graphics = 27; { Integer w,Integer h,Integer bpp }
144 Gr_NC_Width_Height_BPP_Text = 28; { Integer w,Integer h,Integer bpp }
145 Gr_NC_Custom_BPP_Graphics = 29; { Integer w,Integer h,Integer bpp,Integer vx,Integer vy }
146
147 { Available frame modes (video memory layouts) }
148
149 { ====== video frame buffer modes ====== }
150 Gr_FrameUndef = 0; { undefined }
151 Gr_FrameText = 1; { text modes }
152 Gr_FrameHerc1 = 2; { Hercules mono }
153 Gr_FrameEGAVGA1 = 3; { EGA VGA mono }
154 Gr_FrameEGA4 = 4; { EGA 16 color }
155 Gr_FrameSVGA4 = 5; { (Super) VGA 16 color }
156 Gr_FrameSVGA8 = 6; { (Super) VGA 256 color }
157 Gr_FrameVGA8X = 7; { VGA 256 color mode X }
158 Gr_FrameSVGA16 = 8; { Super VGA 32768/65536 color }
159 Gr_FrameSVGA24 = 9; { Super VGA 16M color }
160 Gr_FrameSVGA32L = 10; { Super VGA 16M color padded #1 }
161 Gr_FrameSVGA32H = 11; { Super VGA 16M color padded #2 }
162 { ==== modes provided by the X11 driver ===== }
163 Gr_FrameXWin1 = Gr_FrameEGAVGA1;
164 Gr_FrameXWin4 = Gr_FrameSVGA4;
165 Gr_FrameXWin8 = Gr_FrameSVGA8;
166 Gr_FrameXWin16 = Gr_FrameSVGA16;
167 Gr_FrameXWin24 = Gr_FrameSVGA24;
168 Gr_FrameXWin32L = Gr_FrameSVGA32L;
169 Gr_FrameXWin32H = Gr_FrameSVGA32H;
170 { ==== modes provided by the WIN32 driver ===== }
171 Gr_FrameWIN32_1 = Gr_FrameEGAVGA1;
172 Gr_FrameWIN32_4 = Gr_FrameSVGA4;
173 Gr_FrameWIN32_8 = Gr_FrameSVGA8;
174 Gr_FrameWIN32_16 = Gr_FrameSVGA16;
175 Gr_FrameWIN32_24 = Gr_FrameSVGA24;
176 Gr_FrameWIN32_32L = Gr_FrameSVGA32L;
177 Gr_FrameWIN32_32H = Gr_FrameSVGA32H;
178 { ==== modes provided by the SDL driver ===== }
179 Gr_FrameSDL8 = Gr_FrameSVGA8;
180 Gr_FrameSDL16 = Gr_FrameSVGA16;
181 Gr_FrameSDL24 = Gr_FrameSVGA24;
182 Gr_FrameSDL32L = Gr_FrameSVGA32L;
183 Gr_FrameSDL32H = Gr_FrameSVGA32H;
184 { ==== linear frame buffer modes ====== }
185 Gr_FrameSVGA8_LFB = 12; { (Super) VGA 256 color }
186 Gr_FrameSVGA16_LFB = 13; { Super VGA 32768/65536 color }
187 Gr_FrameSVGA24_LFB = 14; { Super VGA 16M color }
188 Gr_FrameSVGA32L_LFB = 15; { Super VGA 16M color padded #1 }
189 Gr_FrameSVGA32H_LFB = 16; { Super VGA 16M color padded #2 }
190 { ====== system RAM frame buffer modes ====== }
191 Gr_FrameRAM1 = 17; { mono }
192 Gr_FrameRAM4 = 18; { 16 color planar }
193 Gr_FrameRAM8 = 19; { 256 color }
194 Gr_FrameRAM16 = 20; { 32768/65536 color }
195 Gr_FrameRAM24 = 21; { 16M color }
196 Gr_FrameRAM32L = 22; { 16M color padded #1 }
197 Gr_FrameRAM32H = 23; { 16M color padded #2 }
198 Gr_FrameRAM3x8 = 24; { 16M color planar (image mode) }
199 { ====== markers for scanning modes ====== }
200 Gr_FirstTextFrameMode = Gr_FrameText;
201 Gr_LastTextFrameMode = Gr_FrameText;
202 Gr_FirstGraphicsFrameMode = Gr_FrameHerc1;
203 Gr_LastGraphicsFrameMode = Gr_FrameSVGA32H_LFB;
204 Gr_FirstRAMframeMode = Gr_FrameRAM1;
205 Gr_LastRAMframeMode = Gr_FrameRAM3x8;
206
207 { supported video adapter types }
208
209 Gr_Unknown = -1; { not known (before driver set) }
210 Gr_VGA = 0; { VGA adapter }
211 Gr_EGA = 1; { EGA adapter }
212 Gr_Herc = 2; { Hercules mono adapter }
213 Gr_8514A = 3; { 8514A or compatible }
214 Gr_S3 = 4; { S3 graphics accelerator }
215 Gr_XWin = 5; { X11 driver }
216 Gr_WIN32 = 6; { WIN32 driver }
217 Gr_LNXFB = 7; { Linux framebuffer }
218 Gr_SDL = 8; { SDL driver }
219 Gr_Mem = 9; { memory only driver }
220
221 Gr_Max_Polygon_Pointers = 1000000;
222 Gr_Max_Ellipse_Pointers = 1024 + 5;
223 Gr_Max_Angle_Value = 3600;
224 Gr_Arc_Style_Open = 0;
225 Gr_Arc_Style_Close1 = 1;
226 Gr_Arc_Style_Close2 = 2;
227
228 { bits in the GrVideoDriver.drvflags field: }
229 Gr_DriverF_User_Resolution = 1; { set if driver supports user setable arbitrary resolution }
230
231 type
232
233 GrVideoModePtr = ^GrVideoMode;
234
235 { The video driver descriptor structure }
236 { struct _GR_videoDriver }
237 GrVideoDriverPtr = ^GrVideoDriver;
238 GrVideoDriver = record
239 Name : CString; { driver name }
240 Adapter : CInteger; { adapter type }
241 Inherit : GrVideoDriverPtr; { inherit video modes from this }
242 Modes : GrVideoModePtr; { table of supported modes }
243 NModes : CInteger; { number of modes }
CIntegernull244 Detect : function: CInteger;
245 Init : function (Options: CString): CInteger;
246 Reset : procedure;
247 SelectMode: function (Drv: GrVideoDriverPtr; w, h, BPP, txt: CInteger; var ep: CCardinal): GrVideoModePtr;
248 DrvFlags : CCardinal
249 end;
250
251 { Video driver mode descriptor structure }
252 { struct _GR_videoMode }
253 GrVideoMode = record
254 Present: ByteBool; { is it really available? }
255 BPP: Byte; { log2 of # of colors }
256 Width, Height, { video mode geometry }
257 Mode: ShortInt; { BIOS mode number (if any) }
258 LineOffset, { scan line length }
259 PrivData: CInteger; { driver can use it for anything }
260 ExtInfo: ^GrVideoModeExt { extra info (maybe shared) }
261 end;
262
263 { Video driver mode descriptor extension structure. This is a separate
264 structure accessed via a pointer from the main mode descriptor. The
265 reason for this is that frequently several modes can share the same
266 extended info. }
267
268 { struct _GR_videoModeExt }
269 Int2 = array [0 .. 1] of CInteger;
270 GrVideoModeExt = record
271 Mode : CInteger; { frame driver for this video mode }
272 Drv : ^GrFrameDriver; { optional frame driver override }
273 Frame : MemPtr; { frame buffer address }
274 CPrec : array [1 .. 3] of ByteCard; { color component precisions }
275 CPos : array [1 .. 3] of ByteCard; { color component bit positions }
276 Flags : CInteger; { mode flag bits; see "grdriver.h" }
277 Setup : function (var md: GrVideoMode; NoClear: CInteger): CInteger;
278 SetVSize : function (var md: GrVideoMode; w, h: CInteger; var Result: GrVideoMode): CInteger;
279 Scroll : function (var md: GrVideoMode; x, y: CInteger; var Result: Int2): CInteger;
280 SetBank : procedure (bk: CInteger);
281 SetRWBanks : procedure (rb, wb: CInteger);
282 LoadColor : procedure (c, r, g, b: CInteger);
283 LFB_Selector: CInteger
284 end;
285
286 GrFrameDriverPtr = ^GrFrameDriver;
287
288 GrFrameType = record
289 gf_BaseAddr : array [0 .. 3] of MemPtr; { base address of frame memory }
290 gf_Selector : ShortInt; { frame memory segment selector }
291 gf_OnScreen : ByteBool; { is it in video memory ? }
292 gf_MemFlags : Byte; { memory allocation flags }
293 gf_LineOffset: CInteger; { offset to next scan line in bytes }
294 gf_Driver : GrFrameDriverPtr { frame access functions }
295 end;
296
297 { The frame driver descriptor structure. }
298
299 { struct _GR_frameDriver }
300 GrFrameDriver = record
301 Mode, { supported frame access mode }
302 RMode, { matching RAM frame (if video) }
303 Is_Video, { video RAM frame driver ? }
304 Row_Align, { scan line size alignment }
305 Num_Planes, { number of planes }
306 Bits_Per_Pixel : CInteger; { bits per pixel }
307 Max_Plane_Size : MedInt; { maximum plane size in bytes }
308 Init : function (var md: GrVideoMode): CInteger;
309 ReadPixel : function (var c: GrFrameType; x, y: CInteger): GrColor;
310 DrawPixel : procedure (x, y: CInteger; c: GrColor);
311 DrawLine : procedure (x, y, dx, dy: CInteger; c: GrColor);
312 DrawHLine : procedure (x, y, w: CInteger; c: GrColor);
313 DrawVLine : procedure (x, y, h: CInteger; c: GrColor);
314 DrawBlock : procedure (x, y, w, h: CInteger; c: GrColor);
315 DrawBitmap : procedure (x, y, w, h: CInteger; BMP: MemPtr; Pitch, Start: CInteger; fg, bg: GrColor);
316 DrawPattern : procedure (x, y, w: CInteger; Patt: Byte; fg, bg: GrColor);
317 BitBlt : procedure (var Dst: GrFrameType; dx, dy: CInteger; var Src: GrFrameType; x, y, w, h: CInteger; Op: GrColor);
318 BltV2R : procedure (var Dst: GrFrameType; dx, dy: CInteger; var Src: GrFrameType; x, y, w, h: CInteger; Op: GrColor);
319 BltR2V : procedure (var Dst: GrFrameType; dx, dy: CInteger; var Src: GrFrameType; x, y, w, h: CInteger; Op: GrColor);
320 GetIndexedScanline: function (var c: GrFrameType; x, y, w: CInteger; var Index: CInteger): GrColorsPtr;
321 PutScanLine : procedure (x, y, w: CInteger; scl: GrColorsPtr; Op: GrColor);
322 end;
323
324 { driver and mode info structure }
325
326 { extern const struct _GR_driverInfo }
327 GrDriverInfoType = record
328 VDriver : GrVideoDriverPtr; { the current video driver }
329 CurMode : GrVideoModePtr; { current video mode pointer }
330 ActMode : GrVideoMode; { copy of above, resized if virtual }
331 FDriver, { frame driver for the current context }
332 SDriver, { frame driver for the screen }
333 TDriver : GrFrameDriver; { a dummy driver for text modes }
334 MCode, { code for the current mode }
335 DefTW,DefTH, { default text mode size }
336 DefGW,DefGH: CInteger; { default graphics mode size }
337 DefTC,DefGC: GrColor; { default text and graphics colors }
338 VPosX,VPosY, { current virtual viewport position }
339 ErrsFatal, { if set, exit upon errors }
340 ModeRestore, { restore startup video mode if set }
341 SplitBanks, { indicates separate R/W banks }
342 CurBank : CInteger; { currently mapped bank }
343 MdSetHook : procedure; { callback for mode set }
344 SetBank : procedure (bk: CInteger); { banking routine }
345 SetRWBanks : procedure (rb, wb: CInteger); { split banking routine }
346 end;
347
348 var
349 GrDriverInfo: ^GrDriverInfoType; varasmname 'GrDriverInfo';
350
351 { setup stuff }
352
GrSetDrivernull353 function GrSetDriver(DrvSpec: CString):CInteger; asmname 'GrSetDriver';
GrSetModenull354 function GrSetMode(m, w, h, nc, vx, vy:CInteger):CInteger; asmname 'GrSetMode';
GrSetViewportnull355 function GrSetViewport(XPos, YPos: CInteger):CInteger; asmname 'GrSetViewport';
356 procedure GrSetModeHook(HookFunc:Pointer); asmname 'GrSetModeHook';
357 procedure GrSetModeRestore(RestoreFlag:Boolean); asmname 'GrSetModeRestore';
358
359 procedure GrSetErrorHandling(ExitIfError:Boolean); asmname 'GrSetErrorHandling';
360 procedure GrSetEGAVGAmonoDrawnPlane(Plane:CInteger); asmname 'GrSetEGAVGAmonoDrawnPlane';
361 procedure GrSetEGAVGAmonoShownPlane(Plane:CInteger); asmname 'GrSetEGAVGAmonoShownPlane';
362
GrGetLibraryVersionnull363 function GrGetLibraryVersion: CInteger; asmname 'GrGetLibraryVersion';
GrGetLibrarySystemnull364 function GrGetLibrarySystem: CInteger; asmname 'GrGetLibrarySystem';
365
366 { inquiry stuff ---- many of these can be macros }
367
GrCurrentModenull368 function GrCurrentMode:CInteger; asmname 'GrCurrentMode';
GrAdapterTypenull369 function GrAdapterType:CInteger; asmname 'GrAdapterType';
GrCurrentFrameModenull370 function GrCurrentFrameMode:CInteger; asmname 'GrCurrentFrameMode';
GrScreenFrameModenull371 function GrScreenFrameMode:CInteger; asmname 'GrScreenFrameMode';
GrCoreFrameModenull372 function GrCoreFrameMode:CInteger; asmname 'GrCoreFrameMode';
373
GrCurrentVideoDrivernull374 function GrCurrentVideoDriver: GrVideoDriverPtr; asmname 'GrCurrentVideoDriver' ;
GrCurrentVideoModenull375 function GrCurrentVideoMode:GrVideoModePtr; asmname 'GrCurrentVideoMode';
GrVirtualVideoModenull376 function GrVirtualVideoMode:GrVideoModePtr; asmname 'GrVirtualVideoMode';
GrCurrentFrameDrivernull377 function GrCurrentFrameDriver: GrFrameDriverPtr; asmname 'GrCurrentFrameDriver';
GrScreenFrameDrivernull378 function GrScreenFrameDriver: GrFrameDriverPtr; asmname 'GrScreenFrameDriver';
379
GrFirstVideoModenull380 function GrFirstVideoMode(FMode:CInteger):GrVideoModePtr; asmname 'GrFirstVideoMode';
GrNextVideoModenull381 function GrNextVideoMode(Prev:GrVideoModePtr):GrVideoModePtr; asmname 'GrNextVideoMode';
382
GrScreenXnull383 function GrScreenX:CInteger; asmname 'GrScreenX';
GrScreenYnull384 function GrScreenY:CInteger; asmname 'GrScreenY';
GrVirtualXnull385 function GrVirtualX:CInteger; asmname 'GrVirtualX';
GrVirtualYnull386 function GrVirtualY:CInteger; asmname 'GrVirtualY';
GrViewportXnull387 function GrViewportX:CInteger; asmname 'GrViewportX';
GrViewportYnull388 function GrViewportY:CInteger; asmname 'GrViewportY';
GrScreenIsVirtualnull389 function GrScreenIsVirtual:Boolean; asmname 'GrScreenIsVirtual';
390
391 { RAM context geometry and memory allocation inquiry stuff }
392
GrFrameNumPlanesnull393 function GrFrameNumPlanes(md:CInteger):CInteger; asmname 'GrFrameNumPlanes';
GrFrameLineOffsetnull394 function GrFrameLineOffset(md,Width:CInteger):CInteger; asmname 'GrFrameLineOffset';
GrFramePlaneSizenull395 function GrFramePlaneSize(md,w,h:CInteger):CInteger; asmname 'GrFramePlaneSize';
GrFrameContextSizenull396 function GrFrameContextSize(md,w,h:CInteger):CInteger; asmname 'GrFrameContextSize';
397
GrNumPlanesnull398 function GrNumPlanes:CInteger; asmname 'GrNumPlanes';
GrLineOffsetnull399 function GrLineOffset(Width:CInteger):CInteger; asmname 'GrLineOffset';
GrPlaneSizenull400 function GrPlaneSize(w,h:CInteger):CInteger; asmname 'GrPlaneSize';
GrContextSizenull401 function GrContextSize(w,h:CInteger):CInteger; asmname 'GrContextSize';
402
403 { ==================================================================
404 FRAME BUFFER, CONTEXT AND CLIPPING STUFF
405 ================================================================== }
406
407 type
408 { struct _GR_context }
409 GrContextPtr = ^GrContext;
410 GrContext = record
411 gc_Frame: GrFrameType; { frame buffer info }
412 gc_Root: GrContextPtr; { context which owns frame }
413 gc_XMax, { max X coord (width - 1) }
414 gc_YMax, { max Y coord (height - 1) }
415 gc_XOffset, { X offset from root's base }
416 gc_YOffset, { Y offset from root's base }
417 gc_XClipLo, { low X clipping limit }
418 gc_YClipLo, { low Y clipping limit }
419 gc_XClipHi, { high X clipping limit }
420 gc_YClipHi, { high Y clipping limit }
421 gc_UsrXBase, { user window min X coordinate }
422 gc_UsrYBase, { user window min Y coordinate }
423 gc_UsrWidth, { user window width }
424 gc_UsrHeight: CInteger { user window height }
425 end;
426
427 { extern const struct _GR_contextInfo }
428 GrContextInfoType = record
429 Current, { the current context }
430 Screen: GrContext { the screen context }
431 end;
432
433 var
434 GrContextInfo: GrContextInfoType; varasmname 'GrContextInfo';
435
GrCreateContextnull436 function GrCreateContext(w, h: CInteger; Memory: MemPtr; Where: GrContextPtr): GrContextPtr; asmname 'GrCreateContext';
GrCreateFrameContextnull437 function GrCreateFrameContext(md: ByteCard; w, h: CInteger; Memory: MemPtr; Where: GrContextPtr): GrContextPtr; asmname 'GrCreateFrameContext';
GrCreateSubContextnull438 function GrCreateSubContext(x1, y1, x2, y2: CInteger; Parent, Where: GrContextPtr): GrContextPtr; asmname 'GrCreateSubContext';
GrSaveContextnull439 function GrSaveContext(Where: GrContextPtr): GrContextPtr; asmname 'GrSaveContext';
GrCurrentContextnull440 function GrCurrentContext: GrContextPtr; asmname 'GrCurrentContext';
GrScreenContextnull441 function GrScreenContext: GrContextPtr; asmname 'GrScreenContext';
442
443 procedure GrDestroyContext(Context: GrContextPtr); asmname 'GrDestroyContext';
444 procedure GrResizeSubContext(Context: GrContextPtr; x1, y1, x2, y2: CInteger); asmname 'GrResizeSubContext';
445 procedure GrSetContext(Context: GrContextPtr); asmname 'GrSetContext';
446
447 procedure GrSetClipBox(x1, y1, x2, y2:CInteger); asmname 'GrSetClipBox';
448 procedure GrGetClipBox(var x1p, y1p, x2p, y2p: CInteger); asmname 'GrGetClipBox';
449 procedure GrResetClipBox; asmname 'GrResetClipBox';
450
GrMaxXnull451 function GrMaxX: CInteger; asmname 'GrMaxX';
GrMaxYnull452 function GrMaxY: CInteger; asmname 'GrMaxY';
GrSizeXnull453 function GrSizeX:CInteger; asmname 'GrSizeX';
GrSizeYnull454 function GrSizeY:CInteger; asmname 'GrSizeY';
GrLowXnull455 function GrLowX: CInteger; asmname 'GrLowX';
GrLowYnull456 function GrLowY: CInteger; asmname 'GrLowY';
GrHighXnull457 function GrHighX:CInteger; asmname 'GrHighX';
GrHighYnull458 function GrHighY:CInteger; asmname 'GrHighY';
459
460 { ==================================================================
461 COLOR STUFF
462 ================================================================== }
463
464 { Flags to 'OR' to colors for various operations }
465 const
466 GrWrite = 0 ; { write color }
467 GrXor = $01000000 ; { to "xor" any color to the screen }
468 GrOr = $02000000 ; { to "or" to the screen }
469 GrAnd = $03000000 ; { to "and" to the screen }
470 GrImage = $04000000 ; { BLIT: write, except given color }
471 GrCValueMask = $00ffffff ; { color value mask }
472 GrCModeMask = $ff000000 ; { color operation mask }
473 GrNoColor = GrXor or 0 ; { GrNoColor is used for "no" color }
474
GrColorValuenull475 function GrColorValue(c:GrColor):GrColor; asmname 'GrColorValue';
GrColorModenull476 function GrColorMode(c:GrColor):GrColor; asmname 'GrColorMode';
GrWriteModeColornull477 function GrWriteModeColor(c:GrColor):GrColor; asmname 'GrWriteModeColor';
GrXorModeColornull478 function GrXorModeColor(c:GrColor):GrColor; asmname 'GrXorModeColor';
GrOrModeColornull479 function GrOrModeColor(c:GrColor):GrColor; asmname 'GrOrModeColor';
GrAndModeColornull480 function GrAndModeColor(c:GrColor):GrColor; asmname 'GrAndModeColor';
GrImageModeColornull481 function GrImageModeColor(c:GrColor):GrColor; asmname 'GrImageModeColor';
482
483 procedure GrResetColors; asmname 'GrResetColors';
484 procedure GrSetRGBcolorMode; asmname 'GrSetRGBcolorMode';
485 procedure GrRefreshColors; asmname 'GrRefreshColors';
486
GrNumColorsnull487 function GrNumColors:GrColor; asmname 'GrNumColors';
GrNumFreeColorsnull488 function GrNumFreeColors:GrColor; asmname 'GrNumFreeColors';
489
GrBlacknull490 function GrBlack:GrColor; asmname 'GrBlack';
GrWhitenull491 function GrWhite:GrColor; asmname 'GrWhite';
492
GrBuildRGBcolorTnull493 function GrBuildRGBcolorT(r,g,b:CInteger):GrColor; asmname 'GrBuildRGBcolorT';
GrBuildRGBcolorRnull494 function GrBuildRGBcolorR(r,g,b:CInteger):GrColor; asmname 'GrBuildRGBcolorR';
GrRGBcolorRednull495 function GrRGBcolorRed(c:GrColor):CInteger ; asmname 'GrRGBcolorRed';
GrRGBcolorGreennull496 function GrRGBcolorGreen(c:GrColor):CInteger ; asmname 'GrRGBcolorGreen';
GrRGBcolorBluenull497 function GrRGBcolorBlue(c:GrColor):CInteger ; asmname 'GrRGBcolorBlue';
498
GrAllocColornull499 function GrAllocColor(r,g,b:CInteger):GrColor; asmname 'GrAllocColor'; { shared, read-only }
GrAllocColorIDnull500 function GrAllocColorID(r,g,b:CInteger):GrColor; asmname 'GrAllocColorID'; { potentially inlined version }
GrAllocColor2null501 function GrAllocColor2(hcolor:MedInt):GrColor; asmname 'GrAllocColor2'; { $RRGGBB shared, read-only }
GrAllocColor2IDnull502 function GrAllocColor2ID(hcolor:MedInt):GrColor; asmname 'GrAllocColor2ID'; { potentially inlined version }
GrAllocCellnull503 function GrAllocCell:GrColor; asmname 'GrAllocCell'; { unshared, read-write }
504
GrAllocEgaColorsnull505 function GrAllocEgaColors:GrColorsPtr; asmname 'GrAllocEgaColors'; { shared, read-only standard EGA colors }
506
507 procedure GrSetColor(c:GrColor; r,g,b:CInteger); asmname 'GrSetColor';
508 procedure GrFreeColor(c:GrColor); asmname 'GrFreeColor';
509 procedure GrFreeCell(c:GrColor); asmname 'GrFreeCell';
510
511 procedure GrQueryColor(c:GrColor; var r,g,b:CInteger); asmname 'GrQueryColor';
512 procedure GrQueryColorID(c:GrColor; var r,g,b:CInteger); asmname 'GrQueryColorID';
513 procedure GrQueryColor2(c:GrColor; var hcolor:MedInt); asmname 'GrQueryColor2';
514 procedure GrQueryColor2ID(c:GrColor; var hcolor:MedInt); asmname 'GrQueryColor2ID';
515
GrColorSaveBufferSizenull516 function GrColorSaveBufferSize:CInteger ; asmname 'GrColorSaveBufferSize';
517 procedure GrSaveColors(Buffer:Pointer); asmname 'GrSaveColors';
518 procedure GrRestoreColors(Buffer:Pointer); asmname 'GrRestoreColors';
519
520 { ==================================================================
521 GRAPHICS PRIMITIVES
522 ================================================================== }
523
524 type
525 { framed box colors }
526 GrFBoxColors = record
527 fbx_IntColor,
528 fbx_TopColor,
529 fbx_RightColor,
530 fbx_BottomColor,
531 fbx_LeftColor: GrColor
532 end;
533
534 procedure GrClearScreen(bg:GrColor); asmname 'GrClearScreen';
535 procedure GrClearContext(bg:GrColor); asmname 'GrClearContext';
536 procedure GrClearContextC(ctx:GrContextPtr; bg:GrColor); asmname 'GrClearContextC';
537 procedure GrClearClipBox(bg:GrColor); asmname 'GrClearClipBox';
538 procedure GrPlot(x, y: CInteger; c:GrColor); asmname 'GrPlot';
539 procedure GrLine(x1, y1, x2, y2: CInteger; c:GrColor); asmname 'GrLine';
540 procedure GrHLine(x1, x2, y:CInteger; c:GrColor); asmname 'GrHLine';
541 procedure GrVLine(x, y1, y2: CInteger; c: GrColor); asmname 'GrVLine';
542 procedure GrBox(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrBox';
543 procedure GrFilledBox(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrFilledBox';
544 procedure GrFramedBox(x1, y1, x2, y2, Wdt: CInteger; protected var c: GrFBoxColors); asmname 'GrFramedBox';
GrGenerateEllipsenull545 function GrGenerateEllipse(xc, yc, xa, ya:CInteger; var Points{ : array of PointType }):CInteger; asmname 'GrGenerateEllipse';
GrGenerateEllipseArcnull546 function GrGenerateEllipseArc(xc, yc, xa, ya, Start, Ende: CInteger; var Points{ : array of PointType }):CInteger; asmname 'GrGenerateEllipseArc';
547 procedure GrLastArcCoords(var xs, ys, xe, ye, xc, yc: CInteger); asmname 'GrLastArcCoords';
548 procedure GrCircle(xc, yc, r: CInteger; c: GrColor); asmname 'GrCircle';
549 procedure GrEllipse(xc, yc, xa, ya: CInteger; c: GrColor); asmname 'GrEllipse';
550 procedure GrCircleArc(xc, yc, r, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrCircleArc';
551 procedure GrEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrEllipseArc';
552 procedure GrFilledCircle(xc, yc, r: CInteger; c: GrColor); asmname 'GrFilledCircle';
553 procedure GrFilledEllipse(xc, yc, xa, ya: CInteger; c: GrColor); asmname 'GrFilledEllipse';
554 procedure GrFilledCircleArc(xc, yc, r, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrFilledCircleArc';
555 procedure GrFilledEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrFilledEllipseArc';
556 procedure GrPolyLine(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrPolyLine';
557 procedure GrPolygon(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrPolygon';
558 procedure GrFilledConvexPolygon(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrFilledConvexPolygon';
559 procedure GrFilledPolygon(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrFilledPolygon';
560 procedure GrBitBlt(Dest: GrContextPtr; x, y: CInteger; Src: GrContextPtr; x1, y1, x2, y2: CInteger; Op: GrColor); asmname 'GrBitBlt';
GrPixelnull561 function GrPixel(x, y:CInteger):GrColor; asmname 'GrPixel';
GrPixelCnull562 function GrPixelC(c: GrContextPtr; x, y: CInteger): GrColor; asmname 'GrPixelC';
563
564 procedure GrFloodFill(x, y: CInteger; Border, c: GrColor); asmname 'GrFloodFill';
565 procedure GrFloodSpill(x1, y1, x2, y2: CInteger; old_c, new_c: GrColor); asmname 'GrFloodSpill';
566 procedure GrFloodSpill2( x1, y1, x2, y2: CInteger; old_c1, new_c1, old_c2, new_c2: GrColor); asmname 'GrFloodSpill2';
567 procedure GrFloodSpillC(var ctx: GrContext; x1, y1, x2, y2: CInteger; old_c, new_c: GrColor); asmname 'GrFloodSpillC';
568 procedure GrFloodSpillC2(var ctx: GrContext; x1, y1, x2, y2: CInteger; old_c1, new_c1, old_c2, new_c2: GrColor); asmname 'GrFloodSpillC2';
569
GrGetScanlinenull570 function GrGetScanline(x1,x2,yy: CInteger): GrColorsPtr; asmname 'GrGetScanline';
GrGetScanlineCnull571 function GrGetScanlineC(ctx: GrContextPtr; x1,x2,yy: CInteger): GrColorsPtr; asmname 'GrGetScanlineC';
572 { Input ctx: source context, if NULL the current context is used }
573 { x1 : first x coordinate read }
574 { x2 : last x coordinate read }
575 { yy : y coordinate }
576 { Output nil : error / no data (clipping occurred) }
577 { else }
578 { p[0..w]: pixel values read }
579 { (w = |x2-y1|) }
580 { Output data is valid until next GRX call ! }
581
582 procedure GrPutScanline(x1,x2,yy: CInteger;c: GrColorsPtr; Op: GrColor); asmname 'GrPutScanline';
583 { Input x1: first x coordinate to be set }
584 { x2: last x coordinate to be set }
585 { yy: y coordinate }
586 { c : c[0..(|x2-x1|] hold the pixel data }
587 { Op: Operation (GrWRITE/GrXOR/GrOR/GrAND/GrIMAGE) }
588 { }
589 { Note c[..] data must fit GrCVALUEMASK otherwise the results }
590 { are implementation dependend. }
591 { => You can't supply operation code with the pixel data! }
592
593
594 { ==================================================================
595 NON CLIPPING DRAWING PRIMITIVES
596 ================================================================== }
597
598 procedure GrPlotNC(x, y: CInteger; c: GrColor); asmname 'GrPlotNC';
599 procedure GrLineNC(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrLineNC';
600 procedure GrHLineNC(x1, x2, y: CInteger; c: GrColor); asmname 'GrHLineNC';
601 procedure GrVLineNC(x, y1, y2: CInteger; c: GrColor); asmname 'GrVLineNC';
602 procedure GrBoxNC(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrBoxNC';
603 procedure GrFilledBoxNC(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrFilledBoxNC';
604 procedure GrFramedBoxNC(x1, y1, x2, y2, Wdt: CInteger; protected var c: GrFBoxColors); asmname 'GrFramedBoxNC';
605 procedure GrBitBltNC(Dest: GrContextPtr; x, y: CInteger; Src: GrContextPtr; x1, y1, x2, y2: CInteger; Op: GrColor); asmname 'GrBitBltNC';
GrPixelNCnull606 function GrPixelNC(x, y:CInteger):GrColor; asmname 'GrPixelNC';
GrPixelCNCnull607 function GrPixelCNC(c: GrContextPtr; x, y: CInteger): GrColor; asmname 'GrPixelCNC';
608
609 { ==================================================================
610 FONTS AND TEXT PRIMITIVES
611 ================================================================== }
612
613 const
614 { text drawing directions }
615 Gr_Text_Right = 0; { normal }
616 Gr_Text_Down = 1; { downward }
617 Gr_Text_Left = 2; { upside down, right to left }
618 Gr_Text_Up = 3; { upward }
619 Gr_Text_Default = Gr_Text_Right;
620 { Gr_Text_Is_Vertical(d) = ((d) and 1); }
621
622 { text alignment options }
623 Gr_Align_Left = 0; { X only }
624 Gr_Align_Top = 0; { Y only }
625 Gr_Align_Center = 1; { X, Y }
626 Gr_Align_Right = 2; { X only }
627 Gr_Align_Bottom = 2; { Y only }
628 Gr_Align_Baseline = 3; { Y only }
629 Gr_Align_Default = Gr_Align_Left;
630
631 { character types in text strings }
632 Gr_Byte_Text = 0; { one byte per character }
633 Gr_Word_Text = 1; { two bytes per character }
634 Gr_Attr_Text = 2; { chr w/ PC style attribute byte }
635
636 { OR this to the foreground color value for underlined text when
637 using Gr_Byte_Text or Gr_Word_Text modes. }
638 Gr_Underline_Text = GrXor shl 4;
639
640 { Font conversion flags for 'GrLoadConvertedFont'. OR them as desired. }
641 Gr_FontCvt_None = 0; { no conversion }
642 Gr_FontCvt_SkipChars = 1; { load only selected characters }
643 Gr_FontCvt_Resize = 2; { resize the font }
644 Gr_FontCvt_Italicize = 4; { tilt font for "italic" look }
645 Gr_FontCvt_Boldify = 8; { make a "bold"(er) font }
646 Gr_FontCvt_Fixify = 16; { convert prop. font to fixed wdt }
647 Gr_FontCvt_Proportion = 32; { convert fixed font to prop. wdt }
648
649 { font structures }
650 type
651 { font descriptor }
652 GrFontHeader = record
653 Name, { font name }
654 Family: CString; { font family name }
655 Proportional, { characters have varying width }
656 Scalable, { derived from a scalable font }
657 Preloaded, { set when linked Integero program }
658 Modified: ByteBool; { "tweaked" font (resized, etc..) }
659 Width, { width (proportional=>average) }
660 Height, { font height }
661 Baseline, { baseline pixel pos (from top) }
662 ULPos, { underline pixel pos (from top) }
663 ULHeight, { underline width }
664 MinChar, { lowest character code in font }
665 NumChars: CCardinal { number of characters in font }
666 end;
667
668 { character descriptor }
669 GrFontChrInfo = record
670 Width, { width of this character }
671 Offset: CCardinal { offset from start of bitmap }
672 end;
673
674 { the complete font }
675 AuxOffsType = array [0 .. 6] of CInteger;
676 GrFont = record
677 h: GrFontHeader; { the font info structure }
678 BitMap, { character bitmap array }
679 AuxMap: MemPtr; { map for rotated & underline chrs }
680 MinWidth, { width of narrowest character }
681 MaxWidth, { width of widest character }
682 AuxSize, { allocated size of auxiliary map }
683 AuxNext: CCardinal; { next free byte in auxiliary map }
684 AuxOffs: ^AuxOffsType; { offsets to completed aux chars }
685 ChrInfo: array [1 .. 1] of GrFontChrInfo { character info (not act. size) }
686 end;
687 GrFontPtr = ^GrFont;
688
689 var
690 GrFont_PC6x8 : GrFont; varasmname 'GrFont_PC6x8';
691 GrFont_PC8x8 : GrFont; varasmname 'GrFont_PC8x8';
692 GrFont_PC8x14: GrFont; varasmname 'GrFont_PC8x14';
693 GrFont_PC8x16: GrFont; varasmname 'GrFont_PC8x16';
694 GrDefaultFont: GrFont; varasmname 'GrFont_PC8x14';
695
GrLoadFontnull696 function GrLoadFont(FontName: CString): GrFontPtr; asmname 'GrLoadFont';
GrLoadConvertedFontnull697 function GrLoadConvertedFont(FontName: CString; cvt, w, h, MinCh, MaxCh: CInteger): GrFontPtr; asmname 'GrLoadConvertedFont';
GrBuildConvertedFontnull698 function GrBuildConvertedFont(protected var From: GrFont; cvt, w, h, MinCh, MaxCh: CInteger): GrFontPtr; asmname 'GrBuildConvertedFont';
699
700 procedure GrUnloadFont(var Font: GrFont); asmname 'GrUnloadFont';
701 procedure GrDumpFont(protected var f: GrFont; CsymbolName, FileName: CString); asmname 'GrDumpFont';
702 procedure GrSetFontPath(path_list: CString); asmname 'GrSetFontPath';
703
GrFontCharPresentnull704 function GrFontCharPresent(protected var Font: GrFont; Chr: CInteger): Boolean; asmname 'GrFontCharPresent';
GrFontCharWidthnull705 function GrFontCharWidth(protected var Font: GrFont; Chr: CInteger): CInteger; asmname 'GrFontCharWidth';
GrFontCharHeightnull706 function GrFontCharHeight(protected var Font: GrFont; Chr: CInteger): CInteger; asmname 'GrFontCharHeight';
GrFontCharBmpRowSizenull707 function GrFontCharBmpRowSize(protected var Font: GrFont; Chr: CInteger): CInteger; asmname 'GrFontCharBmpRowSize';
GrFontCharBitmapSizenull708 function GrFontCharBitmapSize(protected var Font: GrFont; Chr: CInteger): CInteger; asmname 'GrFontCharBitmapSize';
GrFontStringWidthnull709 function GrFontStringWidth(protected var Font: GrFont; Text: CString; Len, Typ_e: CInteger): CInteger; asmname 'GrFontStringWidth';
GrFontStringHeightnull710 function GrFontStringHeight(protected var Font: GrFont; Text: CString; Len, Typ_e: CInteger): CInteger; asmname 'GrFontStringHeight';
GrProportionalTextWidthnull711 function GrProportionalTextWidth(protected var Font: GrFont; Text: CString; Len, Typ_e: CInteger): CInteger; asmname 'GrProportionalTextWidth';
GrBuildAuxiliaryBitmapnull712 function GrBuildAuxiliaryBitmap(var Font: GrFont; Chr, Dir, ul: CInteger): MemPtr; asmname 'GrBuildAuxiliaryBitmap';
GrFontCharBitmapnull713 function GrFontCharBitmap(protected var Font: GrFont; Chr: CInteger): MemPtr; asmname 'GrFontCharBitmap';
GrFontCharAuxBmpnull714 function GrFontCharAuxBmp(var Font: GrFont; Chr, Dir, ul: CInteger): MemPtr; asmname 'GrFontCharAuxBmp';
715
716 type
717 GrColorTableP = ^GrColors;
718
719 { text color union }
720 GrTextColor = record
721 case 1 .. 2 of
722 1: (v: GrColor); { color value for "direct" text }
723 2: (p: GrColorTableP); { color table for attribute text }
724 end;
725
726 { text drawing option structure }
727 GrTextOption = record
728 txo_Font: GrFontPtr; { font to be used }
729 txo_FgColor, { foreground color }
730 txo_BgColor: GrTextColor; { background color }
731 txo_ChrType, { character type (see above) }
732 txo_Direct, { direction (see above) }
733 txo_XAlign, { X alignment (see above) }
734 txo_YAlign: ByteCard { Y alignment (see above) }
735 end;
736
737 { fixed font text window desc. }
738 GrTextRegion = record
739 txr_Font: GrFontPtr; { font to be used }
740 txr_FgColor, { foreground color }
741 txr_BgColor: GrTextColor; { background color }
742 txr_Buffer, { pointer to text buffer }
743 txr_Backup: Pointer; { optional backup buffer }
744 txr_Width, { width of area in chars }
745 txr_Height, { height of area in chars }
746 txr_LineOffset, { offset in buffer(s) between rows }
747 txr_XPos, { upper left corner X coordinate }
748 txr_YPos: CInteger; { upper left corner Y coordinate }
749 txr_ChrType: ByteCard { character type (see above) }
750 end;
751
GrCharWidthnull752 function GrCharWidth(Chr: CInteger; protected var Opt: GrTextOption): CInteger; asmname 'GrCharWidth';
GrCharHeightnull753 function GrCharHeight(Chr: CInteger; protected var Opt: GrTextOption): CInteger; asmname 'GrCharHeight';
754 procedure GrCharSize(Chr: CInteger; protected var Opt: GrTextOption; var w, h: CInteger); asmname 'GrCharSize';
GrStringWidthnull755 function GrStringWidth(Text: CString; Length: CInteger; protected var Opt: GrTextOption): CInteger; asmname 'GrStringWidth';
GrStringHeightnull756 function GrStringHeight(Text: CString; Length: CInteger; protected var Opt: GrTextOption): CInteger; asmname 'GrStringHeight';
757 procedure GrStringSize(Text: CString; Length: CInteger; protected var Opt: GrTextOption;var w, h: CInteger); asmname 'GrStringSize';
758
759 procedure GrDrawChar(Chr, x, y: CInteger; protected var Opt: GrTextOption); asmname 'GrDrawChar';
760 procedure GrDrawString(Text: CString; Length, x, y: CInteger; protected var Opt: GrTextOption); asmname 'GrDrawString';
761 procedure GrTextXY(x, y: CInteger; Text: CString; fg, bg: GrColor); asmname 'GrTextXY';
762
763 procedure GrDumpChar(Chr, Col, Row: CInteger; protected var r: GrTextRegion); asmname 'GrDumpChar';
764 procedure GrDumpText(Col, Row, Wdt, Hgt: CInteger; protected var r: GrTextRegion); asmname 'GrDumpText';
765 procedure GrDumpTextRegion(protected var r: GrTextRegion); asmname 'GrDumpTextRegion';
766
767 { =================================================================
768 THICK AND DASHED LINE DRAWING PRIMITIVES
769 ================================================================== }
770
771 { custom line option structure
772 zero or one dash pattern length means the line is continuous
773 the dash pattern always begins with a drawn section }
774
775 type
776 GrLineOption = record
777 Lno_Color : GrColor; { color used to draw line }
778 Lno_Width, { width of the line }
779 Lno_PattLen: CInteger; { length of the dash pattern }
780 Lno_DashPat: MemPtr { draw/nodraw pattern }
781 end;
782
783 procedure GrCustomLine(x1, y1, x2, y2: CInteger; protected var o: GrLineOption); asmname 'GrCustomLine';
784 procedure GrCustomBox(x1, y1, x2, y2: CInteger; protected var o: GrLineOption); asmname 'GrCustomBox';
785 procedure GrCustomCircle(xc, yc, r: CInteger; protected var o: GrLineOption); asmname 'GrCustomCircle';
786 procedure GrCustomEllipse(xc, yc, r: CInteger; protected var o: GrLineOption); asmname 'GrCustomEllipse';
787 procedure GrCustomCircleArc(xc, yc, r, Start, Ende, Style: CInteger; protected var o: GrLineOption); asmname 'GrCustomCircleArc';
788 procedure GrCustomEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; protected var o: GrLineOption); asmname 'GrCustomEllipseArc';
789 procedure GrCustomPolyLine(NumPts: CInteger; var Points{ : array of PointType }; protected var o: GrLineOption); asmname 'GrCustomPolyLine';
790 procedure GrCustomPolygon(NumPts: CInteger; var Points{ : array of PointType }; protected var o: GrLineOption); asmname 'GrCustomPolygon';
791
792 { ==================================================================
793 PATTERNED DRAWING AND FILLING PRIMITIVES
794 ================================================================== }
795
796 { BITMAP: a mode independent way to specify a fill pattern of two
797 colors. It is always 8 pixels wide (1 byte per scan line), its
798 height is user-defined. SET THE TYPE FLAG TO ZERO!!! }
799
800 type
801 GrBitmap = record
802 bmp_IsPixMap, { type flag for pattern union }
803 bmp_Height: CInteger; { bitmap height }
804 bmp_Data: MemPtr; { pointer to the bit pattern }
805 bmp_FgColor, { foreground color for fill }
806 bmp_BgColor: GrColor; { background color for fill }
807 bmp_MemFlags: CInteger { set if dynamically allocated }
808 end;
809
810 { PIXMAP: a fill pattern stored in a layout identical to the video RAM
811 for filling using 'bitblt'-s. It is mode dependent, typically one
812 of the library functions is used to build it. KEEP THE TYPE FLAG
813 NONZERO!!! }
814
815 GrPixmap = record
816 pxp_IsPixMap, { type flag for pattern union }
817 pxp_Width, { pixmap width (in pixels) }
818 pxp_Height: CInteger; { pixmap height (in pixels) }
819 pxp_Oper: GrColor; { bitblt mode (SET, OR, XOR, AND, IMAGE) }
820 pxp_Source: GrFrameType { source context for fill }
821 end;
822
823 { Fill pattern union -- can either be a bitmap or a pixmap }
824
825 GrPattern = record
826 case 1 .. 3 of
827 1: (gp_IsPixMap: CInteger); { nonzero for pixmaps }
828 2: (gp_BitMap : GrBitmap); { fill bitmap }
829 3: (gp_PixMap : GrPixmap); { fill pixmap }
830 end;
831 GrPatternPtr = ^GrPattern;
832
833 { Draw pattern for line drawings -- specifies both the:
834 (1) fill pattern, and the
835 (2) custom line drawing option }
836 GrLinePattern = record
837 lnp_Pattern: GrPatternPtr; { fill pattern }
838 lnp_Option : ^GrLineOption { width + dash pattern }
839 end;
840 GrLinePatternPtr = GrLinePattern;
841
GrBuildPixmapnull842 function GrBuildPixmap(protected var Pixels; w, h: CInteger; protected var Colors { : array of GrColor }): GrPatternPtr; asmname 'GrBuildPixmap';
GrBuildPixmapFromBitsnull843 function GrBuildPixmapFromBits(protected var Bits; w, h: CInteger; fgc, bgc: GrColor): GrPatternPtr; asmname 'GrBuildPixmapFromBits';
GrConvertToPixmapnull844 function GrConvertToPixmap(Src: GrContextPtr): GrPatternPtr; asmname 'GrConvertToPixmap';
845
846 procedure GrDestroyPattern(p: GrPatternPtr); asmname 'GrDestroyPattern';
847
848 procedure GrPatternedLine(x1, y1, x2, y2: CInteger; lp: GrLinePatternPtr); asmname 'GrPatternedLine';
849 procedure GrPatternedBox(x1, y1, x2, y2: CInteger; lp: GrLinePatternPtr); asmname 'GrPatternedBox';
850 procedure GrPatternedCircle(xc, yc, r: CInteger; lp: GrLinePatternPtr); asmname 'GrPatternedCircle';
851 procedure GrPatternedEllipse(xc, yc, xa, ya: CInteger; lp: GrLinePatternPtr); asmname 'GrPatternedEllipse';
852 procedure GrPatternedCircleArc(xc, yc, r, Start, Ende, Style: CInteger; lp: GrLinePatternPtr); asmname 'GrPatternedCircleArc';
853 procedure GrPatternedEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; lp: GrLinePatternPtr); asmname 'GrPatternedEllipseArc';
854 procedure GrPatternedPolyLine(NumPts: CInteger; var Points{ : array of PointType }; lp: GrLinePatternPtr); asmname 'GrPatternedPolyLine';
855 procedure GrPatternedPolygon(NumPts: CInteger; var Points{ : array of PointType }; lp: GrLinePatternPtr); asmname 'GrPatternedPolygon';
856
857 procedure GrPatternFilledPlot(x, y: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledPlot';
858 procedure GrPatternFilledLine(x1, y1, x2, y2: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledLine';
859 procedure GrPatternFilledBox(x1, y1, x2, y2: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledBox';
860 procedure GrPatternFilledCircle(xc, yc, r: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledCircle';
861 procedure GrPatternFilledEllipse(xc, yc, xa, ya: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledEllipse';
862 procedure GrPatternFilledCircleArc(xc, yc, r, Start, Ende, Style: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledCircleArc';
863 procedure GrPatternFilledEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledEllipseArc';
864 procedure GrPatternFilledConvexPolygon(NumPts: CInteger; var Points{ : array of PointType }; p: GrPatternPtr); asmname 'GrPatternFilledConvexPolygon';
865 procedure GrPatternFilledPolygon(NumPts: CInteger; var Points{ : array of PointType }; p: GrPatternPtr); asmname 'GrPatternFilledPolygon';
866 procedure GrPatternFloodFill(x, y: CInteger; Border: GrColor; p: GrPatternPtr); asmname 'GrPatternFloodFill';
867
868 procedure GrPatternDrawChar(Chr, x, y: CInteger; protected var Opt: GrTextOption; p: GrPatternPtr); asmname 'GrPatternDrawChar';
869 procedure GrPatternDrawString(Text: CString; Length, x, y: CInteger; protected var Opt: GrTextOption; p: GrPatternPtr); asmname 'GrPatternDrawString';
870 procedure GrPatternDrawStringExt(Text: CString; Length, x, y: CInteger; protected var Opt: GrTextOption; p: GrPatternPtr); asmname 'GrPatternDrawStringExt';
871
872
873 { ==================================================================
874 IMAGE MANIPULATION
875 ================================================================== }
876
877 { <image.h> - Image Utility
878 by Michal Stencl Copyright (c) 1998 for GRX
879 <e-mail> - [stenclpmd@ba.telecom.sk] }
880
881 type
882 GrImagePtr = ^GrPixmap;
883
884 { Flags for GrImageInverse() }
885 const
886 Gr_Image_Inverse_LR = 1; { inverse left right }
887 Gr_Image_Inverse_TD = 2; { inverse top down }
888
GrImageBuildnull889 function GrImageBuild(protected var Pixels; w, h: CInteger; protected var Colors { : array of GrColor }): GrImagePtr; asmname 'GrImageBuild';
890 procedure GrImageDestroy(i: GrImagePtr); asmname 'GrImageDestroy';
891 procedure GrImageDisplay(x,y: CInteger; i: GrImagePtr); asmname 'GrImageDisplay';
892 procedure GrImageDisplayExt(x1,y1,x2,y2: CInteger; i: GrImagePtr); asmname 'GrImageDisplayExt';
893 procedure GrImageFilledBoxAlign(xo,yo,x1,y1,x2,y2: CInteger; p: GrImagePtr); asmname 'GrImageFilledBoxAlign';
894 procedure GrImageHLineAlign(xo,yo,x,y,Width: CInteger; p: GrImagePtr); asmname 'GrImageHLineAlign';
895 procedure GrImagePlotAlign(xo,yo,x,y: CInteger; p: GrImagePtr); asmname 'GrImagePlotAlign';
896
GrImageInversenull897 function GrImageInverse(p: GrImagePtr; Flag: CInteger): GrImagePtr; asmname 'GrImageInverse';
GrImageStretchnull898 function GrImageStretch(p: GrImagePtr; NWidth, NHeight: CInteger): GrImagePtr; asmname 'GrImageStretch';
899
GrImageFromPatternnull900 function GrImageFromPattern(p: GrPatternPtr): GrImagePtr; asmname 'GrImageFromPattern';
GrImageFromContextnull901 function GrImageFromContext(c: GrContextPtr): GrImagePtr; asmname 'GrImageFromContext';
GrImageBuildUsedAsPatternnull902 function GrImageBuildUsedAsPattern(protected var Pixels; w, h: CInteger; protected var Colors { : array of GrColor }): GrImagePtr; asmname 'GrImageBuildUsedAsPattern';
903
GrPatternFromImagenull904 function GrPatternFromImage(i: GrImagePtr): GrPatternPtr; asmname 'GrPatternFromImage';
905
906 { ==================================================================
907 DRAWING IN USER WINDOW COORDINATES
908 ================================================================== }
909
910 procedure GrSetUserWindow(x1, y1, x2, y2: CInteger); asmname 'GrSetUserWindow';
911 procedure GrGetUserWindow(var x1, y1, x2, y2: CInteger); asmname 'GrGetUserWindow';
912 procedure GrGetScreenCoord(var x, y: CInteger); asmname 'GrGetScreenCoord';
913 procedure GrGetUserCoord(var x, y: CInteger); asmname 'GrGetUserCoord';
914
915 procedure GrUsrPlot(x, y: CInteger; c:GrColor); asmname 'GrUsrPlot';
916 procedure GrUsrLine(x1, y1, x2, y2: CInteger; c:GrColor); asmname 'GrUsrLine';
917 procedure GrUsrHLine(x1, x2, y:CInteger; c:GrColor); asmname 'GrUsrHLine';
918 procedure GrUsrVLine(x, y1, y2: CInteger; c: GrColor); asmname 'GrUsrVLine';
919 procedure GrUsrBox(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrUsrBox';
920 procedure GrUsrFilledBox(x1, y1, x2, y2: CInteger; c: GrColor); asmname 'GrUsrFilledBox';
921 procedure GrUsrFramedBox(x1, y1, x2, y2, Wdt: CInteger; c: GrFBoxColors); asmname 'GrUsrFramedBox';
922
923 procedure GrUsrCircle(xc, yc, r: CInteger; c: GrColor); asmname 'GrUsrCircle';
924 procedure GrUsrEllipse(xc, yc, xa, ya: CInteger; c: GrColor); asmname 'GrUsrEllipse';
925 procedure GrUsrCircleArc(xc, yc, r, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrUsrCircleArc';
926 procedure GrUsrEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrUsrEllipseArc';
927 procedure GrUsrFilledCircle(xc, yc, r: CInteger; c: GrColor); asmname 'GrUsrFilledCircle';
928 procedure GrUsrFilledEllipse(xc, yc, xa, ya: CInteger; c: GrColor); asmname 'GrUsrFilledEllipse';
929 procedure GrUsrFilledCircleArc(xc, yc, r, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrUsrFilledCircleArc';
930 procedure GrUsrFilledEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; c: GrColor); asmname 'GrUsrFilledEllipseArc';
931 procedure GrUsrPolyLine(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrUsrPolyLine';
932 procedure GrUsrPolygon(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrUsrPolygon';
933 procedure GrUsrFilledConvexPolygon(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrUsrFilledConvexPolygon';
934 procedure GrUsrFilledPolygon(NumPts: CInteger; var Points{ : array of PointType }; c: GrColor); asmname 'GrUsrFilledPolygon';
935 procedure GrUsrFloodFill(x, y: CInteger; Border, c: GrColor); asmname 'GrUsrFloodFill';
936
GrUsrPixelnull937 function GrUsrPixel(x, y:CInteger):GrColor; asmname 'GrUsrPixel';
GrUsrPixelCnull938 function GrUsrPixelC(c: GrContextPtr; x, y: CInteger):GrColor; asmname 'GrUsrPixelC';
939
940 procedure GrUsrCustomLine(x1, y1, x2, y2: CInteger; protected var o: GrLineOption); asmname 'GrUsrCustomLine';
941 procedure GrUsrCustomBox(x1, y1, x2, y2: CInteger; protected var o: GrLineOption); asmname 'GrUsrCustomBox';
942 procedure GrUsrCustomCircle(xc, yc, r: CInteger; protected var o: GrLineOption); asmname 'GrUsrCustomCircle';
943 procedure GrUsrCustomEllipse(xc, yc, r: CInteger; protected var o: GrLineOption); asmname 'GrUsrCustomEllipse';
944 procedure GrUsrCustomCircleArc(xc, yc, r, Start, Ende, Style: CInteger; protected var o: GrLineOption); asmname 'GrUsrCustomCircleArc';
945 procedure GrUsrCustomEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; protected var o: GrLineOption); asmname 'GrUsrCustomEllipseArc';
946 procedure GrUsrCustomPolyLine(NumPts: CInteger; var Points{ : array of PointType }; protected var o: GrLineOption); asmname 'GrUsrCustomPolyLine';
947 procedure GrUsrCustomPolygon(NumPts: CInteger; var Points{ : array of PointType }; protected var o: GrLineOption); asmname 'GrUsrCustomPolygon';
948
949 procedure GrUsrPatternedLine(x1, y1, x2, y2: CInteger; lp: GrLinePatternPtr); asmname 'GrUsrPatternedLine';
950 procedure GrUsrPatternedBox(x1, y1, x2, y2: CInteger; lp: GrLinePatternPtr); asmname 'GrUsrPatternedBox';
951 procedure GrUsrPatternedCircle(xc, yc, r: CInteger; lp: GrLinePatternPtr); asmname 'GrUsrPatternedCircle';
952 procedure GrUsrPatternedEllipse(xc, yc, xa, ya: CInteger; lp: GrLinePatternPtr); asmname 'GrUsrPatternedEllipse';
953 procedure GrUsrPatternedCircleArc(xc, yc, r, Start, Ende, Style: CInteger; lp: GrLinePatternPtr); asmname 'GrUsrPatternedCircleArc';
954 procedure GrUsrPatternedEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; lp: GrLinePatternPtr); asmname 'GrUsrPatternedEllipseArc';
955 procedure GrUsrPatternedPolyLine(NumPts: CInteger; var Points{ : array of PointType }; lp: GrLinePatternPtr); asmname 'GrUsrPatternedPolyLine';
956 procedure GrUsrPatternedPolygon(NumPts: CInteger; var Points{ : array of PointType }; lp: GrLinePatternPtr); asmname 'GrUsrPatternedPolygon';
957
958 procedure GrUsrPatternFilledPlot(x, y: CInteger; p: GrPatternPtr); asmname 'GrPatternFilledPlot';
959 procedure GrUsrPatternFilledLine(x1, y1, x2, y2: CInteger; p: GrPatternPtr); asmname 'GrUsrPatternFilledLine';
960 procedure GrUsrPatternFilledBox(x1, y1, x2, y2: CInteger; p: GrPatternPtr); asmname 'GrUsrPatternFilledBox';
961 procedure GrUsrPatternFilledCircle(xc, yc, r: CInteger; p: GrPatternPtr); asmname 'GrUsrPatternFilledCircle';
962 procedure GrUsrPatternFilledEllipse(xc, yc, xa, ya: CInteger; p: GrPatternPtr); asmname 'GrUsrPatternFilledEllipse';
963 procedure GrUsrPatternFilledCircleArc(xc, yc, r, Start, Ende, Style: CInteger; p: GrPatternPtr); asmname 'GrUsrPatternFilledCircleArc';
964 procedure GrUsrPatternFilledEllipseArc(xc, yc, xa, ya, Start, Ende, Style: CInteger; p: GrPatternPtr); asmname 'GrUsrPatternFilledEllipseArc';
965 procedure GrUsrPatternFilledConvexPolygon(NumPts: CInteger; var Points{ : array of PointType }; p: GrPatternPtr); asmname 'GrUsrPatternFilledConvexPolygon';
966 procedure GrUsrPatternFilledPolygon(NumPts: CInteger; var Points{ : array of PointType }; p: GrPatternPtr); asmname 'GrUsrPatternFilledPolygon';
967 procedure GrUsrPatternFloodFill(x, y: CInteger; Border: GrColor; p: GrPatternPtr); asmname 'GrUsrPatternFloodFill';
968
969 procedure GrUsrDrawChar(Chr, x, y: CInteger; protected var Opt: GrTextOption); asmname 'GrUsrDrawChar';
970 procedure GrUsrDrawString(Text: CString; Length, x, y: CInteger; protected var Opt: GrTextOption); asmname 'GrUsrDrawString';
971 procedure GrUsrTextXY(x, y: CInteger; Text: CString; fg, bg: CInteger); asmname 'GrUsrTextXY';
972
973 { ==================================================================
974 GRAPHICS CURSOR UTILITIES
975 ================================================================== }
976
977 type
978 GrCursor = record
979 Work: GrContext; { work areas (4) }
980 XCord,YCord, { cursor position on screen }
981 XSize,YSize, { cursor size }
982 XOffs,YOffs, { LU corner to hot point offset }
983 XWork,YWork, { save/work area sizes }
984 XWPos,YWPos, { save/work area position on screen }
985 Displayed: CInteger { set if displayed }
986 end;
987 GrCursorPtr = ^GrCursor;
988
GrBuildCursornull989 function GrBuildCursor(Pixels: Pointer; Pitch, w, h, xo, yo: CInteger; protected var Colors { : array of GrColor }): GrCursorPtr; asmname 'GrBuildCursor';
990 procedure GrDestroyCursor(Cursor: GrCursorPtr); asmname 'GrDestroyCursor';
991 procedure GrDisplayCursor(Cursor: GrCursorPtr); asmname 'GrDisplayCursor';
992 procedure GrEraseCursor(Cursor: GrCursorPtr); asmname 'GrEraseCursor';
993 procedure GrMoveCursor(Cursor: GrCursorPtr; x, y: CInteger); asmname 'GrMoveCursor';
994
995 { ==================================================================
996 MOUSE AND KEYBOARD INPUT UTILITIES
997 ================================================================== }
998
999 const
1000 Gr_M_Motion = $0001; { mouse event flag bits }
1001 Gr_M_Left_Down = $0002;
1002 Gr_M_Left_Up = $0004;
1003 Gr_M_Right_Down = $0008;
1004 Gr_M_Right_Up = $0010;
1005 Gr_M_Middle_Down = $0020;
1006 Gr_M_Middle_Up = $0040;
1007 Gr_M_P4_Down = $0400;
1008 Gr_M_P4_Up = $0800;
1009 Gr_M_P5_Down = $2000;
1010 Gr_M_P5_Up = $4000;
1011 Gr_M_Button_Down = Gr_M_Left_Down or Gr_M_Middle_Down or Gr_M_Right_Down or Gr_M_P4_Down or Gr_M_P5_Down;
1012 Gr_M_Button_Up = Gr_M_Left_Up or Gr_M_Middle_Up or Gr_M_Right_Up or Gr_M_P4_Up or Gr_M_P5_Up;
1013 Gr_M_Button_Change = Gr_M_Button_Up or Gr_M_Button_Down;
1014
1015 Gr_M_Left = $01; { mouse button index bits }
1016 Gr_M_Right = $02;
1017 Gr_M_Middle = $04;
1018 Gr_M_P4 = $08;
1019 Gr_M_P5 = $10;
1020
1021 Gr_M_KeyPress = $0080; { other event flag bits }
1022 Gr_M_Poll = $0100;
1023 Gr_M_NoPaint = $0200;
1024 Gr_Command = $1000;
1025 Gr_M_Event = Gr_M_Motion or Gr_M_KeyPress or Gr_M_Button_Change or Gr_Command;
1026
1027 Gr_KB_RightShift = $01; { Keybd states: right shift key depressed }
1028 Gr_KB_LeftShift = $02; { left shift key depressed }
1029 Gr_KB_Ctrl = $04; { CTRL depressed }
1030 Gr_KB_Alt = $08; { ALT depressed }
1031 Gr_KB_ScrolLock = $10; { SCROLL LOCK active }
1032 Gr_KB_NumLock = $20; { NUM LOCK active }
1033 Gr_KB_CapsLock = $40; { CAPS LOCK active }
1034 Gr_KB_Insert = $80; { INSERT state active }
1035 Gr_KB_Shift = Gr_KB_LeftShift or Gr_KB_RightShift;
1036
1037 Gr_M_Cur_Normal = 0; { MOUSE CURSOR modes: just the cursor }
1038 Gr_M_Cur_Rubber = 1; { rectangular rubber band (XOR-d to the screen) }
1039 Gr_M_Cur_Line = 2; { line attached to the cursor }
1040 Gr_M_Cur_Box = 3; { rectangular box dragged by the cursor }
1041 Gr_M_Cur_Cross = 4; { crosshair }
1042
1043 Gr_M_Queue_Size = 128; { default queue size }
1044
1045 type
1046 { mouse event buffer structure }
1047 GrMouseEvent = record
1048 Flags, { event type flags (see above) }
1049 x, y, { mouse coordinates }
1050 Buttons, { mouse button state }
1051 Key, { key code from keyboard }
1052 KBStat: CInteger; { keybd status (ALT, CTRL, etc..) }
1053 DTime: MedInt { time since last event (msec) }
1054 end;
1055 GrMouseEventPtr = ^GrMouseEvent;
1056
GrMouseDetectnull1057 function GrMouseDetect: Boolean; asmname 'GrMouseDetect';
1058 procedure GrMouseEventMode(Dummy: CInteger); asmname 'GrMouseEventMode';
1059 procedure GrMouseInit; asmname 'GrMouseInit';
1060 procedure GrMouseInitN(Queue_Size: CInteger); asmname 'GrMouseInitN';
1061 procedure GrMouseUnInit; asmname 'GrMouseUnInit';
1062 procedure GrMouseSetSpeed(SPMult, SPDiv: CInteger); asmname 'GrMouseSetSpeed';
1063 procedure GrMouseSetAccel(Thresh, Accel: CInteger); asmname 'GrMouseSetAccel';
1064 procedure GrMouseSetLimits(x1, y1, x2, y2: CInteger); asmname 'GrMouseSetLimits';
1065 procedure GrMouseGetLimits(var x1, y1, x2, y2: CInteger); asmname 'GrMouseGetLimits';
1066 procedure GrMouseWarp(x, y: CInteger); asmname 'GrMouseWarp';
1067 procedure GrMouseEventEnable(Enable_KB, Enable_MS: Boolean); asmname 'GrMouseEventEnable';
1068 procedure GrMouseGetEvent(Flags: CInteger; Event: GrMouseEventPtr); asmname 'GrMouseGetEvent';
1069 procedure GrMouseGetEventT(Flags: CInteger; Event: GrMouseEventPtr; timout_msecs: CInteger); asmname 'GrMouseGetEventT';
GrMousePendingEventnull1070 function GrMousePendingEvent: CInteger; asmname 'GrMousePendingEvent';
1071
GrMouseGetCursornull1072 function GrMouseGetCursor: GrCursorPtr; asmname 'GrMouseGetCursor';
1073 procedure GrMouseSetCursor(Cursor: GrCursorPtr); asmname 'GrMouseSetCursor';
1074 procedure GrMouseSetColors(fg,bg: GrColor); asmname 'GrMouseSetColors';
1075 procedure GrMouseSetCursorMode(Mode: CInteger; x1, y1, x2, y2: CInteger; c: CInteger); asmname 'GrMouseSetCursorMode';
1076 procedure GrMouseDisplayCursor; asmname 'GrMouseDisplayCursor';
1077 procedure GrMouseEraseCursor; asmname 'GrMouseEraseCursor';
1078 procedure GrMouseUpdateCursor; asmname 'GrMouseUpdateCursor';
GrMouseCursorIsDisplayednull1079 function GrMouseCursorIsDisplayed: Boolean; asmname 'GrMouseCursorIsDisplayed';
1080
GrMouseBlocknull1081 function GrMouseBlock(c: GrContextPtr; x1, y1, x2, y2: CInteger): CInteger; asmname 'GrMouseBlock';
1082 procedure GrMouseUnBlock(Return_Value_From_GrMouseBlock: CInteger); asmname 'GrMouseUnBlock';
1083
1084 { ==================================================================
1085 KEYBOARD INTERFACE
1086 ================================================================== }
1087
1088 const
1089 GrKey_NoKey = $0000; { no key available }
1090 GrKey_OutsideValidRange = $0100; { key typed but code outside 1 .. GrKey_LastDefinedKeycode }
1091
1092 { standard ASCII key codes }
1093 GrKey_Control_A = $0001;
1094 GrKey_Control_B = $0002;
1095 GrKey_Control_C = $0003;
1096 GrKey_Control_D = $0004;
1097 GrKey_Control_E = $0005;
1098 GrKey_Control_F = $0006;
1099 GrKey_Control_G = $0007;
1100 GrKey_Control_H = $0008;
1101 GrKey_Control_I = $0009;
1102 GrKey_Control_J = $000a;
1103 GrKey_Control_K = $000b;
1104 GrKey_Control_L = $000c;
1105 GrKey_Control_M = $000d;
1106 GrKey_Control_N = $000e;
1107 GrKey_Control_O = $000f;
1108 GrKey_Control_P = $0010;
1109 GrKey_Control_Q = $0011;
1110 GrKey_Control_R = $0012;
1111 GrKey_Control_S = $0013;
1112 GrKey_Control_T = $0014;
1113 GrKey_Control_U = $0015;
1114 GrKey_Control_V = $0016;
1115 GrKey_Control_W = $0017;
1116 GrKey_Control_X = $0018;
1117 GrKey_Control_Y = $0019;
1118 GrKey_Control_Z = $001a;
1119 GrKey_Control_LBracket = $001b;
1120 GrKey_Control_BackSlash = $001c;
1121 GrKey_Control_RBracket = $001d;
1122 GrKey_Control_Caret = $001e;
1123 GrKey_Control_Underscore = $001f;
1124 GrKey_Space = $0020;
1125 GrKey_ExclamationPoint = $0021;
1126 GrKey_DoubleQuote = $0022;
1127 GrKey_Hash = $0023;
1128 GrKey_Dollar = $0024;
1129 GrKey_Percent = $0025;
1130 GrKey_Ampersand = $0026;
1131 GrKey_Quote = $0027;
1132 GrKey_LParen = $0028;
1133 GrKey_RParen = $0029;
1134 GrKey_Star = $002a;
1135 GrKey_Plus = $002b;
1136 GrKey_Comma = $002c;
1137 GrKey_Dash = $002d;
1138 GrKey_Period = $002e;
1139 GrKey_Slash = $002f;
1140 GrKey_0 = $0030;
1141 GrKey_1 = $0031;
1142 GrKey_2 = $0032;
1143 GrKey_3 = $0033;
1144 GrKey_4 = $0034;
1145 GrKey_5 = $0035;
1146 GrKey_6 = $0036;
1147 GrKey_7 = $0037;
1148 GrKey_8 = $0038;
1149 GrKey_9 = $0039;
1150 GrKey_Colon = $003a;
1151 GrKey_SemiColon = $003b;
1152 GrKey_LAngle = $003c;
1153 GrKey_Equals = $003d;
1154 GrKey_RAngle = $003e;
1155 GrKey_QuestionMark = $003f;
1156 GrKey_At = $0040;
1157 GrKey_A = $0041;
1158 GrKey_B = $0042;
1159 GrKey_C = $0043;
1160 GrKey_D = $0044;
1161 GrKey_E = $0045;
1162 GrKey_F = $0046;
1163 GrKey_G = $0047;
1164 GrKey_H = $0048;
1165 GrKey_I = $0049;
1166 GrKey_J = $004a;
1167 GrKey_K = $004b;
1168 GrKey_L = $004c;
1169 GrKey_M = $004d;
1170 GrKey_N = $004e;
1171 GrKey_O = $004f;
1172 GrKey_P = $0050;
1173 GrKey_Q = $0051;
1174 GrKey_R = $0052;
1175 GrKey_S = $0053;
1176 GrKey_T = $0054;
1177 GrKey_U = $0055;
1178 GrKey_V = $0056;
1179 GrKey_W = $0057;
1180 GrKey_X = $0058;
1181 GrKey_Y = $0059;
1182 GrKey_Z = $005a;
1183 GrKey_LBracket = $005b;
1184 GrKey_BackSlash = $005c;
1185 GrKey_RBracket = $005d;
1186 GrKey_Caret = $005e;
1187 GrKey_UnderScore = $005f;
1188 GrKey_BackQuote = $0060;
1189 GrKey_Small_a = $0061;
1190 GrKey_Small_b = $0062;
1191 GrKey_Small_c = $0063;
1192 GrKey_Small_d = $0064;
1193 GrKey_Small_e = $0065;
1194 GrKey_Small_f = $0066;
1195 GrKey_Small_g = $0067;
1196 GrKey_Small_h = $0068;
1197 GrKey_Small_i = $0069;
1198 GrKey_Small_j = $006a;
1199 GrKey_Small_k = $006b;
1200 GrKey_Small_l = $006c;
1201 GrKey_Small_m = $006d;
1202 GrKey_Small_n = $006e;
1203 GrKey_Small_o = $006f;
1204 GrKey_Small_p = $0070;
1205 GrKey_Small_q = $0071;
1206 GrKey_Small_r = $0072;
1207 GrKey_Small_s = $0073;
1208 GrKey_Small_t = $0074;
1209 GrKey_Small_u = $0075;
1210 GrKey_Small_v = $0076;
1211 GrKey_Small_w = $0077;
1212 GrKey_Small_x = $0078;
1213 GrKey_Small_y = $0079;
1214 GrKey_Small_z = $007a;
1215 GrKey_LBrace = $007b;
1216 GrKey_Pipe = $007c;
1217 GrKey_RBrace = $007d;
1218 GrKey_Tilde = $007e;
1219 GrKey_Control_Backspace = $007f;
1220
1221 { extended key codes as defined in DJGPP }
1222 GrKey_Alt_Escape = $0101;
1223 GrKey_Control_At = $0103;
1224 GrKey_Alt_Backspace = $010e;
1225 GrKey_BackTab = $010f;
1226 GrKey_Alt_Q = $0110;
1227 GrKey_Alt_W = $0111;
1228 GrKey_Alt_E = $0112;
1229 GrKey_Alt_R = $0113;
1230 GrKey_Alt_T = $0114;
1231 GrKey_Alt_Y = $0115;
1232 GrKey_Alt_U = $0116;
1233 GrKey_Alt_I = $0117;
1234 GrKey_Alt_O = $0118;
1235 GrKey_Alt_P = $0119;
1236 GrKey_Alt_LBracket = $011a;
1237 GrKey_Alt_RBracket = $011b;
1238 GrKey_Alt_Return = $011c;
1239 GrKey_Alt_A = $011e;
1240 GrKey_Alt_S = $011f;
1241 GrKey_Alt_D = $0120;
1242 GrKey_Alt_F = $0121;
1243 GrKey_Alt_G = $0122;
1244 GrKey_Alt_H = $0123;
1245 GrKey_Alt_J = $0124;
1246 GrKey_Alt_K = $0125;
1247 GrKey_Alt_L = $0126;
1248 GrKey_Alt_Semicolon = $0127;
1249 GrKey_Alt_Quote = $0128;
1250 GrKey_Alt_Backquote = $0129;
1251 GrKey_Alt_Backslash = $012b;
1252 GrKey_Alt_Z = $012c;
1253 GrKey_Alt_X = $012d;
1254 GrKey_Alt_C = $012e;
1255 GrKey_Alt_V = $012f;
1256 GrKey_Alt_B = $0130;
1257 GrKey_Alt_N = $0131;
1258 GrKey_Alt_M = $0132;
1259 GrKey_Alt_Comma = $0133;
1260 GrKey_Alt_Period = $0134;
1261 GrKey_Alt_Slash = $0135;
1262 GrKey_Alt_KPStar = $0137;
1263 GrKey_F1 = $013b;
1264 GrKey_F2 = $013c;
1265 GrKey_F3 = $013d;
1266 GrKey_F4 = $013e;
1267 GrKey_F5 = $013f;
1268 GrKey_F6 = $0140;
1269 GrKey_F7 = $0141;
1270 GrKey_F8 = $0142;
1271 GrKey_F9 = $0143;
1272 GrKey_F10 = $0144;
1273 GrKey_Home = $0147;
1274 GrKey_Up = $0148;
1275 GrKey_PageUp = $0149;
1276 GrKey_Alt_KPMinus = $014a;
1277 GrKey_Left = $014b;
1278 GrKey_Center = $014c;
1279 GrKey_Right = $014d;
1280 GrKey_Alt_KPPlus = $014e;
1281 GrKey_End = $014f;
1282 GrKey_Down = $0150;
1283 GrKey_PageDown = $0151;
1284 GrKey_Insert = $0152;
1285 GrKey_Delete = $0153;
1286 GrKey_Shift_F1 = $0154;
1287 GrKey_Shift_F2 = $0155;
1288 GrKey_Shift_F3 = $0156;
1289 GrKey_Shift_F4 = $0157;
1290 GrKey_Shift_F5 = $0158;
1291 GrKey_Shift_F6 = $0159;
1292 GrKey_Shift_F7 = $015a;
1293 GrKey_Shift_F8 = $015b;
1294 GrKey_Shift_F9 = $015c;
1295 GrKey_Shift_F10 = $015d;
1296 GrKey_Control_F1 = $015e;
1297 GrKey_Control_F2 = $015f;
1298 GrKey_Control_F3 = $0160;
1299 GrKey_Control_F4 = $0161;
1300 GrKey_Control_F5 = $0162;
1301 GrKey_Control_F6 = $0163;
1302 GrKey_Control_F7 = $0164;
1303 GrKey_Control_F8 = $0165;
1304 GrKey_Control_F9 = $0166;
1305 GrKey_Control_F10 = $0167;
1306 GrKey_Alt_F1 = $0168;
1307 GrKey_Alt_F2 = $0169;
1308 GrKey_Alt_F3 = $016a;
1309 GrKey_Alt_F4 = $016b;
1310 GrKey_Alt_F5 = $016c;
1311 GrKey_Alt_F6 = $016d;
1312 GrKey_Alt_F7 = $016e;
1313 GrKey_Alt_F8 = $016f;
1314 GrKey_Alt_F9 = $0170;
1315 GrKey_Alt_F10 = $0171;
1316 GrKey_Control_Print = $0172;
1317 GrKey_Control_Left = $0173;
1318 GrKey_Control_Right = $0174;
1319 GrKey_Control_End = $0175;
1320 GrKey_Control_PageDown = $0176;
1321 GrKey_Control_Home = $0177;
1322 GrKey_Alt_1 = $0178;
1323 GrKey_Alt_2 = $0179;
1324 GrKey_Alt_3 = $017a;
1325 GrKey_Alt_4 = $017b;
1326 GrKey_Alt_5 = $017c;
1327 GrKey_Alt_6 = $017d;
1328 GrKey_Alt_7 = $017e;
1329 GrKey_Alt_8 = $017f;
1330 GrKey_Alt_9 = $0180;
1331 GrKey_Alt_0 = $0181;
1332 GrKey_Alt_Dash = $0182;
1333 GrKey_Alt_Equals = $0183;
1334 GrKey_Control_PageUp = $0184;
1335 GrKey_F11 = $0185;
1336 GrKey_F12 = $0186;
1337 GrKey_Shift_F11 = $0187;
1338 GrKey_Shift_F12 = $0188;
1339 GrKey_Control_F11 = $0189;
1340 GrKey_Control_F12 = $018a;
1341 GrKey_Alt_F11 = $018b;
1342 GrKey_Alt_F12 = $018c;
1343 GrKey_Control_Up = $018d;
1344 GrKey_Control_KPDash = $018e;
1345 GrKey_Control_Center = $018f;
1346 GrKey_Control_KPPlus = $0190;
1347 GrKey_Control_Down = $0191;
1348 GrKey_Control_Insert = $0192;
1349 GrKey_Control_Delete = $0193;
1350 GrKey_Control_Tab = $0194;
1351 GrKey_Control_KPSlash = $0195;
1352 GrKey_Control_KPStar = $0196;
1353 GrKey_Alt_KPSlash = $01a4;
1354 GrKey_Alt_Tab = $01a5;
1355 GrKey_Alt_Enter = $01a6;
1356
1357 { some additional codes not in DJGPP }
1358 GrKey_Alt_LAngle = $01b0;
1359 GrKey_Alt_RAngle = $01b1;
1360 GrKey_Alt_At = $01b2;
1361 GrKey_Alt_LBrace = $01b3;
1362 GrKey_Alt_Pipe = $01b4;
1363 GrKey_Alt_RBrace = $01b5;
1364 GrKey_Print = $01b6;
1365 GrKey_Shift_Insert = $01b7;
1366 GrKey_Shift_Home = $01b8;
1367 GrKey_Shift_End = $01b9;
1368 GrKey_Shift_PageUp = $01ba;
1369 GrKey_Shift_PageDown = $01bb;
1370 GrKey_Alt_Up = $01bc;
1371 GrKey_Alt_Left = $01bd;
1372 GrKey_Alt_Center = $01be;
1373 GrKey_Alt_Right = $01c0;
1374 GrKey_Alt_Down = $01c1;
1375 GrKey_Alt_Insert = $01c2;
1376 GrKey_Alt_Delete = $01c3;
1377 GrKey_Alt_Home = $01c4;
1378 GrKey_Alt_End = $01c5;
1379 GrKey_Alt_PageUp = $01c6;
1380 GrKey_Alt_PageDown = $01c7;
1381 GrKey_Shift_Up = $01c8;
1382 GrKey_Shift_Down = $01c9;
1383 GrKey_Shift_Right = $01ca;
1384 GrKey_Shift_Left = $01cb;
1385
1386 { this may be usefull for table allocation ... }
1387 GrKey_LastDefinedKeycode = GrKey_Shift_Left;
1388
1389 { some well known synomyms }
1390 GrKey_BackSpace = GrKey_Control_H;
1391 GrKey_Tab = GrKey_Control_I;
1392 GrKey_LineFeed = GrKey_Control_J;
1393 GrKey_Escape = GrKey_Control_LBracket;
1394 GrKey_Return = GrKey_Control_M;
1395
1396 type
1397 GrKeyType = ShortInt;
1398
1399 { new functions to replace the old style
1400 kbhit / getch / getkey / getxkey / getkbstat
1401 keyboard interface }
GrKeyPressednull1402 function GrKeyPressed: CInteger; asmname 'GrKeyPressed';
GrKeyReadnull1403 function GrKeyRead: GrKeyType; asmname 'GrKeyRead';
GrKeyStatnull1404 function GrKeyStat: CInteger; asmname 'GrKeyStat';
1405
1406 { ==================================================================
1407 MISCELLANEOUS UTILITIY FUNCTIONS
1408 ================================================================== }
1409
1410 procedure GrResizeGrayMap (var Map; Pitch, ow, oh, nw, nh: CInteger); asmname 'GrResizeGrayMap';
GrMatchStringnull1411 function GrMatchString (Pattern, Strg: CString): CInteger; asmname 'GrMatchString';
1412 procedure GrSetWindowTitle (Title: CString); asmname 'GrSetWindowTitle';
1413 procedure GrSleep (MSec: CInteger); asmname 'GrSleep';
1414 procedure GrFlush; asmname 'GrFlush';
1415
1416 { ==================================================================
1417 PNM FUNCTIONS
1418 ================================================================== }
1419
1420 { The PNM formats, grx support load/save of binaries formats (4,5,6) only }
1421
1422 const
1423 PlainPBMFormat = 1;
1424 PlainPGMFormat = 2;
1425 PlainPPMFormat = 3;
1426 PBMFormat = 4;
1427 PGMFormat = 5;
1428 PPMFormat = 6;
1429
1430 { The PNM functions }
1431
GrSaveContextToPbmnull1432 function GrSaveContextToPbm (grc: GrContextPtr; FileName, Comment: CString): CInteger; asmname 'GrSaveContextToPbm';
GrSaveContextToPgmnull1433 function GrSaveContextToPgm (grc: GrContextPtr; FileName, Comment: CString): CInteger; asmname 'GrSaveContextToPgm';
GrSaveContextToPpmnull1434 function GrSaveContextToPpm (grc: GrContextPtr; FileName, Comment: CString): CInteger; asmname 'GrSaveContextToPpm';
GrLoadContextFromPnmnull1435 function GrLoadContextFromPnm (grc: GrContextPtr; FileName: CString): CInteger; asmname 'GrLoadContextFromPnm';
GrQueryPnmnull1436 function GrQueryPnm (FileName: CString; var Width, Height, MaxVal: CInteger): CInteger; asmname 'GrQueryPnm';
GrLoadContextFromPnmBuffernull1437 function GrLoadContextFromPnmBuffer (grc: GrContextPtr; protected var Buffer): CInteger; asmname 'GrLoadContextFromPnmBuffer';
GrQueryPnmBuffernull1438 function GrQueryPnmBuffer (protected var Buffer; var Width, Height, MaxVal: CInteger): CInteger; asmname 'GrQueryPnmBuffer';
1439
1440 { ==================================================================
1441 ADDON FUNCTIONS
1442 these functions may not be installed or available on all systems
1443 ================================================================== }
1444
GrPngSupportnull1445 function GrPngSupport: CInteger; asmname 'GrPngSupport';
GrSaveContextToPngnull1446 function GrSaveContextToPng (grc: GrContextPtr; FileName: CString): CInteger; asmname 'GrSaveContextToPng';
GrLoadContextFromPngnull1447 function GrLoadContextFromPng (grc: GrContextPtr; FileName: CString; UseAlpha: CInteger): CInteger; asmname 'GrLoadContextFromPng';
GrQueryPngnull1448 function GrQueryPng (FileName: CString; var Width, Height: CInteger): CInteger; asmname 'GrQueryPng';
1449
1450 { SaveContextToTiff - Dump a context in a TIFF file
1451
1452 Arguments:
1453 cxt: Context to be saved (nil -> use current context)
1454 tiffn: Name of tiff file
1455 compr: Compression method (see tiff.h), 0: automatic selection
1456 docn: string saved in the tiff file (DOCUMENTNAME tag)
1457
1458 Returns 0 on success
1459 -1 on error
1460
1461 requires tifflib by Sam Leffler (sam@engr.sgi.com)
1462 available at ftp://ftp.sgi.com/graphics/tiff }
SaveContextToTiffnull1463 function SaveContextToTiff(Cxt: GrContextPtr; TiffN: CString; Compr: CInteger; DocN: CString): CInteger; asmname 'SaveContextToTiff';
1464
1465 { GrSaveContextToJpeg - Dump a context in a JPEG file
1466
1467 Arguments:
1468 grc: Context to be saved (nil -> use current context)
1469 Filename: Name of the jpeg file
1470 accuracy: Accuracy percentage (100 for no loss of quality)
1471
1472 Returns 0 on success
1473 -1 on error
1474
1475 requires jpeg-6a by IJG (Independent JPEG Group)
1476 available at ftp.uu.net as graphics/jpeg/jpegsrc.v6a.tar.gz }
GrSaveContextToJpegnull1477 function GrSaveContextToJpeg(grc: GrContextPtr; FileName: CString; Accuracy: CInteger): CInteger; asmname 'GrSaveContextToJpeg';
GrSaveContextToGrayJpegnull1478 function GrSaveContextToGrayJpeg(grc: GrContextPtr; FileName: CString; Accuracy: CInteger): CInteger; asmname 'GrSaveContextToGrayJpeg';
GrJpegSupportnull1479 function GrJpegSupport: CInteger; asmname 'GrJpegSupport';
GrLoadContextFromJpegnull1480 function GrLoadContextFromJpeg(grc: GrContextPtr; FileName: CString; Scale: CInteger): CInteger; asmname 'GrLoadContextFromJpeg';
GrQueryJpegnull1481 function GrQueryJpeg(FileName: CString; var Width, Height: CInteger): CInteger; asmname 'GrQueryJpeg';
1482
1483 implementation
1484
1485 end.
1486