svgalib.pp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. unit SVGALib;
  2. {*************************************************************************
  3. VGAlib version 1.2 - (c) 1993 Tommy Frandsen
  4. This library is free software; you can redistribute it and/or
  5. modify it without any restrictions. This library is distributed
  6. in the hope that it will be useful, but without any warranty.
  7. Extended for svgalib by Harm Hanemaayer and Hartmut Schirmer
  8. ************************************************************************
  9. Original conversion to FPK-Pascal done by Balazs Scheidler ([email protected])
  10. 08/29/1997
  11. Modified by Matthias K"oppe <[email protected]>, 21-Sep-1997
  12. The compiler (FPK 0.9.1) seems to have a problem with external procedures
  13. having void argument list (wrong number of arguments is taken from stack.)
  14. Therefore, I added dummy arguments to all these procedures. Moreover, I
  15. added `vgagl' support.
  16. Modified by Michael Van Canneyt ([email protected]) to
  17. support version 0.99.5 of the compiler. (March 1998) Removed the void replacements.
  18. Added makefile and 2 testprograms. Tested with svgalib 1.2.12.
  19. ************************************************************************}
  20. interface
  21. { As of version 0.99.0, you can specify libs to link to in the source file }
  22. { Make sure you have those libs. MVC }
  23. {$linklib vga}
  24. {$linklib vgagl}
  25. {$linklib c}
  26. const
  27. GTEXT = 0; { Compatible with VGAlib v1.2 }
  28. G320x200x16 = 1;
  29. G640x200x16 = 2;
  30. G640x350x16 = 3;
  31. G640x480x16 = 4;
  32. G320x200x256 = 5;
  33. G320x240x256 = 6;
  34. G320x400x256 = 7;
  35. G360x480x256 = 8;
  36. G640x480x2 = 9;
  37. G640x480x256 = 10;
  38. G800x600x256 = 11;
  39. G1024x768x256 = 12;
  40. G1280x1024x256 = 13; { Additional modes. }
  41. G320x200x32K = 14;
  42. G320x200x64K = 15;
  43. G320x200x16M = 16;
  44. G640x480x32K = 17;
  45. G640x480x64K = 18;
  46. G640x480x16M = 19;
  47. G800x600x32K = 20;
  48. G800x600x64K = 21;
  49. G800x600x16M = 22;
  50. G1024x768x32K = 23;
  51. G1024x768x64K = 24;
  52. G1024x768x16M = 25;
  53. G1280x1024x32K = 26;
  54. G1280x1024x64K = 27;
  55. G1280x1024x16M = 28;
  56. G800x600x16 = 29;
  57. G1024x768x16 = 30;
  58. G1280x1024x16 = 31;
  59. G720x348x2 = 32; { Hercules emulation mode }
  60. G320x200x16M32 = 33; { 32-bit per pixel modes. }
  61. G640x480x16M32 = 34;
  62. G800x600x16M32 = 35;
  63. G1024x768x16M32 = 36;
  64. G1280x1024x16M32 = 37;
  65. { additional resolutions }
  66. G1152x864x16 = 38;
  67. G1152x864x256 = 39;
  68. G1152x864x32K = 40;
  69. G1152x864x64K = 41;
  70. G1152x864x16M = 42;
  71. G1152x864x16M32 = 43;
  72. G1600x1200x16 = 44;
  73. G1600x1200x256 = 45;
  74. G1600x1200x32K = 46;
  75. G1600x1200x64K = 47;
  76. G1600x1200x16M = 48;
  77. G1600x1200x16M32 = 49;
  78. GLASTMODE = 49;
  79. { Extensions to VGAlib v1.2: }
  80. { blit flags }
  81. const
  82. HAVE_BITBLIT = 1;
  83. HAVE_FILLBLIT = 2;
  84. HAVE_IMAGEBLIT = 4;
  85. HAVE_HLINELISTBLIT = 8;
  86. HAVE_BLITWAIT = 16;
  87. { other flags }
  88. HAVE_RWPAGE = 1; { vga_setreadpage() / vga_setwritepage() available }
  89. IS_INTERLACED = 2; { mode is interlaced }
  90. IS_MODEX = 4; { ModeX style 256 colors }
  91. IS_DYNAMICMODE = 8; { Dynamic defined mode }
  92. CAPABLE_LINEAR = 16; { Can go to linear addressing mode. }
  93. IS_LINEAR = 32; { Linear addressing enabled. }
  94. EXT_INFO_AVAILABLE = 64; { Returned modeinfo contains valid extended fields }
  95. RGB_MISORDERED = 128; { Mach32 32bpp uses 0BGR instead of BGR0. }
  96. { As of this version 1.25 also used to signal if real RGB
  97. (red first in memory) is used instead of BGR (Mach32 DAC 4) }
  98. HAVE_EXT_SET = 256; { vga_ext_set() available }
  99. { Valid values for what in vga_ext_set: }
  100. const
  101. VGA_EXT_AVAILABLE = 0; { supported flags }
  102. VGA_EXT_SET = 1; { set flag(s) }
  103. VGA_EXT_CLEAR = 2; { clear flag(s) }
  104. VGA_EXT_RESET = 3; { set/clear flag(s) }
  105. VGA_EXT_PAGE_OFFSET = 4; { set an offset for all subsequent vga_set*page() calls }
  106. { Like: vga_ext_set(VGA_EXT_PAGE_OFFSET, 42); }
  107. { returns the previous offset value. }
  108. { Valid params for VGA_EXT_AVAILABLE: }
  109. VGA_AVAIL_SET = 0; { vga_ext_set sub funcs }
  110. VGA_AVAIL_ACCEL = 1; { vga_accel sub funcs }
  111. VGA_AVAIL_FLAGS = 2; { known flags for VGA_EXT_SET }
  112. { Known flags to vga_ext_set() }
  113. VGA_CLUT8 = 1; { 8 bit DAC entries }
  114. { Acceleration interface. }
  115. { Accel operations. }
  116. ACCEL_FILLBOX = 1; { Simple solid fill. }
  117. ACCEL_SCREENCOPY = 2; { Simple screen-to-screen BLT. }
  118. ACCEL_PUTIMAGE = 3; { Straight image transfer. }
  119. ACCEL_DRAWLINE = 4; { General line draw. }
  120. ACCEL_SETFGCOLOR = 5; { Set foreground color. }
  121. ACCEL_SETBGCOLOR = 6; { Set background color. }
  122. ACCEL_SETTRANSPARENCY = 7; { Set transparency mode. }
  123. ACCEL_SETRASTEROP = 8; { Set raster-operation. }
  124. ACCEL_PUTBITMAP = 9; { Color-expand bitmap. }
  125. ACCEL_SCREENCOPYBITMAP = 10; { Color-exand from screen. }
  126. ACCEL_DRAWHLINELIST = 11; { Draw horizontal spans. }
  127. ACCEL_SETMODE = 12; { Set blit strategy. }
  128. ACCEL_SYNC = 13; { Wait for blits to finish. }
  129. { Corresponding bitmask. }
  130. ACCELFLAG_FILLBOX = $1; { Simple solid fill. }
  131. ACCELFLAG_SCREENCOPY = $2; { Simple screen-to-screen BLT. }
  132. ACCELFLAG_PUTIMAGE = $4; { Straight image transfer. }
  133. ACCELFLAG_DRAWLINE = $8; { General line draw. }
  134. ACCELFLAG_SETFGCOLOR = $10; { Set foreground color. }
  135. ACCELFLAG_SETBGCOLOR = $20; { Set background color. }
  136. ACCELFLAG_SETTRANSPARENCY = $40; { Set transparency mode. }
  137. ACCELFLAG_SETRASTEROP = $80; { Set raster-operation. }
  138. ACCELFLAG_PUTBITMAP = $100; { Color-expand bitmap. }
  139. ACCELFLAG_SCREENCOPYBITMAP = $200; { Color-exand from screen. }
  140. ACCELFLAG_DRAWHLINELIST = $400; { Draw horizontal spans. }
  141. ACCELFLAG_SETMODE = $800; { Set blit strategy. }
  142. ACCELFLAG_SYNC = $1000; { Wait for blits to finish. }
  143. { Mode for SetTransparency. }
  144. DISABLE_TRANSPARENCY_COLOR = 0;
  145. ENABLE_TRANSPARENCY_COLOR = 1;
  146. DISABLE_BITMAP_TRANSPARENCY = 2;
  147. ENABLE_BITMAP_TRANSPARENCY = 3;
  148. { Flags for SetMode (accelerator interface). }
  149. BLITS_SYNC = 0;
  150. BLITS_IN_BACKGROUND = $1;
  151. { Raster ops. }
  152. ROP_COPY = 0; { Straight copy. }
  153. ROP_OR = 1; { Source OR destination. }
  154. ROP_AND = 2; { Source AND destination. }
  155. ROP_XOR = 3; { Source XOR destination. }
  156. ROP_INVERT = 4; { Invert destination. }
  157. const
  158. { chipsets }
  159. UNDEFINED = 0;
  160. VGA = 1;
  161. ET4000 = 2;
  162. CIRRUS = 3;
  163. TVGA8900 = 4;
  164. OAK = 5;
  165. EGA = 6;
  166. S3 = 7;
  167. ET3000 = 8;
  168. MACH32 = 9;
  169. GVGA6400 = 10;
  170. ARK = 11;
  171. ATI = 12;
  172. ALI = 13;
  173. MACH64 = 14;
  174. { Hor. sync: }
  175. MON640_60 = 0; { 31.5 KHz (standard VGA) }
  176. MON800_56 = 1; { 35.1 KHz (old SVGA) }
  177. MON1024_43I = 2; { 35.5 KHz (low-end SVGA, 8514) }
  178. MON800_60 = 3; { 37.9 KHz (SVGA) }
  179. MON1024_60 = 4; { 48.3 KHz (SVGA non-interlaced) }
  180. MON1024_70 = 5; { 56.0 KHz (SVGA high frequency) }
  181. MON1024_72 = 6;
  182. {
  183. * valid values for what ( | is valid to combine them )
  184. (vga_waitevent values)
  185. }
  186. VGA_MOUSEEVENT = 1;
  187. VGA_KEYEVENT = 2;
  188. type
  189. pvga_modeinfo = ^vga_modeinfo;
  190. vga_modeinfo = record
  191. width,
  192. height,
  193. bytesperpixel,
  194. colors,
  195. linewidth, { scanline width in bytes }
  196. maxlogicalwidth, { maximum logical scanline width }
  197. startaddressrange, { changeable bits set }
  198. maxpixels, { video memory / bytesperpixel }
  199. haveblit, { mask of blit functions available }
  200. flags: Longint; { other flags }
  201. { Extended fields: }
  202. chiptype, { Chiptype detected }
  203. memory, { videomemory in KB }
  204. linewidth_unit: Longint; { Use only a multiple of this as parameter for set_logicalwidth and
  205. set_displaystart }
  206. linear_aperture: PChar; { points to mmap secondary mem aperture of card (NULL if unavailable) }
  207. aperture_size: Longint; { size of aperture in KB if size>=videomemory. 0 if unavail }
  208. set_aperture_page: procedure (page: Longint);
  209. { if aperture_size<videomemory select a memory page }
  210. extensions: Pointer; { points to copy of eeprom for mach32 }
  211. { depends from actual driver/chiptype.. etc. }
  212. end;
  213. shutdown_routine_ptr = procedure;
  214. var
  215. graph_mem: PChar;
  216. Function vga_setmode(mode: Longint): Longint; cdecl;
  217. Function vga_hasmode(mode: Longint): Boolean; cdecl;
  218. Function vga_setflipchar(c: Longint): Longint; cdecl;
  219. Function vga_clear: Longint; cdecl;
  220. Function vga_flip: Longint; cdecl;
  221. Function vga_getxdim: Longint; cdecl;
  222. Function vga_getydim: Longint; cdecl;
  223. Function vga_getcolors: Longint; cdecl;
  224. Function vga_setpalette(index: Longint; red: Longint; green: Longint; blue: Longint): Longint; cdecl;
  225. Function vga_getpalette(index: Longint; var red: Longint; var green: Longint; var blue: Longint): Longint; cdecl;
  226. Function vga_setpalvec(start: Longint; num: Longint; var pal): Longint; cdecl;
  227. Function vga_getpalvec(start: Longint; num: Longint; var pal): Longint; cdecl;
  228. Function vga_screenoff: Longint; cdecl;
  229. Function vga_screenon: Longint; cdecl;
  230. Function vga_setcolor(color: Longint): Longint; cdecl;
  231. Function vga_drawpixel(x, y: Longint): Longint; cdecl;
  232. Function vga_drawline(x1, y1, x2, y2: Longint): Longint; cdecl;
  233. Function vga_drawscanline(line: Longint; var colors): Longint; cdecl;
  234. Function vga_drawscansegment(var colors; x, y: Longint; length: Longint): Longint; cdecl;
  235. Function vga_getpixel(x, y: Longint): Longint; cdecl;
  236. Function vga_getscansegment(var colors; x, y: Longint; length: Longint): Longint; cdecl;
  237. Function vga_getch: Longint; cdecl;
  238. Function vga_dumpregs: Longint; cdecl;
  239. Function vga_getmodeinfo(mode: Longint): pvga_modeinfo; cdecl;
  240. Function vga_getdefaultmode: Longint; cdecl;
  241. Function vga_getcurrentmode: Longint; cdecl;
  242. Function vga_getcurrentchipset: Longint; cdecl;
  243. Function vga_getmodename(mode: Longint): PChar; cdecl;
  244. Function vga_getmodenumber(name: PChar): Longint; cdecl;
  245. Function vga_lastmodenumber: Longint; cdecl;
  246. Function vga_getgraphmem: PChar; cdecl;
  247. Procedure vga_setpage(p: Longint); cdecl;
  248. Procedure vga_setreadpage(p: Longint); cdecl;
  249. Procedure vga_setwritepage(p: Longint); cdecl;
  250. Procedure vga_setlogicalwidth(w: Longint); cdecl;
  251. Procedure vga_setdisplaystart(a: Longint); cdecl;
  252. Procedure vga_waitretrace; cdecl;
  253. Function vga_claimvideomemory(n: Longint): Longint; cdecl;
  254. Procedure vga_disabledriverreport; cdecl;
  255. Function vga_setmodeX: Longint; cdecl;
  256. Function vga_init: Longint; { Used to return void in svgalib <= 1.12. } cdecl;
  257. Function vga_getmousetype: Longint; cdecl;
  258. Function vga_getmonitortype: Longint; cdecl;
  259. Procedure vga_setmousesupport(s: Longint); cdecl;
  260. Procedure vga_lockvc; cdecl;
  261. Procedure vga_unlockvc; cdecl;
  262. Function vga_getkey: Longint; cdecl;
  263. Procedure vga_runinbackground(s: Longint); cdecl;
  264. Function vga_oktowrite: Longint; cdecl;
  265. Procedure vga_copytoplanar256(virtualp: PChar; pitch: Longint;
  266. voffset: Longint; vpitch: Longint; w: Longint; h: Longint);cdecl;
  267. Procedure vga_copytoplanar16(virtualp: PChar; pitch, voffset, vpitch, w, h: Longint); cdecl;
  268. Procedure vga_copytoplane(virtualp: PChar; pitch, voffset, vpitch, w, h, plane: Longint); cdecl;
  269. Function vga_setlinearaddressing: Longint; cdecl;
  270. Procedure vga_safety_fork(shutdown_routine: shutdown_routine_ptr); cdecl;
  271. Procedure vga_setchipset(c: Longint); cdecl;
  272. Procedure vga_setchipsetandfeatures(c: Longint; par1: Longint; par2: Longint); cdecl;
  273. Procedure vga_gettextfont(font: Pointer); cdecl;
  274. Procedure vga_puttextfont(font: Pointer); cdecl;
  275. Procedure vga_settextmoderegs(regs: Pointer); cdecl;
  276. Procedure vga_gettextmoderegs(regs: Pointer); cdecl;
  277. Function vga_white: Longint; cdecl;
  278. Function vga_setegacolor(c: Longint): Longint; cdecl;
  279. Function vga_setrgbcolor(r, g, b: Longint): Longint; cdecl;
  280. Procedure vga_bitblt(srcaddr, destaddr: Longint; w, h: Longint; pitch: Longint); cdecl;
  281. Procedure vga_imageblt(srcaddr: Pointer; destaddr: Longint; w, h, pitch: Longint); cdecl;
  282. Procedure vga_fillblt(destaddr: Longint; w, h, pitch, c: Longint); cdecl;
  283. Procedure vga_hlinelistblt(ymin, n: Longint; var xmin, xmax: Longint; pitch, c: Longint); cdecl;
  284. Procedure vga_blitwait; cdecl;
  285. {
  286. The following Functions are not implemented, because they use variable number cdecl;
  287. of arguments
  288. int vga_ext_set(unsigned what,...);
  289. int vga_accel(unsigned operation,...);
  290. }
  291. {
  292. * wait for keypress, mousemove, I/O, timeout. cf. select (3) for details on
  293. * all parameters execept which.
  294. * NULL is a valid argument for any of the ptrs.
  295. }
  296. type
  297. fd_set = array [1..32] of Longint;
  298. timeval = record
  299. tv_sec, tv_usec: Longint;
  300. end;
  301. Function vga_waitevent(which: Longint; var inp, outp, excp: fd_set;
  302. timeout: timeval): Longint;cdecl;
  303. {
  304. * return value >= has bits set for mouse/keyboard events detected.
  305. * mouse and raw keyboard events are already handled and their bits removed
  306. * from *in when vga_waitevent returns.
  307. * VGA_KEYEVENT relates to vga_getch NOT vga_getkey.
  308. * return values < 0 signal errors. In this case check errno.
  309. }
  310. { This part has been added by Matthias K"oppe <[email protected]>.
  311. It reflects the content of `vgagl.h'.
  312. }
  313. const
  314. CONTEXT_VIRTUAL = 0;
  315. CONTEXT_PAGED = 1;
  316. CONTEXT_LINEAR = 2;
  317. CONTEXT_MODEX = 3;
  318. CONTEXT_PLANAR16 = 4;
  319. const
  320. MODEFLAG_PAGEFLIPPING_CAPABLE = $01;
  321. MODEFLAG_TRIPLEBUFFERING_CAPABLE = $02;
  322. MODEFLAG_PAGEFLIPPING_ENABLED = $04;
  323. MODEFLAG_TRIPLEBUFFERING_ENABLED = $08;
  324. MODEFLAG_FLIPPAGE_BANKALIGNED = $10;
  325. MODEFLAG_32BPP_SHIFT8 = $20;
  326. MODEFLAG_24BPP_REVERSED = $20;
  327. type
  328. PGraphicsContext = ^TGraphicsContext;
  329. TGraphicsContext = record
  330. ModeType: Byte;
  331. ModeFlags: Byte;
  332. Dummy: Byte;
  333. FlipPage: Byte;
  334. Width: LongInt;
  335. Height: LongInt;
  336. BytesPerPixel: LongInt;
  337. Colors: LongInt;
  338. BitsPerPixel: LongInt;
  339. ByteWidth: LongInt;
  340. VBuf: pointer;
  341. Clip: LongInt;
  342. ClipX1: LongInt;
  343. ClipY1: LongInt;
  344. ClipX2: LongInt;
  345. ClipY2: LongInt;
  346. ff: pointer;
  347. end;
  348. { Configuration
  349. }
  350. Function gl_setcontextvga(m: LongInt): LongInt; cdecl;
  351. Function gl_setcontextvgavirtual(m: LongInt): LongInt; cdecl;
  352. Procedure gl_setcontextvirtual(w, h, bpp, bitspp: LongInt; vbuf: pointer); cdecl;
  353. Procedure gl_setcontextwidth(w: LongInt); cdecl;
  354. Procedure gl_setcontextheight(h: LongInt); cdecl;
  355. Function gl_allocatecontext: PGraphicsContext; cdecl;
  356. Procedure gl_setcontext(gc: PGraphicsContext); cdecl;
  357. Procedure gl_getcontext(gc: PGraphicsContext); cdecl;
  358. Procedure gl_freecontext(gc: PGraphicsContext); cdecl;
  359. { Line drawing
  360. }
  361. Procedure gl_setpixel(x, y, c: LongInt); cdecl;
  362. Procedure gl_setpixelrgb(x, y, r, g, b: LongInt); cdecl;
  363. Function gl_getpixel(x, y: LongInt): LongInt; cdecl;
  364. Procedure gl_getpixelrgb(x, y: LongInt; var r, g, b: LongInt); cdecl;
  365. Function gl_rgbcolor(r, g, b: LongInt): LongInt; cdecl;
  366. Procedure gl_hline(x1, y, x2, c: LongInt); cdecl;
  367. Procedure gl_line(x1, y1, x2, y2, c: LongInt); cdecl;
  368. Procedure gl_circle(x, y, r, c: LongInt ); cdecl;
  369. { Box (bitmap) Functions cdecl;
  370. }
  371. Procedure gl_fillbox(x, y, w, h, c: LongInt); cdecl;
  372. Procedure gl_getbox(x, y, w, h: LongInt; dp: pointer); cdecl;
  373. Procedure gl_putbox(x, y, w, h: LongInt; dp: pointer); cdecl;
  374. Procedure gl_putboxpart(x, y, w, h, bw, bh: LongInt; b: pointer; xo, yo: LongInt); cdecl;
  375. Procedure gl_putboxmask(x, y, w, h: LongInt; dp: pointer); cdecl;
  376. Procedure gl_copybox(x1, y1, w, h, x2, y2: LongInt); cdecl;
  377. Procedure gl_copyboxtocontext(x1, y1, w, h: LongInt; var gc: TGraphicsContext; x2, y2: LongInt); cdecl;
  378. Procedure gl_copyboxfromcontext(var gc: TGraphicsContext; x1, y1, w, h, x2, y2: LongInt); cdecl;
  379. { The following Functions only work in 256-color modes: } cdecl;
  380. Procedure gl_compileboxmask(w, h: LongInt; sdp, dpp: pointer); cdecl;
  381. Function gl_compiledboxmasksize(w, h: LongInt; sdp: pointer): LongInt; cdecl;
  382. Procedure gl_putboxmaskcompiled(x, y, w, h: LongInt; dp: pointer); cdecl;
  383. { Miscellaneous
  384. }
  385. Procedure gl_clearscreen(c: LongInt); cdecl;
  386. Procedure gl_scalebox(w1, h1: LongInt; sb: pointer; w2, h2: LongInt; db: pointer); cdecl;
  387. Procedure gl_setdisplaystart(x, y: LongInt); cdecl;
  388. Procedure gl_enableclipping; cdecl;
  389. Procedure gl_setclippingwindow(x1, y1, x2, y2: LongInt); cdecl;
  390. Procedure gl_disableclipping; cdecl;
  391. { Screen buffering
  392. }
  393. Procedure gl_copyscreen(var gc: TGraphicsContext); cdecl;
  394. Procedure gl_setscreenoffset(o: LongInt); cdecl;
  395. Function gl_enablepageflipping(var gc: TGraphicsContext): LongInt; cdecl;
  396. { Text
  397. }
  398. { Writemode flags.
  399. }
  400. const
  401. WRITEMODE_OVERWRITE = 0;
  402. WRITEMODE_MASKED = 1;
  403. FONT_EXPANDED = 0;
  404. FONT_COMPRESSED = 2;
  405. Procedure gl_expandfont(fw, fh, c: LongInt; sfdp, dfdp: pointer); cdecl;
  406. Procedure gl_setfont(fw, fh: LongInt; fdp: pointer); cdecl;
  407. Procedure gl_colorfont(fw, fh, c: LongInt; fdp: pointer); cdecl;
  408. Procedure gl_setwritemode(wm: LongInt); cdecl;
  409. Procedure gl_write(x, y: LongInt; s: PChar); cdecl;
  410. Procedure gl_writen(x, y, n: LongInt; s: PChar); cdecl;
  411. Procedure gl_setfontcolors(bg, fg: LongInt); cdecl;
  412. {extern unsigned char *gl_font8x8; /* compressed 8x8 font */}
  413. type
  414. TRGB = record
  415. red, green, blue: Byte
  416. end;
  417. type
  418. TRGBPalette = array[0..255] of TRGB;
  419. Procedure gl_setpalettecolor(c, r, b, g: LongInt); cdecl;
  420. Procedure gl_getpalettecolor(c: LongInt; var r, b, g: LongInt); cdecl;
  421. Procedure gl_setpalettecolors(s, n: LongInt; dp: pointer); cdecl;
  422. Procedure gl_getpalettecolors(s, n: LongInt; dp: pointer); cdecl;
  423. Procedure gl_setpalette(p: pointer); cdecl;
  424. Procedure gl_getpalette(p: pointer); cdecl;
  425. Procedure gl_setrgbpalette; cdecl;
  426. Procedure gl_font8x8; { ACTUALLY A DATA POINTER } cdecl;
  427. implementation
  428. function vga_setmode(mode: Longint): Longint; Cdecl; External;
  429. function vga_hasmode(mode: Longint): Boolean; Cdecl; External;
  430. function vga_setflipchar(c: Longint): Longint; Cdecl; External;
  431. function vga_clear: Longint; Cdecl; External;
  432. function vga_flip: Longint; Cdecl; External;
  433. function vga_getxdim: Longint; Cdecl; External;
  434. function vga_getydim: Longint; Cdecl; External;
  435. function vga_getcolors: Longint;Cdecl; External;
  436. function vga_setpalette(index: Longint; red: Longint; green: Longint; blue: Longint): Longint; Cdecl; External;
  437. function vga_getpalette(index: Longint; var red: Longint; var green: Longint; var blue: Longint): Longint; Cdecl; External;
  438. function vga_setpalvec(start: Longint; num: Longint; var pal): Longint; Cdecl; External;
  439. function vga_getpalvec(start: Longint; num: Longint; var pal): Longint; Cdecl; External;
  440. function vga_screenoff: Longint; Cdecl; External;
  441. function vga_screenon: Longint; Cdecl; External;
  442. function vga_setcolor(color: Longint): Longint; Cdecl; External;
  443. function vga_drawpixel(x, y: Longint): Longint; Cdecl; External;
  444. function vga_drawline(x1, y1, x2, y2: Longint): Longint; Cdecl; External;
  445. function vga_drawscanline(line: Longint; var colors): Longint; Cdecl; External;
  446. function vga_drawscansegment(var colors; x, y: Longint; length: Longint): Longint; Cdecl; External;
  447. function vga_getpixel(x, y: Longint): Longint; Cdecl; External;
  448. function vga_getscansegment(var colors; x, y: Longint; length: Longint): Longint; Cdecl; External;
  449. function vga_getch: Longint; Cdecl; External;
  450. function vga_dumpregs: Longint; Cdecl; External;
  451. function vga_getmodeinfo(mode: Longint): pvga_modeinfo; Cdecl; External;
  452. function vga_getdefaultmode: Longint; Cdecl; External;
  453. function vga_getcurrentmode: Longint; Cdecl; External;
  454. function vga_getcurrentchipset: Longint; Cdecl; External;
  455. function vga_getmodename(mode: Longint): PChar; Cdecl; External;
  456. function vga_getmodenumber(name: PChar): Longint; Cdecl; External;
  457. function vga_lastmodenumber: Longint; Cdecl; External;
  458. function vga_getgraphmem: PChar; Cdecl; External;
  459. procedure vga_setpage(p: Longint); Cdecl; External;
  460. procedure vga_setreadpage(p: Longint); Cdecl; External;
  461. procedure vga_setwritepage(p: Longint); Cdecl; External;
  462. procedure vga_setlogicalwidth(w: Longint); Cdecl; External;
  463. procedure vga_setdisplaystart(a: Longint); Cdecl; External;
  464. procedure vga_waitretrace; Cdecl; External;
  465. function vga_claimvideomemory(n: Longint): Longint; Cdecl; External;
  466. procedure vga_disabledriverreport; Cdecl; External;
  467. function vga_setmodeX: Longint; Cdecl; External;
  468. function vga_init: Longint; Cdecl; External; { Used to return void in svgalib <= 1.12. }
  469. function vga_getmousetype: Longint; Cdecl; External;
  470. function vga_getmonitortype: Longint; Cdecl; External;
  471. procedure vga_setmousesupport(s: Longint); Cdecl; External;
  472. procedure vga_lockvc; Cdecl; External;
  473. procedure vga_unlockvc; Cdecl; External;
  474. function vga_getkey: Longint; Cdecl; External;
  475. procedure vga_runinbackground(s: Longint); Cdecl; External;
  476. function vga_oktowrite: Longint; Cdecl; External;
  477. procedure vga_copytoplanar256(virtualp: PChar; pitch: Longint;
  478. voffset: Longint; vpitch: Longint; w: Longint; h: Longint); Cdecl; External;
  479. procedure vga_copytoplanar16(virtualp: PChar; pitch, voffset, vpitch, w, h: Longint); Cdecl; External;
  480. procedure vga_copytoplane(virtualp: PChar; pitch, voffset, vpitch, w, h, plane: Longint); Cdecl; External;
  481. function vga_setlinearaddressing: Longint; Cdecl; External;
  482. procedure vga_safety_fork(shutdown_routine: shutdown_routine_ptr); Cdecl; External;
  483. procedure vga_setchipset(c: Longint); Cdecl; External;
  484. procedure vga_setchipsetandfeatures(c: Longint; par1: Longint; par2: Longint); Cdecl; External;
  485. procedure vga_gettextfont(font: Pointer); Cdecl; External;
  486. procedure vga_puttextfont(font: Pointer); Cdecl; External;
  487. procedure vga_settextmoderegs(regs: Pointer); Cdecl; External;
  488. procedure vga_gettextmoderegs(regs: Pointer); Cdecl; External;
  489. function vga_white: Longint; Cdecl; External;
  490. function vga_setegacolor(c: Longint): Longint; Cdecl; External;
  491. function vga_setrgbcolor(r, g, b: Longint): Longint; Cdecl; External;
  492. procedure vga_bitblt(srcaddr, destaddr: Longint; w, h: Longint; pitch: Longint); Cdecl; External;
  493. procedure vga_imageblt(srcaddr: Pointer; destaddr: Longint; w, h, pitch: Longint); Cdecl; External;
  494. procedure vga_fillblt(destaddr: Longint; w, h, pitch, c: Longint); Cdecl; External;
  495. procedure vga_hlinelistblt(ymin, n: Longint; var xmin, xmax: Longint; pitch, c: Longint); Cdecl; External;
  496. procedure vga_blitwait; Cdecl; External;
  497. {
  498. The following functions are not implemented, because they use variable number
  499. of arguments
  500. int vga_ext_set(unsigned what,...);
  501. int vga_accel(unsigned operation,...);
  502. }
  503. function vga_waitevent(which: Longint; var inp, outp, excp: fd_set;
  504. timeout: timeval): Longint; Cdecl; External;
  505. { vgagl }
  506. function gl_setcontextvga(m: LongInt): LongInt; Cdecl; External;
  507. function gl_setcontextvgavirtual(m: LongInt): LongInt; Cdecl; External;
  508. procedure gl_setcontextvirtual(w, h, bpp, bitspp: LongInt; vbuf: pointer); Cdecl; External;
  509. procedure gl_setcontextwidth(w: LongInt); Cdecl; External;
  510. procedure gl_setcontextheight(h: LongInt); Cdecl; External;
  511. function gl_allocatecontext: PGraphicsContext; Cdecl; External;
  512. procedure gl_setcontext(gc: PGraphicsContext); Cdecl; External;
  513. procedure gl_getcontext(gc: PGraphicsContext); Cdecl; External;
  514. procedure gl_freecontext(gc: PGraphicsContext); Cdecl; External;
  515. procedure gl_setpixel(x, y, c: LongInt); Cdecl; External;
  516. procedure gl_setpixelrgb(x, y, r, g, b: LongInt); Cdecl; External;
  517. function gl_getpixel(x, y: LongInt): LongInt; Cdecl; External;
  518. procedure gl_getpixelrgb(x, y: LongInt; var r, g, b: LongInt); Cdecl; External;
  519. function gl_rgbcolor(r, g, b: LongInt): LongInt; Cdecl; External;
  520. procedure gl_hline(x1, y, x2, c: LongInt); Cdecl; External;
  521. procedure gl_line(x1, y1, x2, y2, c: LongInt); Cdecl; External;
  522. procedure gl_circle(x, y, r, c: LongInt ); Cdecl; External;
  523. procedure gl_fillbox(x, y, w, h, c: LongInt); Cdecl; External;
  524. procedure gl_getbox(x, y, w, h: LongInt; dp: pointer); Cdecl; External;
  525. procedure gl_putbox(x, y, w, h: LongInt; dp: pointer); Cdecl; External;
  526. procedure gl_putboxpart(x, y, w, h, bw, bh: LongInt; b: pointer; xo, yo: LongInt); Cdecl; External;
  527. procedure gl_putboxmask(x, y, w, h: LongInt; dp: pointer); Cdecl; External;
  528. procedure gl_copybox(x1, y1, w, h, x2, y2: LongInt); Cdecl; External;
  529. procedure gl_copyboxtocontext(x1, y1, w, h: LongInt; var gc: TGraphicsContext; x2, y2: LongInt); Cdecl; External;
  530. procedure gl_copyboxfromcontext(var gc: TGraphicsContext; x1, y1, w, h, x2, y2: LongInt); Cdecl; External;
  531. procedure gl_compileboxmask(w, h: LongInt; sdp, dpp: pointer); Cdecl; External;
  532. function gl_compiledboxmasksize(w, h: LongInt; sdp: pointer): LongInt; Cdecl; External;
  533. procedure gl_putboxmaskcompiled(x, y, w, h: LongInt; dp: pointer); Cdecl; External;
  534. procedure gl_clearscreen(c: LongInt); Cdecl; External;
  535. procedure gl_scalebox(w1, h1: LongInt; sb: pointer; w2, h2: LongInt; db: pointer); Cdecl; External;
  536. procedure gl_setdisplaystart(x, y: LongInt); Cdecl; External;
  537. procedure gl_enableclipping; Cdecl; External;
  538. procedure gl_setclippingwindow(x1, y1, x2, y2: LongInt); Cdecl; External;
  539. procedure gl_disableclipping; Cdecl; External;
  540. procedure gl_copyscreen(var gc: TGraphicsContext); Cdecl; External;
  541. procedure gl_setscreenoffset(o: LongInt); Cdecl; External;
  542. function gl_enablepageflipping(var gc: TGraphicsContext): LongInt; Cdecl; External;
  543. procedure gl_expandfont(fw, fh, c: LongInt; sfdp, dfdp: pointer); Cdecl; External;
  544. procedure gl_setfont(fw, fh: LongInt; fdp: pointer); Cdecl; External;
  545. procedure gl_colorfont(fw, fh, c: LongInt; fdp: pointer); Cdecl; External;
  546. procedure gl_setwritemode(wm: LongInt); Cdecl; External;
  547. procedure gl_write(x, y: LongInt; s: PChar); Cdecl; External;
  548. procedure gl_writen(x, y, n: LongInt; s: PChar); Cdecl; External;
  549. procedure gl_setfontcolors(bg, fg: LongInt); Cdecl; External;
  550. procedure gl_setpalettecolor(c, r, b, g: LongInt); Cdecl; External;
  551. procedure gl_getpalettecolor(c: LongInt; var r, b, g: LongInt); Cdecl; External;
  552. procedure gl_setpalettecolors(s, n: LongInt; dp: pointer); Cdecl; External;
  553. procedure gl_getpalettecolors(s, n: LongInt; dp: pointer); Cdecl; External;
  554. procedure gl_setpalette(p: pointer); Cdecl; External;
  555. procedure gl_getpalette(p: pointer); Cdecl; External;
  556. procedure gl_setrgbpalette; Cdecl; External;
  557. procedure gl_font8x8; Cdecl; External;
  558. end.
  559. $Log$
  560. Revision 1.2 2000-07-13 11:33:31 michael
  561. + removed logs
  562. }