home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / PROG / CLIPGRAF.ZIP / CLIPGRAF.TXT < prev    next >
Encoding:
Text File  |  1989-02-02  |  41.5 KB  |  1,519 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                     CLIP-GRAPHICS
  19.  
  20.                           The Clipper (tm)  Graphics Library
  21.  
  22.                                  by Maurice J. Halmos
  23.  
  24.  
  25.  
  26.                                      Version 1.2
  27.  
  28.                                     February 1989
  29.  
  30.  
  31.  
  32.  
  33.                                    Serial #1000300
  34.  
  35.                 Copyright (c) VideoSoft/Video-Comp Electr. 1988, 1989
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  74.  
  75.  
  76.  
  77.                                   Table of Contents
  78.  
  79.      1 INTRODUCTION .................................................... 1
  80.         1.1 Purpose & Registration ..................................... 1
  81.         1.2 Disclaimer ................................................. 2
  82.  
  83.      2 THE GRAPHICS LIBRARY ............................................ 3
  84.         2.1 Usage ...................................................... 3
  85.         2.2 Running the Clipdemo ....................................... 3
  86.         2.3 What Is in New Version ..................................... 4
  87.         2.4 Summary of functions ....................................... 4
  88.         2.5 Functions Description  ..................................... 7
  89.            2.5.1 Notes on Ellipse, Arc, and Pie ........................ 7
  90.            2.5.2 Notes on Initializing and Modes ....................... 7
  91.            2.5.3 Notes on Color ........................................ 8
  92.            2.5.4 Notes in Fill Pattern ................................. 9
  93.            2.5.5 Notes on Image Saving and Loading ..................... 10
  94.            2.5.6 Notes on Using the Mouse. ............................. 11
  95.            2.5.7 Functions ............................................. 12
  96.              FUNCTION:  g_arc(x1,y1,x2,y2,xb,yb,xe,ye) ................. 12
  97.              FUNCTION:  g_clear(num) ................................... 12
  98.              FUNCTION:  g_close() ...................................... 12
  99.              FUNCTION:  g_dot(x,y) ..................................... 12
  100.              FUNCTION:  g_draw(x1,y1,IMAGE,action) ..................... 13
  101.              FUNCTION:  g_ellip(fill,x1,y1,x2,y2) ...................... 13
  102.              FUNCTION:  g_fill(x,y,bcolor) ............................. 13
  103.              FUNCTION:  g_getdot(x,y) .................................. 13
  104.              FUNCTION:  g_imget(x1,y1,x2,y2) ........................... 14
  105.              FUNCTION:  g_imload(x1,y1,"fname") ........................ 14
  106.              FUNCTION:  g_imsave(x1,y1,x2,y2,"fname") .................. 14
  107.              FUNCTION:  g_imsize(x1,y1,x2,y2) .......................... 14
  108.              FUNCTION:  g_init(num) .................................... 15
  109.              FUNCTION:  g_lineto(x,y) .................................. 15
  110.              FUNCTION:  g_mode() ....................................... 15
  111.              FUNCTION:  g_mouse(num) ................................... 15
  112.              FUNCTION:  g_moveto(x,y) .................................. 16
  113.              FUNCTION:  g_msread(num) .................................. 16
  114.              FUNCTION:  g_ncolors() .................................... 16
  115.              FUNCTION:  g_pie(fill,x1,y1,x2,y2,xb,yb,xe,ye) ............ 16
  116.              FUNCTION:  g_rect(fill,x1,y1,x2,y2) ....................... 17
  117.              FUNCTION:  g_reg(num) ..................................... 17
  118.              FUNCTION:  g_say(row,col,text) ............................ 17
  119.              FUNCTION:  g_selpalt(num) ................................. 17
  120.              FUNCTION:  g_setapage(num) ................................ 17
  121.              FUNCTION:  g_setbkc(num) .................................. 18
  122.              FUNCTION:  g_setclr(num) .................................. 18
  123.  
  124.  
  125.  
  126.                                          -ii-
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  140.  
  141.  
  142.  
  143.              FUNCTION:  g_setfmsk(byte,byte,byte,byte,byte,byte,by-
  144.              te,byte) .................................................. 18
  145.              FUNCTION:  g_setline(num) ................................. 18
  146.              FUNCTION:  g_setorg(x,y) .................................. 18
  147.              FUNCTION:  g_settxtc(num) ................................. 19
  148.              FUNCTION:  g_setvpage(num) ................................ 19
  149.              FUNCTION:  g_twindow(r1,c1,r2,c2) ......................... 19
  150.              FUNCTION:  g_viewport(x1,y1,x2,y2) ........................ 19
  151.              FUNCTION:  g_wait() ....................................... 20
  152.              FUNCTION:  g_wraptxt(flag) ................................ 20
  153.              FUNCTION:  g_xmax() ....................................... 20
  154.              FUNCTION:  g_ymax() ....................................... 20
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.                                         -iii-
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  206.  
  207.  
  208.  
  209.                                     1 INTRODUCTION
  210.  
  211.  
  212.      1.1 Purpose & Registration
  213.  
  214.           The CLIPGRAF library is intended to be a supplement to your Clipper
  215.      run time library.  It contains a collection of graphic mode routines for
  216.      doing all the low level and higher level graphic tasks, from determining
  217.      the graphics adaptor, to animation.  The library uses direct video rou-
  218.      tines, for fast performance, hence, it will only work with IBM (tm) compat-
  219.      ible desktop computers.  The library functions have been tested in a number
  220.      of 8088, 80286, and 80386 clones.  It supports CGA, HERCULES, EGA, and VGA
  221.      graphics adaptors.
  222.  
  223.           This is a shareware program.  As such, it may be freely copied and
  224.      distributed for evaluation.
  225.  
  226.           If you would like to use it, you must purchase a license.  One license
  227.      per user is required.  The license will be good for all future updates of
  228.      the library, and will allow you to inhibit the copyright notice that you
  229.      get the first time you use the CLIPGRAF library.
  230.  
  231.           Licenses cost $20.  Include your name and address along with the ver-
  232.      sion and serial number above.
  233.  
  234.           Send to:
  235.  
  236.                         VideoSoft/Video-Comp Electr.
  237.                         Maurice J. Halmos
  238.                         825 Washington Ave. #15
  239.                         Santa Monica, CA 90403
  240.  
  241.  
  242.  
  243.      Send comments through written mail to the above address or use E-mail to my
  244.      CompuServe address:  73307,3076
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.                                          -1-
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  272.  
  273.  
  274.  
  275.  
  276.  
  277.      1.2 Disclaimer
  278.  
  279.  
  280.  
  281.          The author claims no responsibility for any damages caused by the use
  282.      or misuse of this library.  This product is distributed "as is" with no
  283.      warranty expressed or implied.  The author will not be responsible for any
  284.      losses incurred by the use of this product.  The author reserves the right
  285.      to make modifications at any time.  Prices are subject to change without
  286.      notice.
  287.  
  288.  
  289.          Trademarks.
  290.  
  291.      Clipper is a registered trademark of Nantucket.
  292.      CompuServe is a registered trademark of CompuServe Incorporated.
  293.      IBM is a registered trademark of International Business Machines.
  294.      Lotus is a registered trademark of Lotus Development Corporation.
  295.      Microsoft is a registered trademark of Microsoft Corporation.
  296.      Turbo C is a registered trademark of Borland International.
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                                          -2-
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  338.  
  339.  
  340.  
  341.  
  342.  
  343.                                 2 THE GRAPHICS LIBRARY
  344.  
  345.  
  346.      2.1 Usage
  347.  
  348.           Assuming that you have written a program, such as the sample program
  349.      included in this package, CLIPDEMO, you must compile and link as follows
  350.      (which is the usual way):
  351.  
  352.      (Compile the usual way,)
  353.  
  354.      c:\path1\clipper  c:\path2\clipdemo
  355.  
  356.  
  357.      (you may use Microsoft Linker - faster)
  358.  
  359.      c:\path3\link clipdemo,clipdemo,, c:\path1\clipper c:\path1\clipgraf
  360.  
  361.  
  362.      (or Turbo C Tlink - fastest)
  363.  
  364.      c:\path3\tlink clipdemo,clipdemo,, c:\path1\clipper c:\path1\clipgraf
  365.  
  366.  
  367.      (or Clipper's plink86 - slowest)
  368.  
  369.      c:\path3\plink86 FI clipdemo,LIB c:\path1\clipper, c:\path1\clipgraf
  370.  
  371.  
  372.  
  373.           Though Turbo C has the fastest linker, it will complain about unre-
  374.      solved externals.  The compiled programs seemed to run properly in spite of
  375.      the warnings.  Use the linker that is most convenient for you to use.
  376.  
  377.      2.2 Running the Clipdemo
  378.  
  379.           The demonstration program along with this package must be compiled and
  380.      linked as shown in the previous section.  In order to run the program you
  381.      just type its name, "clipdemo".  The program will select the highest reso-
  382.      lution graphics mode, that has more than 2 colors (i.e. for CGA it will
  383.      choose 320x200 4 colors).  You may override to different graphics mode by
  384.      calling the program with a "number" parameter (i.e. "clipdemo 6") to try to
  385.  
  386.  
  387.  
  388.  
  389.  
  390.                                          -3-
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  404.  
  405.  
  406.  
  407.      force that mode.  If your computer supports it, then that will be the
  408.      active mode.  See table in section 2.5.2 Notes on Initializing and Modes,
  409.      for mode numbers.
  410.  
  411.      2.3 What Is in New Version
  412.  
  413.           Version 1.1 added:
  414.  
  415.                The ability to save images to CLIPPER Variable
  416.  
  417.                The ability to save images to disk
  418.  
  419.                Mouse interface
  420.  
  421.  
  422.  
  423.           Version 1.1 added:
  424.  
  425.                HERCULES graphics support
  426.  
  427.                The function g_getdot() to read a pixel from the screen
  428.  
  429.      2.4 Summary of functions
  430.  
  431.           The following list contains all the functions that may be used with
  432.      the CLIPGRAF library.  Some of the functions return values, while others
  433.      only perform tasks.
  434.  
  435.      Function Name                  Purpose                    Returns
  436.  
  437.      g_arc(x1,y1,x2,y2,xb,yb,       Draws an open elliptic     Nothing
  438.            xe,ye)                   arc
  439.  
  440.      g_clear(num)                   clears section of the      Nothing
  441.                                     screen
  442.  
  443.      g_close()                      return screen to start-    Nothing
  444.                                     ing or default mode
  445.  
  446.      g_dot(x,y)                     sets pixel at x,y coor-    Nothing
  447.                                     dinates
  448.  
  449.      g_draw(x1,y1,IMAGE,action)     Displays a rectangular     Nothing
  450.                                     screen image saved with
  451.                                     g_imget().
  452.  
  453.  
  454.  
  455.  
  456.                                          -4-
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  470.  
  471.  
  472.  
  473.      g_ellip(fill,x1,y1,x2,y2)      draw ellipse optionally    Nothing
  474.                                     filled
  475.  
  476.      g_fill(x,y,bcolor)             Fill an area of the        Nothing
  477.                                     screen with the current
  478.                                     color and fillmask
  479.  
  480.      g_getdot(x,y)                  Reads a pixel from the     Integer repre-
  481.                                     screen                     senting the pixel
  482.  
  483.      g_imget(x1,y1,x2,y2)           Saves rectangular image    Up to 64K of
  484.                                     in a CLIPPER variable.     image data as
  485.                                     To be used with            TEXT.
  486.                                     g_draw().
  487.  
  488.      g_imload(x1,y1,"fname")        Displays a rectangular     Number of bytes
  489.                                     screen image saved with    read from disk.
  490.                                     g_imsave().
  491.  
  492.      g_imsave(x1,y1,x2,y2,"fname"   Saves rectangular image    Number of bytes
  493.      )                              to disk.                   written to disk.
  494.  
  495.      g_imsize(x1,y1,x2,y2)          Calculates the size in     Integer of image
  496.                                     bytes of a rectangular     size.
  497.                                     image.
  498.  
  499.      g_init(num)                    Initializes the graphics   False if it
  500.                                     routines                   fails, True if
  501.                                                                successful
  502.  
  503.      g_lineto(x,y)                  Draw a line in the cur-    Nothing
  504.                                     rent color and style.
  505.  
  506.      g_mode()                                                  Returns the mode
  507.                                                                number
  508.  
  509.      g_mouse(num)                   Sets mouse action          Nothing
  510.  
  511.      g_moveto(x,y)                  Moves to x,y position      Nothing
  512.  
  513.      g_msread(num)                  Reads mouse status         Coordinates, but-
  514.                                                                tons pressed, and
  515.                                                                status.
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.                                          -5-
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  536.  
  537.  
  538.  
  539.      g_ncolors()                    Obtains the maxcolors      Returns max. num-
  540.                                     available in the present   ber of colors
  541.                                     mode.                      available.
  542.  
  543.      g_pie(fill,x1,y1,x2,y2,        Draw a wedge cut from an   Nothing
  544.            xb,yb,xe,ye)             ellipse
  545.  
  546.      g_rect(fill,x1,y1,x2,y2)       Draw a rectangle           Nothing
  547.  
  548.      g_reg(num)                     Register to CLIPGRAF       Nothing
  549.                                     library
  550.  
  551.      g_say(row,col,text)            Puts text at row,col       Nothing
  552.  
  553.      g_selpalt(num)                 Selects color palette      Previous palette
  554.                                                                number
  555.  
  556.      g_setapage(num)                Select a video page for    Previous page
  557.                                     current output             number.
  558.  
  559.      g_setbkc(num)                  Sets background color      Nothing
  560.  
  561.      g_setclr(num)                  Sets the foreground        Nothing
  562.                                     color.
  563.  
  564.      g_setfmsk(byte,byte,byte,      Sets the fill mask         Nothing
  565.         byte,byte,byte,byte,byte)
  566.  
  567.      g_setline(num)                 Sets line pattern.         Nothing
  568.  
  569.      g_setorg(x,y)                  Changes the coordinate     Nothing
  570.                                     origin.
  571.  
  572.      g_settxtc(num)                 Set text color.            Nothing
  573.  
  574.      g_setvpage(num)                Select a video page for    Previous page
  575.                                     viewing                    number.
  576.  
  577.      g_twindow(r1,r1,r2,c2)         Defines a scrolling text   True or False
  578.                                     display window
  579.  
  580.      g_viewport(x1,y1,x2,y2)        Sets up a rectangular      True or False
  581.                                     region for display
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.                                          -6-
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  602.  
  603.  
  604.  
  605.      g_wait()                       Waits for a character to   The integer cor-
  606.                                     be hit.                    responding to the
  607.                                                                character.
  608.  
  609.      g_wraptxt(flag)                Allows text to wrap in     Nothing
  610.                                     text window.
  611.  
  612.      g_xmax()                                                  Maximum x pixels
  613.  
  614.      g_ymax()                                                  Maximum y pixels
  615.  
  616.      2.5 Functions Description
  617.  
  618.      2.5.1 Notes on Ellipse, Arc, and Pie
  619.  
  620.           The specification of the ellipse, arc, and the pie involves the con-
  621.      cept of the "bounding rectangle," which is the smallest rectangle that
  622.      completely encloses the figure being drawn.  Since the arc and pie are both
  623.      parts of the ellipse, in all cases you have to specify the bounding rectan-
  624.      gle of an ellipse.  Both the bounding rectangle and the basic rectangle are
  625.      specified by the logical coordinates of their upper left hand and lower
  626.      right corners.
  627.  
  628.           For the arc as well as the pie, the elliptic segment is drawn as
  629.      follows.  A (imaginary) line is drawn from the center of the ellipse (of
  630.      which the arc or the pie is a part) to a point specified as the beginning
  631.      point.  The g_pie() and the g_arc() functions begin drawing the curved edge
  632.      at the point where that line intersects the ellipse.  The functions trace
  633.      over the underlying ellipse, using the current color, in a counter-
  634.      clockwise direction until reaching the point where an imaginary line drawn
  635.      from the center to a specified end point cuts the ellipse.  Curved lines
  636.      are always drawn in a solid line style.  Thus the ellipse and the pie can
  637.      only have a solid boundary.  They can however be filled in the interior
  638.      with a user defined pattern.
  639.  
  640.      2.5.2 Notes on Initializing and Modes
  641.  
  642.           You need to initialize the graphics driver to operate the graphics
  643.      functions.  The g_init() function does this, and sets up the screen to the
  644.      highest mode supported by the hardware.  You may override the mode selec-
  645.      tion by including an argument to the function, i.e. g_init(mode_number).
  646.  
  647.           To use the HERCULES Graphics mode, you must run the utility HERC.COM
  648.      before your program, in order to set the video vectors.  This utility is
  649.      placed in the public domain by Microsoft and is included in this package.
  650.  
  651.  
  652.  
  653.  
  654.                                          -7-
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  668.  
  669.  
  670.  
  671.           The following modes are supported:
  672.  
  673.           Mode #        Mode Name
  674.  
  675.           19            VGA 320x200  256 colors
  676.  
  677.           18            VGA 640x480  16 colors
  678.  
  679.           17            VGA 649x480  BW 2 colors
  680.  
  681.           16            EGA 640x350  4 or 16 colors
  682.  
  683.           15            EGA 640x350  BW 2 colors
  684.  
  685.           14            EGA 640x200  16 colors
  686.  
  687.           13            EGA 320x200  16 colors
  688.  
  689.           8             HERCULES Graphics BW (Must run HERC.COM before)
  690.  
  691.           7             MDA Text 80x25 BW
  692.  
  693.           6             CGA 640x200  BW 2 colors
  694.  
  695.           5             CGA 320x200  BW 4 grey
  696.  
  697.           4             CGA 320x200  4 colors
  698.  
  699.           3             CGA Text 80x25 16 or 8 colors
  700.  
  701.           -1            Default mode for the current hardware configuration
  702.  
  703.           The first time you use g_init(), you will get a copyright message,
  704.      further calls to g_init() (if you want to change the mode for instance)
  705.      will not re-display this screen.  To inhibit the original copyright screen
  706.      you must use the function g_reg(reg_number), where reg_number is the
  707.      registration number you get when you become a registered user.
  708.  
  709.      2.5.3 Notes on Color
  710.  
  711.           The color number may vary according to the hardware used.  The default
  712.      colors in CGA text mode, EGA text and graphics, or the first 16 VGA text
  713.      and graphics, are:
  714.  
  715.              Color Number          Color
  716.  
  717.  
  718.  
  719.  
  720.                                          -8-
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  734.  
  735.  
  736.  
  737.              0                     Black
  738.  
  739.              1                     Blue
  740.  
  741.              2                     Green
  742.  
  743.              3                     Cyan
  744.  
  745.              4                     Red
  746.  
  747.              5                     Magenta
  748.  
  749.              6                     Brown
  750.  
  751.              7                     White
  752.  
  753.              8                     Dark grey
  754.  
  755.              9                     Light blue
  756.  
  757.              10                    Light green
  758.  
  759.              11                    Light cyan
  760.  
  761.              12                    Light red
  762.  
  763.              13                    Light magenta
  764.  
  765.              14                    Yellow
  766.  
  767.              15                    Bright white
  768.  
  769.      2.5.4 Notes in Fill Pattern
  770.  
  771.           The fill pattern is specified by the argument in g_setfmsk(), which is
  772.      made up of eight integers corresponding to eight bytes.  Since each charac-
  773.      ter has 8 bits, you can think of this array of bits as a model of an area
  774.      on the screen, 8 pixels wide and 8 pixels tall, with the first byte
  775.      representing the first row of the area.  When filling an 8x8 area using the
  776.      mask, those pixels that correspond to 0 bits are left untouched while the
  777.      rest are filled with the current color.  For areas larger than 8x8 pixels,
  778.      the fill operation uses the mask on successive 8x8 blocks until the entire
  779.      area is covered.  Thus a solid fill is specified when all eight bytes
  780.      contain the value FFh (255 decimal).  This is the default value of the fill
  781.      style in the graphics package.  See demo program for further examples.
  782.  
  783.  
  784.  
  785.  
  786.                                          -9-
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  800.  
  801.  
  802.  
  803.      2.5.5 Notes on Image Saving and Loading
  804.  
  805.           There are two basic ways of saving and loading images.
  806.  
  807.               1. To and from a CLIPPER memory variable using the g_imget() and
  808.                  g_draw() function pairs, and g_imsize() to check for size, and
  809.  
  810.               2. To and from a disk file using g_imsave() and g_imload().
  811.  
  812.           Using the first method you must check to make sure you have enough RAM
  813.      memory, and for the second method, enough disk space.  Using the first
  814.      method has the advantage of being able to "pop" the image on the screen
  815.      rather quickly.  You can also save the CLIPPER variable to disk.  The
  816.      drawback, is that you can only do this in 64K chunks.  The disk method
  817.      allows you to save a full high resolution screen to disk in one command,
  818.      but is slower.
  819.  
  820.           The coding of the image is different for the two methods, and cannot
  821.      be interchanged.  The disk method uses one byte per pixel; for a high res
  822.      VGA mode, this equals 640x480 = 307K bytes!  Using this scheme, allows
  823.      images saved in one mode to be showed in a different one (i.e. CGA to EGA
  824.      or vice versa).
  825.  
  826.           Using the RAM memory method the minimum amount of bytes is used.  For
  827.      instance, one pixel in high res VGA or EGA (16 colors) requires only half a
  828.      byte.  Images may be switched from one mode to another, only if the pixels
  829.      use the same number of bits.  Otherwise, on gets garbage on the screen.
  830.  
  831.           The following table shows some of the full screen sizes in bytes:
  832.  
  833.                   Mode        Res.            Colors        Size
  834.  
  835.                   4 & 5       320x200         4             16,285
  836.  
  837.                   6           640x200         2             16,285
  838.  
  839.                   13          320x200         16            32,968
  840.  
  841.                   14          640x200         16            65,128
  842.  
  843.                   15          640x350         2             56,866
  844.  
  845.                   16          640x350         16            113,728
  846.  
  847.                   17          640x480         2             38,965
  848.  
  849.  
  850.  
  851.  
  852.                                          -10-
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  866.  
  867.  
  868.  
  869.                   18          640x480         16            155,848
  870.  
  871.                   19          320x200         256           64,525
  872.  
  873.           This table should give you an idea of the size of screen that can be
  874.      saved to memory.
  875.  
  876.  
  877.           Pixel action: OR, AND, RESET, SET XOR:
  878.  
  879.           When you use g_draw(), you can specify the pixel action.  To put a
  880.      pixel on the screen regardless of what is currently there, you should use
  881.      SET.  To make an image disappear you should XOR it with itself.
  882.  
  883.      2.5.6 Notes on Using the Mouse.
  884.  
  885.           The mouse interface is handled by a two function combination, g_mou-
  886.      se() and g_msread().  The first function, g_mouse() causes an action, and
  887.      the second function is used to read the status.  This is done by reading
  888.      the 4 registers (AX BX CX DX) using the appropriate argument 1 to 4.  The
  889.      following table shows the actions and results:
  890.  
  891.       g_mouse()  g_msread() Return Value of           Purpose
  892.          num       num      g_msread(num)
  893.            0          1     1 Mouse installed        Reset mouse and return
  894.                             0 Mouse not installed    status and number of but-
  895.                                                      tons
  896.                       2     Number of buttons
  897.            1                                         Make mouse cursor visible
  898.            2                                         Hide mouse cursor
  899.            3          2     0 no button pressed      Return button status and
  900.                             1 left button pressed    mouse position.
  901.                             2 right button pressed
  902.                             3 both buttons pressed
  903.                       3     y coordinate
  904.                       4     x coordinate
  905.  
  906.      The coordinates are in units of "mickeys".  These are 0-639 across, and
  907.      0-ymax in the vertical, where ymax is the maximum number of pixels in the
  908.      vertical.
  909.  
  910.           The mouse routines use the standard bios interrupt calls related to
  911.      the mouse driver.  I have found that the effects are not always as
  912.      expected, and they may vary from one screen mode to another.  You can test
  913.      this with the clipdemo program accompanying this package.
  914.  
  915.  
  916.  
  917.  
  918.                                          -11-
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  932.  
  933.  
  934.  
  935.      2.5.7 Functions
  936.  
  937.           FUNCTION:  g_arc(x1,y1,x2,y2,xb,yb,xe,ye)
  938.  
  939.           Purpose: Use g_arc to draw a segment of an ellipse using the
  940.           current color.
  941.  
  942.           Arguments:
  943.  
  944.               x1,y1  Coordinates of upper left corner of bounding rectangle of
  945.                     the ellipse to which the arc belongs.
  946.  
  947.               x2,y2  Coordinates of lower right corner of bounding rectangle of
  948.                     the ellipse to which the arc belongs.
  949.  
  950.               xb,yb  Arc begins at the point where a line drawn from the center
  951.                     of the bounding rectangle to (xb,yb) cuts the ellipse.
  952.  
  953.               xe,ye  Arc ends at the point where a line drawn from the center of
  954.                     the bounding rectangle to (xe,ye) cuts the ellipse.
  955.  
  956.           FUNCTION:  g_clear(num)
  957.  
  958.           Purpose:  Clear an area of the screen and fill it with the current
  959.                    background color.
  960.  
  961.           Arguments: 0  Entire screen is cleared
  962.                     1 Only current viewport is cleared
  963.                     2 Only current text window is cleared
  964.  
  965.  
  966.  
  967.           FUNCTION:  g_close()
  968.  
  969.           Purpose: Resets the screen to the mode it was before g_init() was
  970.           invoked.
  971.  
  972.           FUNCTION:  g_dot(x,y)
  973.  
  974.           Purpose: Set a specific pixel to the current color
  975.  
  976.           Arguments: x,y  is the current coordinate system
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.                                          -12-
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  998.  
  999.  
  1000.  
  1001.           FUNCTION:  g_draw(x1,y1,IMAGE,action)
  1002.  
  1003.           Purpose:     The function is used to draw a rectangular image, that
  1004.                       was saved to a CLIPPER variable by g_imget().
  1005.  
  1006.           Arguments:   The rectangle coordinates, top left corner is (x1,y1),
  1007.                       IMAGE is the CLIPPER text variable created with g_imget(),
  1008.                       and action is a number that specifies the pixel action to
  1009.                       be used.  These may be, 0 - for OR, 1 - for AND, 2 - for
  1010.                       RESET, 3 - for SET, and 4 - for XOR.
  1011.  
  1012.           FUNCTION:  g_ellip(fill,x1,y1,x2,y2)
  1013.  
  1014.           Purpose: Draw a filled or bordered ellipse that you specify by the
  1015.                   corners of the bounding rectangle.
  1016.  
  1017.           Arguments:
  1018.  
  1019.               fill   0 do not fill, i.e. bordered only
  1020.                     1 fill with the current fillmask.
  1021.  
  1022.               x1,y1  Coordinates of upper left corner of bounding rectangle of
  1023.                     the ellipse to which the arc belongs.
  1024.  
  1025.               x2,y2  Coordinates of lower right corner of bounding rectangle of
  1026.                     the ellipse to which the arc belongs.
  1027.  
  1028.           FUNCTION:  g_fill(x,y,bcolor)
  1029.  
  1030.           Purpose: Fill an area of the screen with the current color using the
  1031.                   current fillmask.
  1032.  
  1033.           arguments: x,y     position of starting point
  1034.                     bcolor  Color number of the boundary at which filling
  1035.                     should stop
  1036.  
  1037.           FUNCTION:  g_getdot(x,y)
  1038.  
  1039.           Purpose: Read a specific pixel at the pixel color
  1040.  
  1041.           Arguments: x,y  is the current coordinate system
  1042.  
  1043.           Returns:  Integer corresponding to the pixel color
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.                                          -13-
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1064.  
  1065.  
  1066.  
  1067.           FUNCTION:  g_imget(x1,y1,x2,y2)
  1068.  
  1069.           Purpose:     The function is used to save a rectangular screen image
  1070.                       into a CLIPPER text variable.  The CLIPPER variable may
  1071.                       then be treated as any other.
  1072.  
  1073.           Arguments:   The rectangle coordinates, top left corner is (x1,y1) and
  1074.                       lower right corner (x2,y2).
  1075.  
  1076.           Returns:     Character string up to 64K long.  Size may be checked
  1077.                       before operation, using g_imsize().  See "Notes on Image
  1078.                       Saving and Loading" section.
  1079.  
  1080.           FUNCTION:  g_imload(x1,y1,"fname")
  1081.  
  1082.           Purpose:     The function is used to load a rectangular screen image
  1083.                       from disk.  This image file must have been created with
  1084.                       g_imsave().
  1085.  
  1086.           Arguments:   The rectangle coordinates top left corner is (x1,y1).
  1087.                       "fname" is the file name to be used.
  1088.  
  1089.           Returns:     Integer of the number of bytes loaded.  If there was a
  1090.                       problem opening file (i.e. not found), then it returns a
  1091.                       -1.  See "2.5.5" section.
  1092.  
  1093.           FUNCTION:  g_imsave(x1,y1,x2,y2,"fname")
  1094.  
  1095.           Purpose:     The function is used to save a rectangular screen image
  1096.                       to disk.  This image may be reloaded with g_imload().
  1097.  
  1098.           Arguments:   The rectangle coordinates, top left corner is (x1,y1) and
  1099.                       lower right corner (x2,y2).  "fname" is the file name to
  1100.                       be used.   If the file-name already exist, it is written
  1101.                       over.
  1102.  
  1103.           Returns:     Integer of the number of bytes written.  See "2.5.5"
  1104.                       section.
  1105.  
  1106.           FUNCTION:  g_imsize(x1,y1,x2,y2)
  1107.  
  1108.           Purpose:     The function is used to obtain the size of rectangular
  1109.                       screen image.  This is used to determine if there is
  1110.                       enough RAM memory to hold the image.
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.                                          -14-
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1130.  
  1131.  
  1132.  
  1133.           Arguments:   The rectangle coordinates, top left corner is (x1,y1) and
  1134.                       lower right corner (x2,y2).
  1135.  
  1136.           Returns:     Integer value of the number of bytes, that would be
  1137.                       require to hold the image.  See "2.5.5" section.
  1138.  
  1139.           FUNCTION:  g_init(num)
  1140.  
  1141.           Purpose: The g_init() function has two purposes:  It sets which video
  1142.                   mode to use for the graphics and gets the data for that mode
  1143.                   and stores it to a data structure for program access. (i.e.
  1144.                   g_mode(), g_xmax(), g_ymax(), g_ncolors())
  1145.  
  1146.           Arguments: mode  Optional mode number.  If no argument is used, the
  1147.                          highest possible one is selected.  If mode number used
  1148.                          is not supported by the hardware, then again the high-
  1149.                          est possible one is selected.
  1150.  
  1151.           Returns: Logical TRUE if successful, FALSE is no mode was found.
  1152.  
  1153.           FUNCTION:  g_lineto(x,y)
  1154.  
  1155.           Purpose: Draw a line from the current position to a new point using
  1156.                   the current color and line style
  1157.  
  1158.           Arguments:  x,y Coordinate point to which line is drawn
  1159.  
  1160.           FUNCTION:  g_mode()
  1161.  
  1162.           Purpose: Retrieves the current video mode
  1163.  
  1164.           Returns: The mode number (see "Notes on Initializing and Modes"
  1165.           section)
  1166.  
  1167.           FUNCTION:  g_mouse(num)
  1168.  
  1169.           Purpose: Reset and activate mouse functions
  1170.  
  1171.           Parameters: Number specifying the mouse actions (see "Notes on Using
  1172.           the Mouse." section)
  1173.  
  1174.           Returns:  Nothing
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.                                          -15-
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1196.  
  1197.  
  1198.  
  1199.           FUNCTION:  g_moveto(x,y)
  1200.  
  1201.           Purpose: Change the current position to a new point.
  1202.  
  1203.           Arguments:  x,y Coordinate of new position.
  1204.  
  1205.           FUNCTION:  g_msread(num)
  1206.  
  1207.           Purpose: Read the results of g_mouse().  This includes mouse status,
  1208.               position, and buttons pressed
  1209.  
  1210.           Parameters: Number specifying the mouse parameter to be read (see
  1211.           "2.5.6" section)
  1212.  
  1213.           Returns:  Number corresponding to status, number of buttons, position.
  1214.  
  1215.           FUNCTION:  g_ncolors()
  1216.  
  1217.           Purpose: Retrieves the maximum number of colors supported by the
  1218.                   current video mode
  1219.  
  1220.           Returns: The color number (see "Notes on Color" section)
  1221.  
  1222.           FUNCTION:  g_pie(fill,x1,y1,x2,y2,xb,yb,xe,ye)
  1223.  
  1224.           Purpose: Draws a filled or bordered wedge whose boundary consists
  1225.           of a segment of an ellipse and lines joining the center of the
  1226.           ellipse to the beginning and end points of the segment.
  1227.  
  1228.           Arguments:
  1229.  
  1230.               fill   Number that indicates whether to fill (fill=1), or just
  1231.                     draw a border (fill=0).
  1232.  
  1233.               x1,y1  Coordinates of upper left corner of bounding rectangle of
  1234.                     the ellipse to which the pie belongs.
  1235.  
  1236.               x2,y2  Coordinates of lower right corner of bounding rectangle of
  1237.                     the ellipse to which the pie belongs.
  1238.  
  1239.               xb,yb  Pie begins at the point where a line drawn from the center
  1240.                     of the bounding rectangle to (xb,yb) cuts the ellipse.
  1241.  
  1242.               xe,ye  Pie ends at the point where a line drawn from the center of
  1243.                     the bounding rectangle to (xe,ye) cuts the ellipse.
  1244.  
  1245.  
  1246.  
  1247.  
  1248.                                          -16-
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1262.  
  1263.  
  1264.  
  1265.           FUNCTION:  g_rect(fill,x1,y1,x2,y2)
  1266.  
  1267.           Purpose: Draw a filled or bordered rectangle that you specify by
  1268.                   the corners.
  1269.  
  1270.           Arguments:
  1271.  
  1272.               fill   0 do not fill, i.e. bordered only
  1273.                     1 fill with the current fillmask.
  1274.  
  1275.               x1,y1  Coordinates of upper left corner.
  1276.  
  1277.               x2,y2  Coordinates of lower right corner.
  1278.  
  1279.  
  1280.  
  1281.           FUNCTION:  g_reg(num)
  1282.  
  1283.           Purpose:  To inhibit the copyright screen that is shown the first time
  1284.                    that g_init() is used.
  1285.  
  1286.           Arguments: Registration number that is supplied when you register.
  1287.  
  1288.           FUNCTION:  g_say(row,col,text)
  1289.  
  1290.           Purpose: Puts text in the screen using the current text color.
  1291.           Similar to the "@row,col say 'TEXT'" command.
  1292.  
  1293.           Arguments:  row,col is the text coordinates (i.e. 80x25)
  1294.                      text  is a string to be output.
  1295.  
  1296.           FUNCTION:  g_selpalt(num)
  1297.  
  1298.           Purpose:  Use this function to activate one of up to four predefined
  1299.                    palettes when using the CGA or the EGA in video mode 4
  1300.                    (320x200 4 color) or video mode 5 (320x200 4 grey).
  1301.  
  1302.           Arguments:  num  is palette number being selected.
  1303.  
  1304.           Returns:    the previous palette number.
  1305.  
  1306.           FUNCTION:  g_setapage(num)
  1307.  
  1308.           Purpose:  Use this function in EGA or VGA graphics modes and in the
  1309.                    text modes to select the current page or portion of display
  1310.  
  1311.  
  1312.  
  1313.  
  1314.                                          -17-
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1328.  
  1329.  
  1330.  
  1331.                    memory where graphics and text operations are performed.
  1332.                    This function only works when the adapter has enough video
  1333.                    memory to support multiple pages.
  1334.  
  1335.           Arguments:  num  is page number to be used for all further text and
  1336.                      graphics operations.
  1337.  
  1338.           Returns:    the previous active page number or a negative value if it
  1339.                      fails.
  1340.  
  1341.           FUNCTION:  g_setbkc(num)
  1342.  
  1343.           Purpose: Selects a new background color
  1344.  
  1345.           Argument: New color value
  1346.  
  1347.           FUNCTION:  g_setclr(num)
  1348.  
  1349.           Purpose: Selects a new color to be used by all future calls to drawing
  1350.                   functions.
  1351.  
  1352.           Argument: New color value
  1353.  
  1354.           FUNCTION:  g_setfmsk(byte,byte,byte,byte,byte,byte,byte,byte)
  1355.  
  1356.           Purpose:  Defines a new pattern that will be used as a fill in func-
  1357.                    tions like g_rect(), g_pie(), and g_ellip().
  1358.  
  1359.           Arguments:  Eight integer from values 0 to 255 (see section Notes in
  1360.                    Fill Pattern).
  1361.  
  1362.           FUNCTION:  g_setline(num)
  1363.  
  1364.           Purpose: Selects a line pattern
  1365.  
  1366.           Argument: Number 0 to 15 where 0 is minimum number of dots to 15 a
  1367.                    solid line.  Numbers larger than 15 will generate a random
  1368.                    pattern.
  1369.  
  1370.           FUNCTION:  g_setorg(x,y)
  1371.  
  1372.           Purpose:  Use to change the origin of the x,y coordinates.  The
  1373.                    default origin is the upper left corner of the screen.
  1374.  
  1375.           Arguments: x,y coordinate for new origin.
  1376.  
  1377.  
  1378.  
  1379.  
  1380.                                          -18-
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1394.  
  1395.  
  1396.  
  1397.           FUNCTION:  g_settxtc(num)
  1398.  
  1399.           Purpose: Selects a new color to be used by all future text output
  1400.                   using the g_say() function.
  1401.  
  1402.           Argument: New color value
  1403.  
  1404.           FUNCTION:  g_setvpage(num)
  1405.  
  1406.           Purpose:  Use this function in EGA or VGA graphics modes and in the
  1407.                    text modes to select the current page or portion of display
  1408.                    memory that is mapped to the screen.  This function only
  1409.                    works when the adapter has enough video memory to support
  1410.                    multiple pages.
  1411.  
  1412.           Arguments:  num  is page number to be displayed.
  1413.  
  1414.           Returns:    the previous visual page number or a negative value if it
  1415.                      fails.
  1416.  
  1417.           FUNCTION:  g_twindow(r1,c1,r2,c2)
  1418.  
  1419.           Purpose:  Defines a window in terms of row and column coordinate for
  1420.                    scrolled text output.  You can define a new background color
  1421.                    for text and clear the text window to give it a different
  1422.                    background color from the rest.  Similar windows for graph-
  1423.                    ics functions can be defined with g_viewport().
  1424.  
  1425.           Arguments: r1,c1 Upper left corner of text window in row and column
  1426.                     coordinate.
  1427.                     r2,c2 Lower right corner of text window in row and column
  1428.                     coordinate.
  1429.  
  1430.           Returns:  logical TRUE or FALSE
  1431.  
  1432.           FUNCTION:  g_viewport(x1,y1,x2,y2)
  1433.  
  1434.           Purpose:  Defines a window for graphics output,  the coordinate
  1435.                    origin is moved to the upper left corner of the viewport.
  1436.  
  1437.           Arguments: x1,y1 Upper left corner of graphics window
  1438.                     x2,y2 Lower right corner of graphics window
  1439.  
  1440.           Returns:  logical TRUE or FALSE
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.                                          -19-
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.      VideoSoft/Video-Comp                                       CLIPGRAF Library
  1460.  
  1461.  
  1462.  
  1463.           FUNCTION:  g_wait()
  1464.  
  1465.           Purpose:  To wait until a character has been typed.  Similar to
  1466.                    Clipper's wait command, but Clipper's command disrupts the
  1467.                    graphics screen when in CGA mode.
  1468.  
  1469.           Returns:  Integer number corresponding to the character pressed.
  1470.  
  1471.           FUNCTION:  g_wraptxt(flag)
  1472.  
  1473.           Purpose:  Allows text to wrap on text window.
  1474.  
  1475.           Arguments:  flag is 0 -> do not wrap, 1 -> do wrap.
  1476.  
  1477.           FUNCTION:  g_xmax()
  1478.  
  1479.           Purpose:  To obtain the maximum number of horizontal pixels in the
  1480.                    current video mode.
  1481.  
  1482.           Returns:  Integer corresponding to the horizontal pixel number.
  1483.  
  1484.           FUNCTION:  g_ymax()
  1485.  
  1486.           Purpose:  To obtain the maximum number of vertical pixels in the
  1487.                    current video mode.
  1488.  
  1489.           Returns:  Integer corresponding to the vertical pixel number.
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.                                          -20-
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.