home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / msdos / animutil / fastgfx / fg303a / whats.new < prev   
Text File  |  1993-10-01  |  43KB  |  785 lines

  1.  
  2.                                 Release Notes
  3.  
  4.                              Fastgraph (tm) V3.0
  5.  
  6.  
  7.  
  8.                              Ted Gruber Software
  9.                                  PO Box 13408
  10.                              Las Vegas, NV  89112
  11.  
  12.                              (702) 735-1980 voice
  13.                               (702) 735-4603 FAX
  14.                               (702) 796-7134 BBS
  15.                                 72000,1642 CIS
  16.  
  17.                  Copyright (c) 1991-1993 Ted Gruber Software.
  18.                              All Rights Reserved.
  19.  
  20.  
  21. ------------------------------------------------------------------------------
  22.                                  Introduction
  23. ------------------------------------------------------------------------------
  24.  
  25. The Fastgraph 3.0 release notes describe the new features added in Fastgraph
  26. 3.00 through 3.03 (hereafter collectively referred to as Fastgraph 3.0).  The
  27. release notes will be of interest to customers who are already familiar with
  28. Fastgraph so they can get an overview of the new version.  Among the many new
  29. features in Fastgraph 3.0 are:
  30.  
  31. * SVGA support for 19 chipsets plus VESA in resolutions of 640x400x256,
  32.   640x480x256, 800x600x256, 1024x768x256, 800x600x16, and 1024x768x16.
  33. * Routines for displaying and creating GIF files (not in Fastgraph/Light).
  34. * Routines for FAST filling of convex polygons, with clipping.
  35. * Low-level keyboard handler, ideal for game development.
  36. * User-definable image buffer (up to 64K) for faster creation and display
  37.   of GIF, PCX, and pixel run files.
  38. * Additional graphics primitives, including XOR points/lines/boxes in all
  39.   graphics modes, filled circles and ellipses, and clipped region fill.
  40. * Bit maps that don't include transparent colors.
  41. * Block transfers between RAM and video memory instead of just video memory
  42.   to video memory.
  43. * Improved ROM text support, including three font sizes (VGA/SVGA) and the
  44.   ability to display strings relative to any graphics position.
  45. * Ability to access up to 1MB video RAM in non-SVGA modes with certain SVGA
  46.   chipsets (see the READ.ME file for more information about this).
  47. * Ability to display PCX images at the position defined in the PCX header
  48.   instead of only relative to the current graphics position.
  49. * Total of 47 new functions.
  50. * Support for additional compilers.
  51.  
  52. The release notes provide an overview of most of these new features.  For
  53. details, refer to the Fastgraph User's Guide and Reference Manual.
  54.  
  55. Please be sure to see the last section of this document, which discusses two
  56. important compatibility considerations when migrating Fastgraph 2.xx programs
  57. to version 3.0.
  58.  
  59. ------------------------------------------------------------------------------
  60.                    Summary of New Routines in Fastgraph 3.0
  61. ------------------------------------------------------------------------------
  62.  
  63. The following routines are new to Fastgraph 3.0.  Please see the Fastgraph
  64. Reference Manual for full descriptions, including their parameters, return
  65. values, and restrictions.
  66.  
  67. FG_BOXW      World space version of FG_BOX
  68. FG_BOXX      Draw hollow rectangle in XOR mode
  69. FG_BOXXW     World space version of FG_BOXX
  70. FG_CIRCLEF   Draw a filled circle
  71. FG_CIRCLEFW  World space version of FG_CIRCLEF
  72. FG_DEFPAGES  Define extended video pages when using block transfer routines
  73. FG_DRAWRELX  Draw line in XOR mode relative to graphics position
  74. FG_DRAWRXW   World space version of FG_DRAWRELX
  75. FG_DRAWX     Draw line in XOR mode
  76. FG_DRAWXW    World space version of FG_DRAWX
  77. FG_ELLIPSEF  Draw a filled ellipse
  78. FG_ELLIPSFW  World space version of FG_ELLIPSEF
  79. FG_FILLPAGE  Fill active video page with the current color
  80. FG_FLOOD     Like FG_PAINT but observes the clipping limits
  81. FG_FLOODW    World space version of FG_FLOOD
  82. FG_FONTSIZE  Enable 8x8, 8x14, or 8x16 ROM font (VGA/SVGA only)
  83. FG_GETBLOCK  Transfer rectangular region from video memory to RAM
  84. FG_GETENTRY  Get address and type of a physical, virtual, or logical page
  85. FG_IMAGEBUF  Define address and size of Fastgraph's GIF/PCX file buffer
  86. FG_INSIDE    Check if a specified point is inside a convex polygon
  87. FG_JUSTIFY   Define justification settings for FG_PRINT
  88. FG_KBINIT    Enable or disable the Fastgraph low-level keyboard handler
  89. FG_KBTEST    Determine if a key is now pressed or released
  90. FG_MAKEGIF   Create GIF file from rectangular region of active video page
  91. FG_MAKEPPR   Create PPR file from rectangular region of active video page
  92. FG_MAKESPR   Create SPR file from rectangular region of active video page
  93. FG_MEMORY    Return amount of video memory present in kilobytes
  94. FG_MOUSEFIN  Unhook Fastgraph's XVGA or SVGA mouse handler
  95. FG_PAGESIZE  Return video page size in bytes
  96. FG_POINTX    Draw point in XOR mode
  97. FG_POINTXW   World space version of FG_POINTX
  98. FG_POLYFILL  Draw filled convex polygon
  99. FG_POLYLINE  Draw unfilled polygon from one vertex array
  100. FG_POLYOFF   Define polygon offsets for FG_POLYFILL and FG_POLYLINE
  101. FG_PRINT     Display hardware characters in screen space
  102. FG_PUTBLOCK  Transfer rectangular region from RAM to video memory
  103. FG_PUTIMAGE  Like FG_DRWIMAGE but doesn't check for transparent pixels
  104. FG_SETENTRY  Set address and type of a physical, virtual, or logical page
  105. FG_SHOWGIF   Display GIF file
  106. FG_SHOWPCX   Display PCX file (formerly FG_DISPPCX)
  107. FG_SHOWPPR   Display packed pixel run (PPR) file
  108. FG_SHOWSPR   Display standard pixel run (SPR) file
  109. FG_SVGAINIT  Initialize Fastgraph's SVGA kernel
  110. FG_SVGASTAT  Return information about the active SVGA chipset
  111. FG_SVGAVER   Return Fastgraph SVGA kernel version number
  112. FG_TCDEFINE  Define transparent color number for FG_TCXFER
  113. FG_WAITVR    Specify if functions wait internally for vertical retrace
  114.  
  115. Note that FG_MAKEGIF, FG_SHOWGIF, and the world space functions are not in
  116. Fastgraph/Light.
  117.  
  118. ------------------------------------------------------------------------------
  119.                              New SVGA Video Modes
  120. ------------------------------------------------------------------------------
  121.  
  122. Six new video modes have been introduced for Fastgraph's SVGA support.  These
  123. are summarized below:
  124.  
  125.         640x400x256   mode 24         1024x768x256   mode 27
  126.         640x480x256   mode 25         800x600x16     mode 28
  127.         800x600x256   mode 26         1024x768x16    mode 29
  128.  
  129. Before you establish an SVGA graphics mode with FG_SETMODE, you must call the
  130. FG_SVGAINIT function.  This new function initializes Fastgraph's SVGA kernel
  131. for a specific SVGA chipset (see the list of supported chipsets in the next
  132. section).  You can use FG_SVGAINIT to automatically detect the system's SVGA
  133. chipset, or you can use a specific chipset.
  134.  
  135. More information about the new SVGA video modes, Fastgraph's SVGA kernel, and
  136. the FG_SVGAINIT routine appears in Chapters 2 and 3 of the Fastgraph User's
  137. Guide.
  138.  
  139. ------------------------------------------------------------------------------
  140.                            Supported SVGA Chipsets
  141. ------------------------------------------------------------------------------
  142.  
  143. As different manufacturers developed SVGA cards, they implemented the SVGA
  144. features according to their own specifications (each unique implementation is
  145. called a "chipset").  This situation arose because of the lack of an SVGA
  146. standard.  Fastgraph 3.0 will directly support the SVGA chipsets listed in
  147. the table below.  A "Y" entry means the chipset supports the video mode, and
  148. an "N" means it doesn't.  The last row of the table shows the amount of video
  149. memory required to support each mode.
  150.  
  151.                         ----------- 256 colors ------------  --- 16 colors ---
  152. SVGA chipset            640x400  640x480  800x600  1024x768  800x600  1024x768
  153. ==============================================================================
  154. Ahead "A" type             Y        Y        Y         N        Y         Y
  155. ------------------------------------------------------------------------------
  156. Ahead "B" type             Y        Y        Y         Y        Y         Y
  157. ------------------------------------------------------------------------------
  158. ATI 18800                  Y        Y        Y         N        Y         N
  159. ------------------------------------------------------------------------------
  160. ATI 18800-1                Y        Y        Y         N        Y         Y
  161. ------------------------------------------------------------------------------
  162. ATI 28800                  Y        Y        Y         Y        Y         Y
  163. ------------------------------------------------------------------------------
  164. Chips & Tech 82c451        Y        N        N         N        Y         N
  165. ------------------------------------------------------------------------------
  166. Chips & Tech 82c452        Y        Y        N         N        Y         Y
  167. ------------------------------------------------------------------------------
  168. Chips & Tech 82c453        Y        Y        Y         Y        Y         Y
  169. ------------------------------------------------------------------------------
  170. Cirrus Logic 5400 series   N        Y        Y         Y        Y         Y
  171. ------------------------------------------------------------------------------
  172. Genoa 6000 series          Y        Y        Y         N        Y         Y
  173. ------------------------------------------------------------------------------
  174. Oak OTI-067                N        Y        Y         N        Y         Y
  175. ------------------------------------------------------------------------------
  176. Paradise PVGA1a            Y        Y        N         N        Y         N
  177. ------------------------------------------------------------------------------
  178. Paradise WD90C00/10        Y        Y        N         N        Y         Y
  179. ------------------------------------------------------------------------------
  180. Paradise WD90C11/30/31     Y        Y        Y         Y        Y         Y
  181. ------------------------------------------------------------------------------
  182. S3                         N        Y        Y         Y        Y         Y
  183. ------------------------------------------------------------------------------
  184. Trident 8800               Y        Y        N         N        Y         Y
  185. ------------------------------------------------------------------------------
  186. Trident 8900/8900B/8900C   Y        Y        Y         Y        Y         Y
  187. ------------------------------------------------------------------------------
  188. Tseng ET3000               N        Y        Y         N        Y         Y
  189. ------------------------------------------------------------------------------
  190. Tseng ET4000               Y        Y        Y         Y        Y         Y
  191. ------------------------------------------------------------------------------
  192. Video7                     Y        Y        Y         Y        Y         Y
  193. ==============================================================================
  194. minimum video RAM needed  256      512      512       1MB      256       512
  195. ------------------------------------------------------------------------------
  196.  
  197. ------------------------------------------------------------------------------
  198.                           VESA-compatible SVGA Cards
  199. ------------------------------------------------------------------------------
  200.  
  201. The Video Electronics Standards Association (VESA) has assumed the complex
  202. task of improving the compatibility of SVGA cards from different companies.
  203. Most SVGA cards sold today include VESA compatibility, either directly in ROM
  204. or through software drivers.  Fastgraph 3.0 provides support for any SVGA
  205. card with VESA compatibility.
  206.  
  207. When using VESA compatibility, the VESA BIOS handles all chipset-specific
  208. functions such as bank switching.  The overhead imposed by the BIOS usually
  209. makes the VESA modes slightly slower than using chipset-specific functions
  210. directly.  For this reason, the FG_SVGAINIT routine lets you specify if you
  211. want to give precedence to the chipset-specific SVGA code or to the VESA
  212. BIOS.  Chipset-specific precedence means FG_SVGAINIT will only use the VESA
  213. BIOS if no supported SVGA chipset is found.  Conversely, VESA precedence
  214. means FG_SVGAINIT will only use the chipset-specific functions if no VESA
  215. BIOS is found.
  216.  
  217. VESA implementations for some video cards are more VESA-compatible than
  218. others, especially in areas of page flipping and panning.  Fastgraph has no
  219. way to determine the degree of compatibility for any VESA function.  If an
  220. SVGA program will include VESA support, we recommend also including a method
  221. to select chipset-specific SVGA code.  Problematic VESA drivers are beyond
  222. the control of Fastgraph, of application programmers, and perhaps most
  223. importantly, beyond the control of your program's end users.
  224.  
  225. ------------------------------------------------------------------------------
  226.                            SVGA Read and Write Banks
  227. ------------------------------------------------------------------------------
  228.  
  229. Accessing video memory on an SVGA is controlled through a banking scheme that
  230. maps contiguous 64KB blocks of video memory into a segmented address space.
  231. In other words, referencing a specific byte in video RAM requires a bank
  232. number and an address offset within that bank.  Some SVGA cards provide dual
  233. read and write bank registers, while others perform both operations through
  234. the same bank register.
  235.  
  236. Fastgraph's FG_COPYPAGE, FG_RESTORE, FG_SAVE, FG_TCXFER, and FG_TRANSFER
  237. functions copy rectangular blocks from one part of video memory to another.
  238. If an SVGA card provides separate read and write banks, these functions can
  239. copy the source region directly to the destination region.  However, SVGA
  240. cards that employ a single bank register require that these functions copy
  241. the source region to an intermediate buffer and then copy the buffer contents
  242. to the destination.  This makes the block transfer operation slower,
  243. especially in 16-color SVGA modes.
  244.  
  245. ------------------------------------------------------------------------------
  246.                               SVGA Display Pages
  247. ------------------------------------------------------------------------------
  248.  
  249. Most of the SVGA graphics modes include additional video pages if your SVGA
  250. card has enough video RAM.  The following table shows the number of video
  251. pages available in each mode.
  252.  
  253.         Mode                     Number of pages with....
  254.        Number  Resolution        256KB  512KB  768KB  1MB
  255.  
  256.          24    640x400x256         1      2      3     4
  257.          25    640x480x256         0      1      1     2
  258.          26    800x600x256         0      1      1     2
  259.          27    1024x768x256        0      0      1     1
  260.          28    800x600x16          1      2      3     4
  261.          29    1024x768x16         0      1      1     2
  262.  
  263. Some SVGA chipsets restrict what you can do with video pages beyond page 0.
  264. Certain chipsets let you access the additional pages but do not let you make
  265. them the visual page, while others completely disable some or all of the
  266. extra memory in some video modes.  A few older chipsets have limitations on
  267. page flipping and panning.  These items are discussed in the READ.ME file.
  268.  
  269. ------------------------------------------------------------------------------
  270.                     SVGA Chipset Limitations and Problems
  271. ------------------------------------------------------------------------------
  272.  
  273. This section summarizes the known limitations and problems of the supported
  274. SVGA chipsets.
  275.  
  276. The ATI 18800 chipset restricts horizontal panning to four-pixel increments
  277. in 256-color SVGA modes.  In these modes, FG_PAN will reduce the x position
  278. to a multiple of four pixels.
  279.  
  280. The Cirrus Logic 5400 series chipsets have panning problems in the 256-color
  281. SVGA modes (25 to 27).  Panning to an x coordinate that is not a multiple of
  282. four will leave x modulo 4 colums of undefined pixels along the right edge of
  283. the video display.
  284.  
  285. The Genoa 6000 series chipsets do not include the ability to set the display
  286. start address beyond the 16-bit capability provided by the CRT Controller.
  287. This means FG_SETVPAGE is not meaningful in SVGA graphics modes.  Further,
  288. the FG_PAN screen origin is restricted to the first 64K bytes of video memory
  289. in 256-color SVGA modes, and to the first 256K bytes in 16-color SVGA modes.
  290.  
  291. The Genoa 6000 series chipsets restrict horizontal panning to even addresses
  292. in video memory in the 1024x768x16 mode (mode 29).  This means you can pan
  293. only to x coordinates where x modulo 16 is less than 8.
  294.  
  295. The Oak OTI-067 chipset apparently does not include the ability to set the
  296. display start address beyond the 16-bit capability provided by the CRT
  297. Controller.  This means FG_SETVPAGE is not meaningful in SVGA graphics modes.
  298. Further, the FG_PAN screen origin is restricted to the first 64K bytes of
  299. video memory in 256-color SVGA modes, and to the first 256K bytes in 16-color
  300. SVGA modes.
  301.  
  302. The Oak OTI-067 chipset has paging problems in 16-color SVGA modes.  Because
  303. this chipset supports a maximum of 512K video memory, mode 28 is the only
  304. 16-color SVGA mode that is a candidate for additional pages.  However, video
  305. memory beyond 256K is apparently disabled in this mode.
  306.  
  307. All Paradise chipsets restrict horizontal panning to four-pixel increments in
  308. 256-color SVGA modes.  In these modes, FG_PAN will reduce the x position to a
  309. multiple of four pixels.
  310.  
  311. All S3 chipsets restrict horizontal panning to four-pixel increments in 256-
  312. color SVGA modes.  In these modes, FG_PAN will reduce the x position to a
  313. multiple of four pixels.
  314.  
  315. The Trident 8800 chipsets use a unique pixel doubling technique in the 256-
  316. color SVGA modes.  For example, the 640 x 400 mode (mode 24) actually uses a
  317. 1280 x 400 video frame.  This means a multisync monitor is required to use
  318. the two available 256-color modes (24 and 25).  Note that this "feature" only
  319. applies to the Trident 8800 and NOT the 8900 family.
  320.  
  321. Video cards based on the Trident 8900, 8900B, and 8900C chipsets all have
  322. problems accessing video memory beyond 512K in 16-color SVGA modes.  This
  323. means a 1MB Trident card has two pages instead of four in mode 28, and one
  324. page instead of two in mode 29.
  325.  
  326. At least one video card based on the Trident 8900C chipset has problems
  327. accessing video memory beyond 512K in the 640x400 and 640x480 256-color SVGA
  328. modes (in addition to the similar problem in the 16-color SVGA modes for all
  329. Trident chipsets).  Such cards would have two video pages instead of four in
  330. modes 24 and 28, and one page instead of two in modes 25 and 29.  Note that
  331. this problem does not apply to all Trident 8900C cards; the problem has only
  332. been reported on one 8900C-based video card.
  333.  
  334. Video cards based on the Video7 HT208 chipset (i.e., the Video7 VGA 1024i)
  335. have panning problems in all SVGA modes.
  336.  
  337. ------------------------------------------------------------------------------
  338.                          XVGA and SVGA Mouse Support
  339. ------------------------------------------------------------------------------
  340.  
  341. This release offers mouse support for the extended VGA (XVGA) graphics video
  342. modes (modes 20 to 23) and SVGA graphics modes (24 to 29).  In these modes,
  343. Fastgraph displays the mouse cursor through an interrupt handler that is
  344. activated whenever the mouse moves.  The handler is installed when you call
  345. FG_MOUSEINI in modes 20 to 29.
  346.  
  347. If you do not disable this handler before your program exits, strange things
  348. will happen.  More specifically, characters may be invisible, or your system
  349. may hang upon attempting a disk access.  Obviously, these are problems to
  350. avoid.  The FG_MOUSEFIN routine removes Fastgraph's mouse interrupt handler
  351. previously installed with FG_MOUSEINI.  You should call FG_MOUSEFIN just
  352. before restoring the original video mode, as illustrated below:
  353.  
  354.         fg_mousefin();
  355.         fg_setmode(old_mode);
  356.         fg_reset();
  357.         /* now exit to DOS */
  358.  
  359. Note that calling FG_MOUSEFIN is required only in XVGA and SVGA graphics
  360. modes.  Calling it in other video modes is not applicable, though it causes
  361. no problems.
  362.  
  363. In the standard VGA/MCGA 256-color mode (mode 19), white pixels in the mouse
  364. cursor are displayed in color 15.  This is inconsistent with other graphics
  365. modes, where the white pixels are displayed in the highest-numbered color
  366. value available in that mode.  Fastgraph corrects this inconsistency in modes
  367. 20 to 27 by displaying white mouse cursor pixels in color 255.  Like color 15,
  368. color 255 is white by default.  This allows you to redefine color 15 in your
  369. 256-color applications without interfering with the mouse cursor colors.
  370.  
  371. ------------------------------------------------------------------------------
  372.                           Low-Level Keyboard Handler
  373. ------------------------------------------------------------------------------
  374.  
  375. Fastgraph 3.0 includes a new low-level keyboard handler that replaces the
  376. BIOS keyboard handler.  Fastgraph's keyboard handler intercepts keystrokes
  377. ahead of the BIOS and thus eliminates the annoying beep that sounds upon
  378. filling the BIOS keyboard buffer.  The low-level keyboard handler should be
  379. especially well-suited to game development because it increases keyboard
  380. responsiveness in high-speed action games.  However, when the low-level
  381. keyboard handler is enabled, it is not possible to use FG_GETKEY, FG_INTKEY,
  382. or any third party functions that use BIOS or DOS services to access the
  383. keyboard.  For this reason, a program that enables the low-level keyboard
  384. handler must disable it before exiting to DOS.
  385.  
  386. The low-level keyboard handler can be enabled and disabled at any time.  The
  387. FG_KBINIT routine is provided for this purpose.  When it is enabled, you can
  388. use the FG_KBTEST routine to check if keys are currently pressed or released.
  389. FG_KBTEST provides the only mechanism for accessing the keyboard when the
  390. low-level handler is enabled.
  391.  
  392. Please see Chapter 14 of the Fastgraph User's Guide for a full description of
  393. the low-level keyboard handler.
  394.  
  395. ------------------------------------------------------------------------------
  396.                            New FG_SHOWPCX Flag Bits
  397. ------------------------------------------------------------------------------
  398.  
  399. FG_SHOWPCX has two new bits defined in the flags parameter:
  400.  
  401.         Bit 1
  402.            0 = display image at position indicated in PCX header
  403.            1 = display image at current graphics position
  404.         Bit 2
  405.            0 = read PCX image data from the PCX file
  406.            1 = assume PCX image data is in the FG_IMAGEBUF buffer
  407.  
  408. In Fastgraph 2.xx, PCX images were always displayed relative to the current
  409. graphics position.  This behavior is achieved in Fastgraph 3.0 by setting bit
  410. 1 in the flags parameter.  If bit 1 is zero, the image will be displayed at
  411. the location specified in the PCX header.
  412.  
  413. As of Fastgraph 3.03, bit 2 in the flags parameter defines the source of the
  414. PCX image data.  If bit 2 is zero, FG_SHOWPCX displays the image directly from
  415. the PCX file (this was the only available method of displaying PCX images in
  416. Fastgraph 3.02 and before).  If bit 2 is set, FG_SHOWPCX assumes the image
  417. data is in the FG_IMAGEBUF buffer.  Note that the FG_IMAGEBUF buffer has a
  418. maximum size of 64K bytes, so this feature is applicable only if the size of
  419. the GIF or PCX file is 64K bytes or less.
  420.  
  421. The following program fragment shows how to display PCX image data stored in
  422. the FG_IMAGEBUF buffer.  The same technique can be used to display GIF image
  423. data from the FG_IMAGEBUF buffer if we use FG_SHOWGIF instead of FG_SHOWPCX.
  424.  
  425.         static char far buffer[40000];
  426.         FILE *stream;
  427.         int file_size;
  428.  
  429.         stream = fopen("TEST.PCX","rb");
  430.         file_size = (int)(filelength(fileno(stream)));
  431.         fread(buffer,1,file_size,stream);
  432.         fclose(stream);
  433.  
  434.         fg_imagebuf(buffer,file_size);
  435.         fg_showpcx("",4);
  436.  
  437. In this example, there is a 40,000-byte array that we'll use as the image
  438. buffer.  Note that we specify the actual PCX file length, not the array size,
  439. as the buffer size when we call FG_IMAGEBUF.  It is extremely important that
  440. this be the case when displaying GIF or PCX data stored in the image buffer.
  441. Note also how we must include a "place holder" parameter where the PCX file
  442. name is normally passed to FG_SHOWPCX.  While any string can be specified for
  443. this purpose, we recommend using the null string as in the above example.
  444.  
  445. ------------------------------------------------------------------------------
  446.                           Some Notes About Polygons
  447. ------------------------------------------------------------------------------
  448.  
  449. Fastgraph's new polygon fill function (FG_POLYFILL) fills convex polygons.  A
  450. polygon is convex if any horizontal line drawn through the polygon crosses the
  451. left edge exactly once and the right edge exactly once (excluding horizontal
  452. and zero-length edge segments).  Note that this definition includes shapes
  453. that are not convex in the traditional sense.  In addition, any non-convex
  454. polygon can be decomposed into two or more convex polygons.
  455.  
  456. The filled convex polygon is a fundamental tool of three-dimensional computer
  457. graphics.  A common practice is to build an image or object from several
  458. adjacent or connecting polygons.  Such polygons typically overlap at one or
  459. more edges.  For instance, the coordinates defining the right edge of one
  460. polygon may also define the left edge of another polygon immediately to its
  461. right.  For an overall image to appear correct, its component polygons must
  462. fit together correctly.  Fastgraph's FG_POLYFILL function applies the
  463. following rules to handle overlapping polygon edges:
  464.  
  465. 1)  Points located exactly on non-horizontal edges are drawn only if the
  466.     polygon's interior is directly to the right.
  467.  
  468. 2)  Points located exactly on horizontal edges are drawn only if the
  469.     polygon's interior is directly below them.
  470.  
  471. 3)  A vertex is drawn only if all lines ending at that point meet the above
  472.     two conditions.
  473.  
  474. These three rules ensure that no pixel is drawn more than once when filling
  475. adjacent polygons.  However, they may not be suitable for displaying polygons
  476. that are not adjacent because some of the pixels on the polygon's edge will
  477. not be included.  If this is an issue, first draw the filled polygon with
  478. FG_POLYFILL, then draw an unfilled polygon having the same vertices with the
  479. FG_POLYLINE function.  Both FG_POLYFILL and FG_POLYLINE honor the current
  480. clipping limits.
  481.  
  482. Refer to Chapter 6 of the Fastgraph User's Guide for more information about
  483. Fastgraph's new polygon routines.
  484.  
  485. ------------------------------------------------------------------------------
  486.                              Extended Video Pages
  487. ------------------------------------------------------------------------------
  488.  
  489. One of the more frequent technical support questions we receive is "I have
  490. one megabyte of memory on my video card, why can I only use the first 256K?".
  491. The answer is simple:  the standard EGA and VGA modes have no way to address
  492. video memory beyond 256K.  Accessing this memory requires SVGA bank switching
  493. techniques.  This is analogous to the fact that you might have four megabytes
  494. of RAM on your system, but without an EMS/XMS memory manager, a DOS extender,
  495. or the like, all that memory won't do much good.
  496.  
  497. Unfortunately, not all SVGA chipsets allow bank switching in non-SVGA video
  498. modes.  For those that do, however, Fastgraph 3.0 includes a last-minute
  499. addition called EXTENDED VIDEO PAGES that provide access to all memory on the
  500. video card in modes 13 to 23 instead of restricting access to the first
  501. 256K.  This means, for example, that a 1MB SVGA card will allow 32 physical
  502. pages in mode 13 rather than the usual 8 pages.  At this time, extended pages
  503. are available with the following SVGA chipsets:
  504.  
  505.         Ahead B (except in mode 19)
  506.         ATI 28800 (except in mode 19)
  507.         Paradise WD90C11/WD90C30/WD90C31
  508.         Tseng ET4000
  509.  
  510. Although extended pages are used in non-SVGA graphics modes, the method of
  511. accessing video memory above 256K is specific to each SVGA chipset.  Thus,
  512. you must initialize Fastgraph's SVGA kernel (with FG_SVGAINIT) before you can
  513. use extended pages.
  514.  
  515. When writing applications that use extended video pages, you should make sure
  516. they are available on the active SVGA chipset and that there is enough video
  517. memory for the number of pages required.  First, verify that FG_SVGAINIT
  518. successfully initializes the SVGA kernel.  If so, use the FG_SVGASTAT routine
  519. to see if the SVGA chipset supports extended pages.  Finally, use FG_MEMORY
  520. to insure that enough video memory is available for the number of video pages
  521. needed.
  522.  
  523. The following table shows the number of video pages available in modes 13 to
  524. 23.
  525.  
  526.                                  Number of Pages With...
  527.                          Mode    256K    512K    1MB
  528.  
  529.                           13       8      16      32
  530.                           14       4       8      16
  531.                           15       2       4       8
  532.                           16       2       4       8
  533.                           17       2       4       8
  534.                           18       2       4       8
  535.                           19       4       8      16
  536.                           20       4       8      16
  537.                           21       2       4       8
  538.                           22       4       8      16
  539.                           23       2       4       8
  540.  
  541. Note that when extended pages are not enabled, the video mode has the number
  542. of physical video pages listed in the 256K column.  The exception to this is
  543. mode 19, which has only one physical page unless extended pages are enabled.
  544.  
  545. Some video modes do not provide the listed number of full video pages.  For
  546. example, modes 17 and 18 normally have two video pages -- one full 640x480
  547. page (page 0) and one partial 640x320 page (page 1).  For extended pages,
  548. Fastgraph uses a page numbering scheme that maintains consistency with its
  549. standard page numbering.  That is, when extended pages are available and mode
  550. 17 or 18 is used on a 1MB video card, the page numbers will range from 0 to
  551. 7, with the even-numbered pages being full pages and the odd-numbered pages
  552. being partial 640x320 pages.  Similarly, in mode 22 pages 3, 7, 11, and 15
  553. are partial (320x80); in mode 23 odd-numbered pages are partial (320x320).
  554. See the Fastgraph User's Guide for more information on partial video pages.
  555.  
  556. When you use Fastgraph's block transfer routines (FG_COPYPAGE, FG_RESTORE,
  557. FG_SAVE, FG_TCXFER, and FG_TRANSFER) with extended pages, you must also use
  558. the new FG_DEFPAGES routine to define the source and destination video pages.
  559. This is needed because the two pages may reside in different SVGA banks, and
  560. bank switching is not performed in Fastgraph's non-SVGA code.  The additional
  561. overhead of having the block transfer routines determine the bank numbers is
  562. not necessary in all cases (see below), and it would also impact the block
  563. transfer routines when extended pages are not being used.
  564.  
  565. Before you use one of the block transfer routines, you must call FG_DEFPAGES,
  566. passing it the source and destination page numbers.  FG_DEFPAGES determines
  567. the SVGA bank numbers in which the source and destination pages reside and
  568. then enables the corresponding banks for reading and writing, respectively.
  569. These banks remain in effect until you define new ones with FG_DEFPAGES or
  570. FG_SETPAGE, so you may not need to call FG_DEFPAGES before every call to a
  571. block transfer routine.  The following table shows the bank numbers for each
  572. video page in each 16-color mode that supports extended pages.
  573.  
  574.                             ---------- Pages in ----------
  575.                     Mode    Bank 0  Bank 1  Bank 2  Bank 3
  576.  
  577.                      13        0-7    8-15   16-23   24-31
  578.                      14        0-3     4-7    8-11   12-15
  579.                      15        0-1     2-3     4-5     6-7
  580.                      16        0-1     2-3     4-5     6-7
  581.                      17        0-1     2-3     4-5     6-7
  582.                      18        0-1     2-3     4-5     6-7
  583.                      20        0-3     4-7    8-11   12-15
  584.                      21        0-1     2-3     4-5     6-7
  585.                      22        0-3     4-7    8-11   12-15
  586.                      23        0-1     2-3     4-5     6-7
  587.  
  588. In mode 19, each of the 16 possible pages is in its own SVGA bank.  That is,
  589. page 0 is in bank 0, page 1 is in bank 1, and so forth.
  590.  
  591. The following code calls FG_DEFPAGES only when needed in mode 13, where each
  592. group of 8 pages resides in its own SVGA bank.  FG_SETMODE enables bank 0
  593. for reading and writing, so we don't need to call FG_DEFPAGES until we
  594. reference a page in one of the other banks (page 10 in this example).
  595.  
  596.         fg_svgainit(0);
  597.         fg_setmode(13);         /* enables bank 0 for reading and writing */
  598.         fg_copypage(0,1);
  599.         fg_copypage(0,2);
  600.         fg_defpages(0,1);       /* page 10 is in bank 1 */
  601.         fg_copypage(2,10);
  602.         fg_defpages(1,1);       /* page 15 is in bank 1 */
  603.         fg_copypage(10,15);
  604.         fg_setpage(0);          /* enables bank 0 for reading and writing */
  605.         fg_erase();
  606.         fg_copypage(0,3);
  607.         fg_defpages(1,0);       /* page 15 is in bank 1 */
  608.         fg_copypage(15,4);
  609.  
  610. FG_DEFPAGES has no effect unless extended pages are enabled.
  611.  
  612. Most mouse drivers know nothing about SVGA bank switching and non-standard
  613. video modes (that's why Fastgraph must hook its own mouse cursor control
  614. handlers into the mouse driver in XVGA and SVGA modes).  As Fastgraph still
  615. programs the mouse driver for cursor control in modes 13 to 19, it is only
  616. possible to display the mouse cursor on video pages in the first SVGA bank
  617. (bank 0) in these modes.  Note that this does not apply to modes 20 to 23,
  618. where Fastgraph controls the mouse cursor through its own handlers.
  619.  
  620. Some SVGA chipsets do not reset the read and write bank numbers back to zero
  621. when establishing a non-SVGA video mode.  When a mode set operation clears
  622. video memory, such chipsets will clear the first video page in whatever write
  623. bank was last selected.  While FG_SETMODE does set the read and write banks
  624. to zero when extended pages are available, it cannot do this before setting
  625. the video mode, which is what normally would clear the screen.  This may
  626. result in artifacts on page 0 after calling FG_SETMODE.  The easiest way
  627. around this problem is to call FG_DEFPAGES(0,0) before restoring the original
  628. video mode in programs that use extended pages.  Even this, however, does not
  629. clear video memory after a mode set when using extended pages with some SVGA
  630. chipsets.  We therefore recommend calling FG_ERASE immediately after calling
  631. FG_SETMODE when using extended pages.
  632.  
  633. Extended pages may be resized (with FG_RESIZE) just as the standard video
  634. pages may in modes 13-18 and 20-23.  However, the resulting pages must not
  635. cross SVGA bank boundaries.  In mode 20, for instance, you normally have four
  636. 320x200 pages in each bank.  You could change the video page size to 640x400,
  637. thereby having four larger pages, one in each bank.  You could not, however,
  638. resize video memory to two 640x800 pages, as each page would span two banks.
  639.  
  640. Again, we developed extended pages as a last-minute addition to Fastgraph
  641. because we've had so many requests for this feature.  Please bear in mind
  642. that the implementation of extended pages in Fastgraph 3.0 is the first
  643. attempt at a solution to our customer's needs.  In the future, we hope to
  644. find ways to support more SVGA chipsets and remove some of the limitations,
  645. especially the restriction on displaying the mouse cursor beyond bank zero.
  646.  
  647. ------------------------------------------------------------------------------
  648.       Optimizations, Improvements, and Corrections to Existing Routines
  649. ------------------------------------------------------------------------------
  650.  
  651. The performance of several existing Fastgraph functions has been improved in
  652. version 3.0.  The most notable of these are FG_DRWIMAGE (in 16-color modes)
  653. and FG_PAINT, both of which provide a performance improvement on the order of
  654. 20% to 25%.
  655.  
  656. The FG_TEXT routine no longer uses the BIOS in modes 13 to 18.  This change
  657. greatly improves the speed of FG_TEXT in these modes.  It also eliminates
  658. the problem where characters were displayed in the wrong colors when a
  659. character's background cell contained pixels of different colors.
  660.  
  661. The FG_PAN routine now supports one-pixel horizontal panning in modes 19 to
  662. 23.  Previously panning was restricted to four-pixel increments in these
  663. video modes.
  664.  
  665. Fastgraph's mouse support routines no longer require the presence of the
  666. mouse driver's EGA Register Interface Library (RIL) when using the mouse in
  667. modes 17 and 18.  Fastgraph will still use the RIL if it is present, as many
  668. mouse drivers rely on the RIL for proper operation.  For mouse drivers such
  669. as the OS/2 mouse driver that do not use the RIL in these modes, Fastgraph
  670. now programs the VGA registers directly, just as when the mouse isn't used.
  671.  
  672. In modes 20 and 21, the video page offsets were changed to prevent the mouse
  673. cursor save area from conflicting with displayable video memory.  This would
  674. cause problems if the last video page (page 3 in mode 20, page 1 in mode 21)
  675. was the visual page and you moved the mouse into the lower right corner of
  676. the screen.  If your code relies on specific page offsets in these modes, the
  677. new page sizes are 3E80 hex for mode 20 and 7D00 hex for mode 21.  The values
  678. in Fastgraph 2.xx were 4000 and 8000 hex respectively.
  679.  
  680. The FG_BESTMODE routine will now propose mode 20 instead of mode 19 when
  681. checking for a 320 x 200 graphics mode on VGA systems.
  682.  
  683. The order of the two FG_BOXDEPTH parameters has been corrected (they were
  684. transposed in Fastgraph 2.xx).
  685.  
  686. The masking map routines (FG_CLIPMASK, FG_DRAWMASK, FG_FLIPMASK, and
  687. FG_REVMASK) now work in all video modes.
  688.  
  689. The CLIP utility no longer requires two video pages, which means it now
  690. supports modes 17, 18, and 23.
  691.  
  692. ------------------------------------------------------------------------------
  693.                           New Turbo Pascal Unit Files
  694. ------------------------------------------------------------------------------
  695.  
  696. Fastgraph 2.xx uses two unit files, FGTP.TPU and FGTPX.TPU.  FGTP.TPU is the
  697. primary Fastgraph unit, while FGTPX.TPU contains the extended Fastgraph
  698. routines listed in Appendix D of the Fastgraph User's Guide.
  699.  
  700. Borland Pascal and Turbo Pascal restrict the total size of all code segments
  701. in a unit file 65,520 bytes.  With the introduction of the SVGA support and
  702. other new features in Fastgraph 3.0, the size of the FGTP.TPU unit file would
  703. have exceeded this limit.  For this reason, the FGTP.TPU file has been split
  704. into several unit files.
  705.  
  706. Fastgraph routines in FGBITMAP.TPU:
  707.  
  708.         FG_CLIPMASK     FG_FLIPMASK     FG_IMAGEBUF     FG_REVIMAGE
  709.         FG_CLPIMAGE     FG_FLPIMAGE     FG_IMAGESIZ     FG_REVMASK
  710.         FG_DRAWMASK     FG_GETBLOCK     FG_PUTBLOCK
  711.         FG_DRWIMAGE     FG_GETIMAGE     FG_PUTIMAGE
  712.  
  713. Fastgraph routines in FGGIF.TPU:
  714.  
  715.         FG_MAKEGIF      FG_SHOWGIF
  716.  
  717. Fastgraph routines in FGMISC.TPU:
  718.  
  719.         FG_BUTTON       FG_INTKEY       FG_MOUSEPOS     FG_SETCAPS
  720.         FG_CAPSLOCK     FG_KBINIT       FG_MOUSEPTR     FG_SETNUM
  721.         FG_CURSOR       FG_KBTEST       FG_MOUSESPD     FG_SOUND
  722.         FG_GETCLOCK     FG_MEASURE      FG_MOUSEVIS     FG_SOUNDS
  723.         FG_GETKEY       FG_MEMAVAIL     FG_MUSIC        FG_SUSPEND
  724.         FG_GETXJOY      FG_MOUSEBUT     FG_MUSICB       FG_VOICE
  725.         FG_GETYJOY      FG_MOUSECUR     FG_NUMLOCK      FG_VOICES
  726.         FG_HUSH         FG_MOUSEFIN     FG_PLAYING      FG_WAITFOR
  727.         FG_HUSHNEXT     FG_MOUSEINI     FG_QUIET        FG_WAITKEY
  728.         FG_INITJOY      FG_MOUSELIM     FG_RESUME
  729.         FG_INTJOY       FG_MOUSEMOV     FG_SCRLOCK
  730.  
  731. Fastgraph routines in FGPCX.TPU:
  732.  
  733.         FG_MAKEPCX      FG_PCXHEAD      FG_PCXMODE      FG_SHOWPCX
  734.  
  735. Fastgraph routines in FGPR.TPU:
  736.  
  737.         FG_DISPFILE     FG_DISPLAYP     FG_MAKESPR      FG_SHOWSPR
  738.         FG_DISPLAY      FG_MAKEPPR      FG_SHOWPPR
  739.  
  740. Fastgraph routines in FGSVGA.TPU:
  741.  
  742.         FG_DEFPAGES     FG_SVGAINIT     FG_SVGASTAT     FG_SVGAVER
  743.         FG_MEMORY
  744.  
  745. Any Fastgraph routine that uses the world space coordinate system is in the
  746. file FGWORLD.TPU (this was formerly FGTPX.TPU).  All other Fastgraph routines
  747. are in the FGMAIN.TPU unit file.
  748.  
  749. The above lists appear in Appendix E of the Fastgraph User's Guide.
  750.  
  751. ------------------------------------------------------------------------------
  752.                    Converting Applications to Fastgraph 3.0
  753. ------------------------------------------------------------------------------
  754.  
  755. Only two features in Fastgraph 2.xx are not upwardly compatible with version
  756. 3.0.  The first applies only to Borland Pascal and Turbo Pascal, while the
  757. second applies to all supported compilers.
  758.  
  759. As described in the previous section, it was necessary to split the FGTP.TPU
  760. unit of Fastgraph 2.xx into several unit files.  Additionally, the FGTPX.TPU
  761. unit is now called FGWORLD.TPU.  Pascal programmers must replace the FGTP and
  762. FGTPX unit names in the USES statement with FGMAIN and FGWORLD, respectively.
  763. If your programs call any of the routines in the other new units, you must
  764. add the appropriate unit names to the USES statement as well.  Please see the
  765. preceding section of this document or Appendix E of the Fastgraph User's
  766. Guide for lists of the Fastgraph routines in each unit file.
  767.  
  768. The other change pertains to the new FG_SHOWPCX function, which replaces the
  769. FG_DISPPCX function of earlier versions (the function was renamed to avoid
  770. confusion with the pixel run display routines, which all have names of the
  771. form FG_DISPxxxx).
  772.  
  773. PCX image positioning will generally not be an issue for full-screen PCX files
  774. because the PCX header typically defines their upper left corner at the screen
  775. origin, which is where you'd move to display a full-screen image anyway.
  776. However, if a PCX file is smaller than the screen resolution and you want to
  777. override the image positioning in the PCX header, you must define a new
  778. FG_SHOWPCX flags argument in which bit 1 is set.  That is, the Fastgraph 2.xx
  779. call FG_DISPPCX(filename,0) is equivalent to FG_SHOWPCX(filename,2).
  780. Similarly, FG_DISPPCX(filename,1) is equivalent to FG_SHOWPCX(filename,3).
  781. Note that C programmers can use the following preprocessor directive to make
  782. an old FG_DISPPCX call compatible with the new FG_SHOWPCX function.
  783.  
  784.                   #define fg_disppcx(a,b) fg_showpcx(a,b|2)
  785.