home *** CD-ROM | disk | FTP | other *** search
/ MS DOS Archives 1 / MS-DOS_Archives_Volume_One_Walnut_Creek.iso / msdos / graphics / hgrph101.arc / HGRAPH.EPS < prev    next >
Text File  |  1989-02-25  |  76KB  |  2,245 lines

  1.  
  2.  
  3.  
  4.                                     HGRAPH.LIB  V1.01                                    HGRAPH.LIB       
  5.  
  6.  
  7.           
  8.           
  9.                HGRAPH.LIB is a collection of subroutines to give Hercules               HGRAPH.LIB                                                
  10.           graphics capability to MSC and QuickC and are better than MSC's &
  11.           QuickC's in that they just have to be linked in.  They do not
  12.           require a driver to be loaded like with MSC & QC.
  13.           
  14.                This is version 1.01 release of these routines.  They have
  15.           been compiled and tested only on a Leading Edge Model "D" which
  16.           has a hercules clone card in it.  The only known difference
  17.           between this clone card and a real Hercules card is that this
  18.           clone fakes the light pen port (if you try to read its lightpen
  19.           port for the graphics state it always returns text mode).
  20.           
  21.           INTRODUCTION          INTRODUCTION
  22.           
  23.                The lib includes clearing and non-clearing subroutines to
  24.           switch between text and graphics modes.  A clear page and show
  25.           page for clearing and switching between the two graphics pages.
  26.           A pixel routine to read, write, and toggle a pixel.  Two line
  27.           subroutines one to draw a line in either white or black and one
  28.           to toggle a line.  And three string writing functions, one that
  29.           treats the graphics screen as 43 rows and 90 columns while the
  30.           other two let you define the upper left corner of where the
  31.           string is to be written.  There are also a save screen and a
  32.           restore screen, similar to BASIC's BSAVE & BLOAD and a print
  33.           screen routine for Epson printers.  All the routines that write
  34.           to the graphics screen are written in MSC MASM 5.1 for greater
  35.           speed.  The screen dump routines do their own buffering also for
  36.           this reason.
  37.           
  38.           
  39.           USAGE          USAGE
  40.           
  41.                There is now a XHGRAPH.LIB library for each memory model,                              XHGRAPH.LIB                                                             _                                         
  42.           where X is the model (S, M, C, L).  So you must link with the                X               S  M  C  L                                             _                                                      
  43.           library of the same type model as the program was compiled with.
  44.           The only restriction in using the libraries is that You must call
  45.           hgraph_init() before using any of the other routines.          hgraph_init()                                        
  46.           
  47.           
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.                                           i
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                     HGRAPH.LIB  V1.01                                    HGRAPH.LIB       
  71.  
  72.  
  73.           
  74.                The rest of the documentation is a list of library routines
  75.           and what they do.  The appendix holds a couple of examples and a
  76.           few programing tips.  The libraries are release into the public
  77.           domain with the following restrictions:
  78.           
  79.                1)   That they only be transmitted from one person to
  80.                     the next in a complete and unmodified form.
  81.                
  82.                2)   That the libraries, documentation, and algorithms
  83.                     remain copy righted to me, Steven P. Murphy.
  84.                
  85.                3)   No warranties are expressed or implied.  I am not
  86.                     responsible for the use, misuse, or abuse of these
  87.                     libraries.
  88.           
  89.           Any comments, suggestions, or bugs should be reported to:
  90.           
  91.                               Steven P. Murphy
  92.                               6581 Bing St.
  93.                               San Diego, CA 92115-6715
  94.           
  95.                               or
  96.           
  97.                               murphys@cod.nosc.mil    (USENET)
  98.           
  99.                And for those you who really like HGRAPH donations will not
  100.           be refused.
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                          ii
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                     HGRAPH.LIB  V1.01                                    HGRAPH.LIB       
  137.  
  138.  
  139.                All the routines treat the graphics screen as a grid of dots
  140.           except hwrite and hstr which treat it as a set of rows and                 ______     ____                                    
  141.           columns.  For all the routines except hwrite and hstr the screen                                                ______     ____           
  142.           dimension are as follows:
  143.           
  144.           
  145.                     0                                              719
  146.                   0  -----------------------------------------------
  147.                     |                                               | 
  148.                     |                                               | 
  149.                     |                                               | 
  150.                     |                                               | 
  151.                     |                                               | 
  152.                     |                                               | 
  153.                     |                                               | 
  154.                     |                                               | 
  155.                     |                                               | 
  156.                     |                                               | 
  157.                     |                                               | 
  158.                     |                                               | 
  159.                  347 -----------------------------------------------
  160.           
  161.           
  162.           for hwrite and hstr the screen is:              ______     ____               
  163.           
  164.                     0                                              89
  165.                   0  -----------------------------------------------
  166.                     |                                               | 
  167.                     |                                               | 
  168.                     |                                               | 
  169.                     |                                               | 
  170.                     |                                               | 
  171.                     |                                               | 
  172.                     |                                               | 
  173.                     |                                               | 
  174.                     |                                               | 
  175.                     |                                               | 
  176.                     |                                               | 
  177.                     |                                               | 
  178.                   42 -----------------------------------------------
  179.           
  180.           
  181.           The conversion from rows & columns to dots is each row is eight
  182.           dots height and each column is eight dots wide.   
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.                                          iii
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                     HGRAPH.LIB  V1.01                                    HGRAPH.LIB       
  203.  
  204.  
  205.                                  TABLE  OF  CONTENTS                                 TABLE  OF  CONTENTS
  206.           
  207.           
  208.           
  209.           h_get_scrn     . . . . . . . . . . . . . . . . . .     1
  210.           h_sav_scrn     . . . . . . . . . . . . . . . . . .     2
  211.           hbox           . . . . . . . . . . . . . . . . . .     3
  212.           hchar          . . . . . . . . . . . . . . . . . .     4
  213.           hchar2         . . . . . . . . . . . . . . . . . .     5
  214.           hclearpg       . . . . . . . . . . . . . . . . . .     6
  215.           hellipse       . . . . . . . . . . . . . . . . . .     7
  216.           herc_there     . . . . . . . . . . . . . . . . . .     8
  217.           hgmode         . . . . . . . . . . . . . . . . . .     9
  218.           hgmode_nc      . . . . . . . . . . . . . . . . . .     10
  219.           hgraph_init    . . . . . . . . . . . . . . . . . .     11
  220.           hline          . . . . . . . . . . . . . . . . . .     12
  221.           hpixel         . . . . . . . . . . . . . . . . . .     13
  222.           hscdump        . . . . . . . . . . . . . . . . . .     14
  223.           hscdump2       . . . . . . . . . . . . . . . . . .     15
  224.           hshowpg        . . . . . . . . . . . . . . . . . .     16
  225.           hstr           . . . . . . . . . . . . . . . . . .     17
  226.           htmode         . . . . . . . . . . . . . . . . . .     18
  227.           htmode_nc      . . . . . . . . . . . . . . . . . .     19
  228.           hwrite         . . . . . . . . . . . . . . . . . .     20
  229.           hxchar         . . . . . . . . . . . . . . . . . .     21
  230.           hxchar2        . . . . . . . . . . . . . . . . . .     22
  231.           hxline         . . . . . . . . . . . . . . . . . .     23
  232.           hxstr          . . . . . . . . . . . . . . . . . .     24
  233.           
  234.           
  235.           Appendix A     . . . . . . . . . . . . . . . . . .     25
  236.                cornucopia.c  . . . . . . . . . . . . . . . .     26
  237.                demo1.c       . . . . . . . . . . . . . . . .     27
  238.           
  239.           Appendix B     . . . . . . . . . . . . . . . . . .     28
  240.                programing ideas  . . . . . . . . . . . . . .     29
  241.           
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                                          iv
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  269.  
  270.  
  271.           H_GET_SCRN          H_GET_SCRN
  272.           
  273.                Summary                       _______        
  274.           
  275.                     #include <hgraph.h>   Contains function prototypes
  276.           
  277.                     int h_get_scrn(file_name);                        h_get_scrn                                               _________  
  278.           
  279.                     char *file_name          /* name of file to get the */                          _________                                       
  280.                                              /* image from              */
  281.           
  282.                Description               ___________
  283.           
  284.                     Opens file_name for reading in binary mode and copies                          _________                                      
  285.                     32K bytes from file_name to graphics page 0 or 1                                   _________                        
  286.                     according to the current value of HGPAGE (see                                                      HGPAGE     
  287.                     hgraph_init).
  288.                     
  289.                     
  290.                Return Value               ____________
  291.           
  292.                     H_get_scrn returns a -1 if it could not successfully                    H_get_scrn                                          
  293.                     open file_name other wise it will return a 0.                         _________                               
  294.                     
  295.                See Also               ________
  296.           
  297.                     h_sav_scrn
  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.  
  325.  
  326.  
  327.  
  328.                                                                         1
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  335.  
  336.  
  337.           H_SAV_SCRN          H_SAV_SCRN
  338.           
  339.                Summary                       _______        
  340.           
  341.                     #include <hgraph.h>   Contains function prototypes
  342.           
  343.                     int h_sav_scrn(file_name);                        h_sav_scrn                                               _________  
  344.           
  345.                     char *file_name          /* name of file to store   */                          _________                                       
  346.                                              /* image in                */
  347.           
  348.                Description               ___________
  349.           
  350.                     Opens file_name for writing in binary mode and copies                          _________                                      
  351.                     32K bytes from graphics page 0 or 1 according to the
  352.                     current value of HGPAGE (see hgraph_init).                                     HGPAGE                   
  353.                     
  354.                     
  355.                Return Value               ____________
  356.           
  357.                     H_sav_scrn returns a -1 if it could not successfully                    H_sav_scrn                                          
  358.                     open file_name other wise it will return a 0.                         _________                               
  359.                     
  360.                See Also               ________
  361.           
  362.                     h_get_scrn
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                                                                         2
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  401.  
  402.  
  403.           HBOX          HBOX
  404.           
  405.                Summary                       _______        
  406.           
  407.                     #include <hgraph.h>   Contains function prototypes
  408.           
  409.                     void hbox(color, trow, lcol, brow, rcol);                         hbox                                                              _____  ____  ____  ____  ____  
  410.           
  411.                     int  color;         /* should only be a 1 or 0    */                         _____                                          
  412.                     int  trow;          /* toprow 0 through 347       */                         ____                                           
  413.                     int  lcol;          /* left column 0 through 718  */                         ____                                           
  414.                     int  brow;          /* bottom row 1 through 348   */                         ____                                           
  415.                     int  rcol;          /* right column 1 through 719 */                            ____                                              
  416.           
  417.                Description               ___________
  418.           
  419.                     Draws a box on page 0 or 1 according to the current
  420.                     value of HGPAGE (see hgraph_init).  Hbox calls hline                             HGPAGE                     Hbox       hline
  421.                     four time arranging the arguments each time so that a
  422.                     box is drawn where (trow, lcol) defines the upper left                                        ____  ____                        
  423.                     corner and (brow, rcol) is the lower right.  Hbox does                                                                 Hbox                                     ____  ____                                
  424.                     no bounds checking so bad ranges will produce weird
  425.                     results.
  426.                     
  427.                     
  428.                Return Value               ____________
  429.           
  430.                     There is no return value.
  431.           
  432.                See Also               ________
  433.           
  434.                     hline
  435.           
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                                                                         3
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  467.  
  468.  
  469.           HCHAR          HCHAR
  470.           
  471.                Summary                       _______        
  472.           
  473.                     #include <hgraph.h>   Contains function prototypes
  474.           
  475.                     void hchar(x, y, string, attrib, count);                         hchar                                                             _  _  ______  ______  _____  
  476.           
  477.                     int  x;             /* 0 through 719             */                         _                                             
  478.                     int  y;             /* 0 through 347             */                         _                                             
  479.                     char *string;       /* ASCII 0 through 127       */                          ______                                       
  480.                     char attrib;        /* HGNORM or HGINVS          */                                           HGNORM    HGINVS                                     ______                                        
  481.                     int  count;         /* number of chars in string */                         _____                                ______   
  482.           
  483.                Description               ___________
  484.           
  485.                     Writes the upper left most corner of the string pointed
  486.                     to by string at the coordinates given after each                          ______                                    
  487.                     character has been XORed with attrib.  Hchar writes to                                                           Hchar                                                            ______                  
  488.                     the graphics page according to the current value of
  489.                     HGPAGE (see hgraph_init).  There is no bounds checking                    HGPAGE                                                
  490.                     done on x and y so numbers outside of range will give                            _     _                                      
  491.                     unknown results (probably not good).  Hchar uses the                                                          Hchar         
  492.                     IBM PC/XT/AT ROM character table.  This table only has
  493.                     ASCII characters 0 through 127, values outside this
  494.                     range will give garbage.  The attrib is xor with the                                                  ______                
  495.                     character's bits on each scan line, values other than
  496.                     HGNORM (normal) and HGINVS (inverse) will just produce                    HGNORM              HGINVS                            
  497.                     odd patterns.  Count tells hchar how many of string's                                               hchar                                                        _____                         ______  
  498.                     characters to plot.  MSC regular run-time LIB has a
  499.                     functions strlen() and gcvt(), strlen() will produce a
  500.                     correct count and gcvt() will convert numbers to a                            _____                                     
  501.                     string.
  502.                     
  503.                Return Value               ____________
  504.           
  505.                     There is no return value.
  506.           
  507.                See Also               ________
  508.           
  509.                     hchar2, hstr, hwrite, hxchar, hxchar2, hxstr
  510.                     MSC's or QuickC's strlen() and gcvt()
  511.           
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                                                                         4
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  533.  
  534.  
  535.           HCHAR2          HCHAR2
  536.           
  537.                Summary                       _______        
  538.           
  539.                     #include <hgraph.h>   Contains function prototypes
  540.           
  541.                     void hchar2(x, y, string, attrib, count);                         hchar2                                                              _  _  ______  ______  _____  
  542.           
  543.                     int  x;             /* 0 through 719             */                         _                                             
  544.                     int  y;             /* 0 through 347             */                         _                                             
  545.                     char *string;       /* ASCII 0 through 127       */                          ______                                       
  546.                     char attrib;        /* HGNORM or HGINVS          */                                           HGNORM    HGINVS                                     ______                                        
  547.                     int  count;         /* number of chars in string */                         _____                                ______   
  548.           
  549.                Description               ___________
  550.           
  551.                     Writes the upper left most corner of the string pointed
  552.                     to by string at the coordinates given after each                          ______                                    
  553.                     character has been XORed with attrib.  Hchar2 writes to                                                           Hchar2                                                            ______                   
  554.                     the graphics page according to the current value of
  555.                     HGPAGE (see hgraph_init).  There is no bounds checking                    HGPAGE                                                
  556.                     done on x and y so numbers outside of range will give                            _     _                                      
  557.                     unknown results (probably not good).  Hchar2's                                                          Hchar2  
  558.                     character table only has ASCII characters 0 through
  559.                     127, values outside this range will give garbage.  The
  560.                     attrib is xor with the character's bits on each scan                    ______                                              
  561.                     line, values other than HGNORM (normal) and HGINVS                                            HGNORM              HGINVS
  562.                     (inverse) will just produce odd patterns.  Count tells                                                               _____      
  563.                     hchar2 how many of string's characters to plot.  MSC                    hchar2                                                                                     ______                           
  564.                     regular run-time LIB has a functions strlen() and
  565.                     gcvt(), strlen() will produce a correct count and                                                            _____    
  566.                     gcvt() will convert numbers to a string.
  567.                     
  568.                Return Value               ____________
  569.           
  570.                     There is no return value.
  571.           
  572.                See Also               ________
  573.           
  574.                     hchar, hstr, hwrite, hxchar, hxchar2, hxstr
  575.                     MSC's or QuickC's strlen() and gcvt()
  576.           
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                                                                         5
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  599.  
  600.  
  601.           HCLEARPG          HCLEARPG
  602.           
  603.                Summary                       _______        
  604.           
  605.                     #include <hgraph.h>   Contains function prototypes
  606.           
  607.                     void hclearpg(void);                         hclearpg       
  608.           
  609.           
  610.                Description               ___________
  611.           
  612.                     Clears graphics page 0 or 1 according to the current
  613.                     value of HGPAGE (see hgraph_init).                             HGPAGE                   
  614.                     
  615.                     
  616.                Return Value               ____________
  617.           
  618.                     There is no return value.
  619.           
  620.                See Also               ________
  621.           
  622.                     hgmode, hgmode_nc
  623.           
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                                                                         6
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  665.  
  666.  
  667.           HELLIPSE          HELLIPSE
  668.           
  669.                Summary                       _______        
  670.           
  671.                     #include <hgraph.h>   Contains function prototypes
  672.           
  673.                     void hellipse(color, x, y, r);                         hellipse                 
  674.           
  675.                Description               ___________
  676.           
  677.                     Draws and ellipse on graphics page 0 or 1 according to
  678.                     the current value of HGPAGE (see hgraph_init) centered                                         HGPAGE                           
  679.                     at (x, y) with a radius of r.  the ellipse will have an                        _  _                   _                           
  680.                     aspect ratio of the current value of (int) HGRATIO.  If                                                               HGRATIO     
  681.                     the ratio is < 2 the major axis will be vertical, if it
  682.                     is > 2  the major axis will be horizontal, and if
  683.                     HGRATIO = 2 hellipse will produces the closes it can to                    HGRATIO     hellipse                                   
  684.                     a circle.  no bounds checking is done if any part of
  685.                     the ellipse is off the screen weird things may happen.
  686.                     
  687.                     
  688.                Return Value               ____________
  689.           
  690.                     There is no return value
  691.           
  692.                See Also               ________
  693.           
  694.                     
  695.           
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                                                                         7
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  731.  
  732.  
  733.           HERC_THERE          HERC_THERE
  734.           
  735.                Summary                       _______        
  736.           
  737.                     #include <hgraph.h>   Contains function prototypes
  738.           
  739.                     int herc_there(void);                        herc_there       
  740.           
  741.                Description               ___________
  742.           
  743.                     First it tests for a mono display adapter, if there is
  744.                     one it then watches port 3BA (hex) for a fixed time to
  745.                     see if bit 7 goes high.  If bit 7 does go high it then
  746.                     pushes a 3 out port 3BF (hex) to turn on the second
  747.                     page of the herc card. Now it checks for memory in the
  748.                     second page.  If this check is good it's a herc other
  749.                     wise it's just a funny mono card. Before it returns it
  750.                     pushes a 0 out port 3BF to return a herc card to
  751.                     diagonal mode.
  752.                     
  753.                Return Value               ____________
  754.           
  755.                     Herc_there returns a one if both of the above test are                    Herc_there                                            
  756.                     true and a zero if either is false.  (I have tested
  757.                     this with my clone card, an EGA, a CGA, and a mono
  758.                     adapter, it worked correctly in all cases.)
  759.           
  760.                See Also               ________
  761.           
  762.                     
  763.           
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.                                                                         8
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  797.  
  798.  
  799.           HGMODE          HGMODE
  800.           
  801.                Summary                       _______        
  802.           
  803.                     #include <hgraph.h>   Contains function prototypes
  804.           
  805.                     void hgmode(void);                         hgmode       
  806.           
  807.                Description               ___________
  808.           
  809.                     Sets graphics mode, clears graphic pages 0 and 1 then
  810.                     switches to graphics page 0.
  811.           
  812.                Return Value               ____________
  813.           
  814.                     There is no return value.
  815.           
  816.                See Also               ________
  817.           
  818.                     hgmode_nc
  819.           
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                                                                         9
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  863.  
  864.  
  865.           HGMODE_NC          HGMODE_NC
  866.           
  867.                Summary                       _______        
  868.           
  869.                     #include <hgraph.h>   Contains function prototypes
  870.           
  871.                     void hgmode_nc(void);                         hgmode_nc       
  872.           
  873.                Description               ___________
  874.           
  875.                     Sets graphics mode, does not clears graphic pages 0 and                                        ________                           
  876.                     1 then switches to graphics page 0.
  877.           
  878.                Return Value               ____________
  879.           
  880.                     There is no return value.
  881.           
  882.                See Also               ________
  883.           
  884.                     hgmode
  885.           
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.                                                                         10
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  929.  
  930.  
  931.           HGRAPH_INIT          HGRAPH_INIT
  932.           
  933.                Summary                       _______        
  934.           
  935.                     #include <hgraph.h>   Contains function prototypes
  936.           
  937.                     void hgraph_init(void);                         hgraph_init       
  938.           
  939.                Description               ___________
  940.           
  941.                     Initializes the necessary global variables for
  942.                     HGRAPH.LIB. These variables are:
  943.           
  944.                     int  HGPAGE;   /* current graphics page, used by all */                         HGPAGE                                                                                                                 ___   
  945.                                    /* the library routines               */
  946.           
  947.                     char HGATRB;   /* character attribute for hwrite     */                         HGATRB                               hwrite       
  948.                          
  949.                     int  HGRATIO;  /* aspect ratio for hellipse          */                         HGRATIO                       hellipse            
  950.                               
  951.                     The initial values for are HGPAGE = 1, HGATRB = 0x00,                                               HGPAGE      HGATRB        
  952.                     and HGRATIO = 2.  HGPAGE should only be 1 or 0 if it is                        HGRATIO       HGPAGE                               
  953.                     set to some value other than these two all the routine
  954.                     will default it to 1.  HGATRB should only be HGNORM or                                           HGATRB                HGNORM   
  955.                     HGINVS (defined in hgraph.h) other values will just                    HGINVS                                             
  956.                     cause the print to look funny.  HGRATIO should be a                                                    HGRATIO            
  957.                     positive int, 0 will cause it to draw a horizontal
  958.                     line, and a negative will hellipse to crash.
  959.                     
  960.           
  961.                Return Value               ____________
  962.           
  963.                     There is no return value.
  964.           
  965.                See Also               ________
  966.           
  967.           
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                                                                         11
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  995.  
  996.  
  997.           HLINE          HLINE
  998.           
  999.                Summary                       _______        
  1000.           
  1001.                     #include <hgraph.h>   Contains function prototypes
  1002.           
  1003.                     void hline(function, x0, y0, x1, y1);                         hline                                                          ________  __  __  __  __  
  1004.           
  1005.                     int function;       /* 0 - write pixels in black */                        ________                                       
  1006.                                         /* 1 - write pixels in white */    
  1007.                     int x0;             /* 0 through 719             */                        __                                             
  1008.                     int y0;             /* 0 through 347             */                        __                                             
  1009.                     int x1;             /* 0 through 719             */                        __                                             
  1010.                     int y1;             /* 0 through 347             */                        __                                             
  1011.           
  1012.                Description               ___________
  1013.           
  1014.                     The default for function is 1, so if hline is called                                                         hline                                              ________                            
  1015.                     with function not equal to those listed you get                         ________                                  
  1016.                     function 1.  The graphics page is set according to the                    ________                                              
  1017.                     current value of HGPAGE (see hgraph_init).  There is no                                     HGPAGE                                
  1018.                     bounds checking done on x0, x1, y0, or y1 so numbers                                            __  __  __     __           
  1019.                     outside of range will give unknown results (probably
  1020.                     not good).
  1021.                     
  1022.                Return Value               ____________
  1023.           
  1024.                     There is no return value.
  1025.           
  1026.                See Also               ________
  1027.           
  1028.                     hxline
  1029.           
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.                                                                         12
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1061.  
  1062.  
  1063.           HPIXEL          HPIXEL
  1064.           
  1065.                Summary                       _______        
  1066.           
  1067.                     #include <hgraph.h>   Contains function prototypes
  1068.           
  1069.                     void hpixel(function, x, y);                         hpixel                                                 ________  _  _  
  1070.           
  1071.                     int function;       /*  0 - write pixel in black  */                        ________                                        
  1072.                                         /*  1 - write pixel in white  */   
  1073.                                         /*  2 - toggle pixel          */
  1074.                                         /*  3 - read pixel            */
  1075.                     int x;              /*  0 through 719             */                        _                                               
  1076.                     int y;              /*  0 through 347             */                        _                                               
  1077.           
  1078.                Description               ___________
  1079.           
  1080.                     The default for function is 2, so if hpixel is called                                                         hpixel                                              ________                             
  1081.                     with function not equal to those listed you get                         ________                                  
  1082.                     function 2.  The pixel is plotted on the graphics page                    ________                                              
  1083.                     according to the current value of HGPAGE (see                                                      HGPAGE     
  1084.                     hgraph_init).  There is no bounds checking done on x                                                                       _
  1085.                     and y so numbers outside of range will give unknown                        _                                              
  1086.                     results (probably not good).
  1087.                     
  1088.                     
  1089.                Return Value               ____________
  1090.           
  1091.                     The return value is the status the pixel was set to by
  1092.                     any of the four functions.  So hpixel while always                                                   hpixel                                                 ________                          
  1093.                     return a 0 (for black) or a 1 (for white).
  1094.           
  1095.                See Also               ________
  1096.           
  1097.           
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                                                                         13
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1127.  
  1128.  
  1129.           HSCDUMP          HSCDUMP
  1130.           
  1131.                Summary                       _______        
  1132.           
  1133.                     #include <hgraph.h>   Contains function prototypes
  1134.           
  1135.                     void hscdump(void);                         hscdump       
  1136.           
  1137.           
  1138.                Description               ___________
  1139.           
  1140.                     Dumps graphics page 0 or 1, according to the current
  1141.                     value of HGPAGE (see hgraph_init), to an Epson or                             HGPAGE                                  
  1142.                     compatible printer.  Each line is double struck to
  1143.                     improve the clarity.
  1144.                     
  1145.                Return Value               ____________
  1146.           
  1147.                     There is no return value.
  1148.           
  1149.                See Also               ________
  1150.           
  1151.                     hscdump2
  1152.           
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                                                                         14
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1193.  
  1194.  
  1195.           HSCDUMP2          HSCDUMP2
  1196.           
  1197.                Summary                       _______        
  1198.           
  1199.                     #include <hgraph.h>   Contains function prototypes
  1200.           
  1201.                     void hscdump2(void);                         hscdump2       
  1202.           
  1203.           
  1204.                Description               ___________
  1205.           
  1206.                     Dumps graphics page 0 or 1, according to the current
  1207.                     value of HGPAGE (see hgraph_init), to an Epson or                             HGPAGE                                  
  1208.                     compatible printer.  Each line is only single struck to
  1209.                     improve the speed.
  1210.                     
  1211.                Return Value               ____________
  1212.           
  1213.                     There is no return value.
  1214.           
  1215.                See Also               ________
  1216.           
  1217.                     hscdump
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                                                                         15
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1259.  
  1260.  
  1261.           HSHOWPG          HSHOWPG
  1262.           
  1263.                Summary                       _______        
  1264.           
  1265.                     #include <hgraph.h>   Contains function prototypes
  1266.           
  1267.                     void hshowpg(void);                         hshowpg       
  1268.           
  1269.           
  1270.                Description               ___________
  1271.           
  1272.                     Set graphics page 0 or 1, according to the current
  1273.                     value of HGPAGE (see hgraph_init),  to the currently                             HGPAGE                                     
  1274.                     displayed page.
  1275.                     
  1276.                     
  1277.                Return Value               ____________
  1278.           
  1279.                     There is no return value.
  1280.           
  1281.                See Also               ________
  1282.           
  1283.                     hgmode, hgmode_nc
  1284.           
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                                                                         16
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1325.  
  1326.  
  1327.           HSTR          HSTR
  1328.           
  1329.                Summary                       _______        
  1330.           
  1331.                     #include <hgraph.h>   Contains function prototypes
  1332.           
  1333.                     void hstr(column, row, string, attrib, count);                         hstr                                                                   ______  ___  ______  ______  _____  
  1334.           
  1335.                     int  column;        /* 0 through 89              */                         ______                                        
  1336.                     int  row;           /* 0 through 42              */                         ___                                           
  1337.                     char *string;       /* pointer to the string     */                          ______                                       
  1338.                     char attrib;        /* HGNORM or HGINVS          */                                           HGNORM    HGINVS                                     ______                                        
  1339.                     int  count;         /* number of chars in string */                         _____                                ______   
  1340.           
  1341.                Description               ___________
  1342.           
  1343.                     Writes the string pointed to by string at the row and                                                    ______        ___    
  1344.                     column given after each character has been XORed with                    ______                                               
  1345.                     attrib.  The graphics page written to is set according                    ______                                                
  1346.                     to the current value of HGPAGE (see hgraph_init).                                            HGPAGE                   
  1347.                     There is no bounds checking done on column and row so                                                        ______     ___   
  1348.                     numbers outside of range will give unknown results
  1349.                     (probably not good).  Hstr's character table only has                                          Hstr                           
  1350.                     ASCII characters 0 through 127, values outside this
  1351.                     range will give garbage.  The attrib is xor with the                                                  ______                
  1352.                     character's bits on each scan line, values other than
  1353.                     HGNORM (normal) and HGINVS (inverse) will just produce                    HGNORM              HGINVS                            
  1354.                     odd patterns.  Count tells hstr how many of string's                                               hstr                                                        _____                        ______  
  1355.                     characters to plot.  MSC regular run-time LIB has a
  1356.                     functions strlen() and gcvt(), strlen() will produce a
  1357.                     correct count and gcvt() will convert numbers to a                            _____                                     
  1358.                     string so they can be printed.
  1359.                     
  1360.                Return Value               ____________
  1361.           
  1362.                     There is no return value.
  1363.           
  1364.                See Also               ________
  1365.           
  1366.                     hchar, hchar2, hwrite, hxchar, hxchar2, hxstr
  1367.                     MSC's or QuickC's strlen() and gcvt()
  1368.           
  1369.                Note:               _____
  1370.           
  1371.                     This is the fastest of hstr, hchar, and hchar2 for
  1372.                     writing strings because it operates on byte boundaries.
  1373.                     Only if you really need to write at a particular pixel
  1374.                     location should hchar or hchar2 be used and of these
  1375.                     two hchar2 is the better (only because its character
  1376.                     table is internal, the same as hstr, so it is
  1377.                     guaranteed to work on all machines).
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                                                                         17
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1391.  
  1392.  
  1393.           HTMODE          HTMODE
  1394.           
  1395.                Summary                       _______        
  1396.           
  1397.                     #include <hgraph.h>   Contains function prototypes
  1398.           
  1399.                     void htmode(void);                         htmode       
  1400.           
  1401.                Description               ___________
  1402.           
  1403.                     Sets text mode, clears graphic pages 0 and 1 then
  1404.                     switches to text page.
  1405.           
  1406.                Return Value               ____________
  1407.           
  1408.                     There is no return value.
  1409.           
  1410.                See Also               ________
  1411.           
  1412.                     htmode_nc
  1413.           
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.                                                                         18
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1457.  
  1458.  
  1459.           HTMODE_NC          HTMODE_NC
  1460.           
  1461.                Summary                       _______        
  1462.           
  1463.                     #include <hgraph.h>   Contains function prototypes
  1464.           
  1465.                     void htmode_nc(void);                         htmode_nc       
  1466.           
  1467.                Description               ___________
  1468.           
  1469.                     Sets text mode, does not clears graphic pages 0 and 1                                    ________                             
  1470.                     then switches to text page.
  1471.           
  1472.                Return Value               ____________
  1473.           
  1474.                     There is no return value.
  1475.           
  1476.                See Also               ________
  1477.           
  1478.                     htmode
  1479.           
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                                                                         19
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1523.  
  1524.  
  1525.           HWRITE          HWRITE
  1526.           
  1527.                Summary                       _______        
  1528.           
  1529.                     #include <hgraph.h>   Contains function prototypes
  1530.           
  1531.                     int hwrite(row, col, string);                        hwrite                                                  ___  ___  ______  
  1532.           
  1533.                     int row;            /* 0 through 42           */                        ___                                         
  1534.                     int col;            /* 0 through 89           */                        ___                                         
  1535.                     char *string;       /* pointer to the string  */                          ______                                    
  1536.           
  1537.                Description               ___________
  1538.           
  1539.                     Write string starting at (row, col) using the attribute                          ______              ___  ___                     
  1540.                     value of HGATRB (see hgraph_init).  The string is                             HGATRB                                  
  1541.                     written to the graphics page set according to the
  1542.                     current value of HGPAGE (see hgraph_init).  Hwrite                                     HGPAGE                     Hwrite
  1543.                     checks for bounds on both row and col, if the start of                                              ___     ___                 
  1544.                     the string is not on the screen the string will not be
  1545.                     written.  If the string runs off the right edge it will
  1546.                     just be truncated to avoid errors.  MSC regular run-
  1547.                     time LIB has a function gcvt() which will convert
  1548.                     numbers to a string so they can be printed.
  1549.                     
  1550.                     
  1551.                Return Value               ____________
  1552.           
  1553.                     Hwrite will return a 1 if it wrote any thing on the                    Hwrite                                             
  1554.                     screen (truncated or not) or a 0 if (row, col) was off                                                         ___  ___         
  1555.                     the screen (nothing written).
  1556.           
  1557.                See Also               ________
  1558.           
  1559.                     hchar, hchar2, hstr, hxchar, hxchar2, hxstr
  1560.                     MSC's or QuickC's  gcvt()
  1561.           
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.                                                                         20
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1589.  
  1590.  
  1591.           HXCHAR          HXCHAR
  1592.           
  1593.                Summary                       _______        
  1594.           
  1595.                     #include <hgraph.h>   Contains function prototypes
  1596.           
  1597.                     void hxchar(x, y, string, attrib, count);                         hxchar                                                              _  _  ______  ______  _____  
  1598.           
  1599.                     int  x;             /* 0 through 719             */                         _                                             
  1600.                     int  y;             /* 0 through 347             */                         _                                             
  1601.                     char *string;       /* ASCII 0 through 127       */                          ______                                       
  1602.                     char attrib;        /* HGNORM or HGINVS          */                                           HGNORM    HGINVS                                     ______                                        
  1603.                     int  count;         /* number of chars in string */                         _____                                ______   
  1604.           
  1605.                Description               ___________
  1606.           
  1607.                     XORs string starting at the upper left most corner of                         ______                                          
  1608.                     the string pointed to by string at the coordinates                                             ______                   
  1609.                     given after each character has been XORed with attrib.                                                                   ______ 
  1610.                     Hxchar writes to the graphics page set by the current                    Hxchar                                               
  1611.                     value of HGPAGE (see hgraph_init).  There is no bounds                             HGPAGE                                       
  1612.                     checking done on x and y so numbers outside of range                                     _     _                            
  1613.                     will give unknown results (probably not good).  Hxchar                                                                    Hxchar
  1614.                     uses the IBM PC/XT/AT ROM character table.  This table
  1615.                     only has ASCII characters 0 through 127, values outside
  1616.                     this range will give garbage.  The attrib is xor with                                                       ______            
  1617.                     the character's bits before it is xored to the screen,
  1618.                     values other than HGNORM (normal) and HGINVS (inverse)                                      HGNORM              HGINVS          
  1619.                     for attrib will just produce odd patterns.  Count tells                        ______                                  _____      
  1620.                     hchar how many of string's characters to plot.  MSC                    hchar                                                                                    ______                           
  1621.                     regular run-time LIB has a functions strlen() and
  1622.                     gcvt(), strlen() will produce a correct count and                                                            _____    
  1623.                     gcvt() will convert numbers to a string.
  1624.                     
  1625.                Return Value               ____________
  1626.           
  1627.                     There is no return value.
  1628.           
  1629.                See Also               ________
  1630.           
  1631.                     hchar, hchar2, hstr, hwrite, hxchar2, hxstr
  1632.                     MSC's or QuickC's strlen() and gcvt()
  1633.           
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                                                                         21
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1655.  
  1656.  
  1657.           HXCHAR2          HXCHAR2
  1658.           
  1659.                Summary                       _______        
  1660.           
  1661.                     #include <hgraph.h>   Contains function prototypes
  1662.           
  1663.                     void hxchar2(x, y, string, attrib, count);                         hxchar2                                                               _  _  ______  ______  _____  
  1664.           
  1665.                     int  x;             /* 0 through 719             */                         _                                             
  1666.                     int  y;             /* 0 through 347             */                         _                                             
  1667.                     char *string;       /* ASCII 0 through 127       */                          ______                                       
  1668.                     char attrib;        /* HGNORM  or HGINVS         */                                           HGNORM     HGINVS                                    ______                                        
  1669.                     int  count;         /* number of chars in string */                         _____                                ______   
  1670.           
  1671.                Description               ___________
  1672.           
  1673.                     XORs string starting at the upper left most corner of                         ______                                          
  1674.                     the string pointed to by string at the coordinates                                             ______                   
  1675.                     given after each character has been XORed with attrib.                                                                   ______ 
  1676.                     Hxchar2 writes to the graphics page according to the                    Hxchar2                                             
  1677.                     current value of HGPAGE (see hgraph_init).  There is no                                     HGPAGE                                
  1678.                     bounds checking done on x and y so numbers outside of                                            _     _                      
  1679.                     range will give unknown results (probably not good).
  1680.                     Hxchar2's character table only has ASCII characters 0                    Hxchar2                                              
  1681.                     through 127, values outside this range will give
  1682.                     garbage.  The attrib is xor with the character's bits                                  ______                                 
  1683.                     before it is xored to the screen, values other than
  1684.                     HGNORM (normal) and HGINVS (inverse) for attrib will                    HGNORM              HGINVS                                                                                       ______     
  1685.                     just produce odd patterns.  Count tells hxchar2 how                                                            hxchar2                                                    _____                  
  1686.                     many of string's characters to plot.  MSC regular run-                            ______                                        
  1687.                     time LIB has a functions strlen() and gcvt(), strlen()
  1688.                     will produce a correct count and gcvt() will convert                                           _____                        
  1689.                     numbers to a string.
  1690.                     
  1691.                Return Value               ____________
  1692.           
  1693.                     There is no return value.
  1694.           
  1695.                See Also               ________
  1696.           
  1697.                     hchar, hchar2, hstr, hwrite, hxchar, hxstr
  1698.                     MSC's or QuickC's strlen() and gcvt()
  1699.           
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.                                                                         22
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1721.  
  1722.  
  1723.           HXLINE          HXLINE
  1724.           
  1725.                Summary                       _______        
  1726.           
  1727.                     #include <hgraph.h>   Contains function prototypes
  1728.           
  1729.                     void hxline(x0, y0, x1, y1);                         hxline                                                 __  __  __  __  
  1730.           
  1731.                     int x0;             /* 0 through 719  */                        __                                  
  1732.                     int y0;             /* 0 through 347  */                        __                                  
  1733.                     int x1;             /* 0 through 719  */                        __                                  
  1734.                     int y1;             /* 0 through 347  */                        __                                  
  1735.           
  1736.                Description               ___________
  1737.           
  1738.                     Toggles the status of all the pixels along the given
  1739.                     line.  The graphics page is set according to the
  1740.                     current value of HGPAGE (see hgraph_init).  There is no                                     HGPAGE                                
  1741.                     bounds checking done on x0, x1, y0, or y1 so numbers                                            __  __  __     __           
  1742.                     outside of range will give unknown results (probably
  1743.                     not good).
  1744.                     
  1745.                     
  1746.                Return Value               ____________
  1747.           
  1748.                     There is no return value.
  1749.           
  1750.                See Also               ________
  1751.           
  1752.                     hline
  1753.           
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.                                                                         23
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1787.  
  1788.  
  1789.           HXSTR          HXSTR
  1790.           
  1791.                Summary                       _______        
  1792.           
  1793.                     #include <hgraph.h>   Contains function prototypes
  1794.           
  1795.                     void hxstr(column, row, string, attrib, count);                         hxstr                                                                    ______  ___  ______  ______  _____  
  1796.           
  1797.                     int  column;        /* 0 through 89              */                         ______                                        
  1798.                     int  row;           /* 0 through 42              */                         ___                                           
  1799.                     char *string;       /* pointer to the string     */                          ______                                       
  1800.                     char attrib;        /* HGNORM or HGINVS          */                                           HGNORM    HGINVS                                     ______                                        
  1801.                     int  count;         /* number of chars in string */                         _____                                ______   
  1802.           
  1803.                Description               ___________
  1804.           
  1805.                     XORs the string pointed to by string at the row and                                                  ______        ___    
  1806.                     column given after each character has been XORed with                    ______                                               
  1807.                     attrib.  The graphics page written to is set according                    ______                                                
  1808.                     to the current value of HGPAGE (see hgraph_init).                                            HGPAGE                   
  1809.                     There is no bounds checking done on column and row so                                                        ______     ___   
  1810.                     numbers outside of range will give unknown results
  1811.                     (probably not good).  Hstr's character table only has                                          Hstr                           
  1812.                     ASCII characters 0 through 127, values outside this
  1813.                     range will give garbage.  The attrib is xor with the                                                  ______                
  1814.                     character's bits before it is xored to the screen,
  1815.                     values other than HGNORM (normal) and HGINVS (inverse)                                      HGNORM              HGINVS          
  1816.                     will just produce odd patterns.  Count tells hstr how                                                                 hstr                                                         _____               
  1817.                     many of string's characters to plot.  MSC regular run-                            ______                                        
  1818.                     time LIB has a functions strlen() and gcvt(), strlen()
  1819.                     will produce a correct count and gcvt() will convert                                           _____                        
  1820.                     numbers to a string so they can be printed.
  1821.                     
  1822.                Return Value               ____________
  1823.           
  1824.                     There is no return value.
  1825.           
  1826.                See Also               ________
  1827.           
  1828.                     hchar, hchar2, hstr, hwrite, hxchar, hxchar2
  1829.                     MSC's or QuickC's strlen() and gcvt()
  1830.           
  1831.                Note:               _____
  1832.           
  1833.                     This is the fastest of hxstr, hxchar, and hxchar2 for
  1834.                     writing strings because it operates on byte boundaries.
  1835.                     Only if you really need to write at a particular pixel
  1836.                     location should hxchar or hxchar2 be used and of these
  1837.                     two hxchar2 is the better (only because its character
  1838.                     table is internal, the same as hxstr, so it is
  1839.                     guaranteed to work on all machines).
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                                                                         24
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1853.  
  1854.  
  1855.           
  1856.           
  1857.           
  1858.           
  1859.           
  1860.           
  1861.           
  1862.           
  1863.           
  1864.           
  1865.           
  1866.           
  1867.           
  1868.           
  1869.           
  1870.                                      Appendix  A                                     Appendix  A
  1871.                                           
  1872.                                      (examples)
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.                                                                         25
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1919.  
  1920.  
  1921.           
  1922.           /* CORNUCOPIA -- see article on "pseudo-hidden line removal" */
  1923.           /* IBM-PC Exchange, May-June 1986 */
  1924.           
  1925.           #include <math.h>
  1926.           #include <conio.h>
  1927.           #include <hgraph.h>
  1928.           
  1929.           main()
  1930.           {
  1931.           
  1932.                int d, a0, b0, a1, b1, a, b;
  1933.                double r, rada, radb;
  1934.           
  1935.                hgraph_init();
  1936.                hgmode_nc();
  1937.                hclearpg();
  1938.                hshowpg();
  1939.                hstr(40, 1, " CORNUCOPIA ", 0xff, 12);
  1940.                for (d = 1; d <= 100; ++d)
  1941.                {
  1942.                      rada = (float)d;
  1943.                      radb = 0.65 * rada;
  1944.                      a0 = 20 + 4 * d;
  1945.                      b0 = 20 + 2 * d + (int)(radb * 0.6 * sin(d/10.0));
  1946.                      hline(0, a0, b0, a1 = a0, b1 = b0 + (int)radb);
  1947.                      for (r = 0.0; r < 6.3; r += 6.28/40.0)
  1948.                      {
  1949.                            a = a0 + (int)(rada * sin(r));
  1950.                            b = b0 + (int)(radb * cos(r));
  1951.                            hline(1, a1, b1, a, b);
  1952.                            hline(0, a0, b0, a1 = a, b1 = b);
  1953.                       }
  1954.                }
  1955.           
  1956.                /*  This next section flips back and forth from
  1957.                 *  text to graphics three time to show the use of the
  1958.                 *  non-clearing hgmode_nc & htmode_nc the user must hit a
  1959.                 *  key to cause the flip
  1960.                 */
  1961.           
  1962.                hstr(10, 40, "Press any key to continue ... ", 0x00, 30);
  1963.                   getch();
  1964.                htmode_nc();
  1965.                   puts("Press any key to continue ... ");
  1966.                   getch();
  1967.                hgmode_nc(); hshowpg();
  1968.                   getch();
  1969.                htmode_nc();
  1970.                   getch();
  1971.                hgmode_nc(); hshowpg();
  1972.                   getch();
  1973.                htmode();            /* this will clear the text screen */
  1974.           }
  1975.  
  1976.  
  1977.  
  1978.                                                                         26
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  1985.  
  1986.  
  1987.           
  1988.           
  1989.           /* DEMO.C - a demo of hgraph.lib's string writing routines */
  1990.           
  1991.           #include <string.h>
  1992.           #include <conio.h>
  1993.           #include <hgraph.h>
  1994.           
  1995.           char string[40] = "HGRAPH.LIB";
  1996.           
  1997.           main()
  1998.           {
  1999.           int ct;
  2000.           char c;
  2001.           
  2002.                   ct = strlen(string);
  2003.                   hgraph_init();
  2004.                   hgmode_nc();
  2005.                   hclearpg();
  2006.                   hshowpg();
  2007.           
  2008.           
  2009.               hstr(40, 1, string, HGINVS, ct);
  2010.               hstr(20, 10,
  2011.                "This is a demo of hstr, hchar, and hchar2", HGNORM, 41);
  2012.               hstr(10, 20,
  2013.                "This is a sample of hstr with normal attrib", HGNORM,43);
  2014.               hstr(10, 21,
  2015.                "This is a sample of hstr with inverse attrib", HGINVS,44);
  2016.               hchar(80, 200,
  2017.                "This is a sample of hchar with normal attrib", HGNORM,44);
  2018.               hchar(80, 209,
  2019.                "This is a sample of hchar with inverse attrib",HGINVS,45);
  2020.               hchar2(80, 240,
  2021.                "This is a sample of hchar2 with normal attrib",HGNORM,45);
  2022.               hchar2(80, 249,
  2023.                "This is a sample of hchar2 with inverse attrib",HGINVS,46);
  2024.           
  2025.           
  2026.                hstr(10, 40,
  2027.                     "Press any key to continue ...", HGNORM, 29);
  2028.                    getch();
  2029.                htmode_nc();
  2030.           }
  2031.           
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.                                                                         27
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  2051.  
  2052.  
  2053.           
  2054.           
  2055.           
  2056.           
  2057.           
  2058.           
  2059.           
  2060.           
  2061.           
  2062.           
  2063.           
  2064.           
  2065.           
  2066.           
  2067.           
  2068.                                      Appendix  B                                     Appendix  B
  2069.                                           
  2070.                                  (programing ideas)
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.                                                                         28
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  2117.  
  2118.  
  2119.           
  2120.                There are three ways to do screen swapping with these
  2121.           libraries to make it appear that you have a a full screen type
  2122.           window package.  I will start with the easiest and work up to
  2123.           what I would consider the best.  There is one thing to keep in
  2124.           mind, the text screen uses the same memory as the first half of
  2125.           graphics page 0.  This fact must be consider when using
  2126.           hgmode_nc() and htmode_nc() because if you have written stuff to
  2127.           the text screen and then go to graphics page 0 there will be
  2128.           garbage on the top half of the monitor.  The same is true if you
  2129.           do graphics on page 0 and switch to text with out clearing there
  2130.           will be trash all over the text screen.
  2131.           
  2132.           
  2133.           
  2134.                1)   If you do all your graphics on page 1 (the
  2135.                     default) you could use C's standard functions (i.e
  2136.                     printf, puts, ...) to write to the text screen
  2137.                     (you don't have to leave graphics mode to do
  2138.                     this).  This way you could have graphics displayed
  2139.                     and a help screen written to the text screen so if
  2140.                     the user hit F1 you could call htmode_nc() and the
  2141.                     help screen would appear, and then another key
  2142.                     would call hgmode_nc() and the graphics would
  2143.                     reappear.  The only problem with this is a half to
  2144.                     three quarters of a second delay built into both
  2145.                     htmode_nc() and hgmode_nc() this will cause
  2146.                     approximately a one second delay in switching form
  2147.                     one screen to another.
  2148.                
  2149.                
  2150.                2)   There are two undocumented routines in hgraph.lib.
  2151.                
  2152.                     void h_scrn_in( unsigned char *)
  2153.                     void h_scrn_out( unsigned char *)
  2154.                
  2155.                          where unsigned char * is a pointer to a
  2156.                     buffer of at least 32768 bytes.
  2157.                
  2158.                     The first, h_scrn_in reads the screen defined by
  2159.                     HGPAGE and stores it into the buffer it was passed                    HGPAGE                                            
  2160.                     as an argument.  The second, h_scrn_out copies the
  2161.                     first 32767 bytes from the buffer it was passed as
  2162.                     an argument to the screen defined by HGPAGE.  So                                                         HGPAGE     
  2163.                     in the middle of doing graphics the user hits a
  2164.                     key for help, the program would use h_scrn_in to
  2165.                     save a copy of the current screen.  Then it would
  2166.                     call hclearpg followed by hwrite to display help
  2167.                     messages.  When the user wanted to switch back
  2168.                     just call h_scrn_out and rewrite the image back.
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.                                                                         29
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                                   HGRAPH.LIB  V1.01                                  HGRAPH.LIB       
  2183.  
  2184.  
  2185.                
  2186.                
  2187.                3)   What I feel is the best is to use one graphics
  2188.                     page for graphics and one graphics page for help.
  2189.                     All that would have to be done is to reset HGPAGE                                                               HGPAGE
  2190.                     and then call hshowpg to swap between the two.
  2191.                     The code in the library to figure out which page
  2192.                     and to set it is only ten lines in assembly.
  2193.                
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.                                                                         30
  2243.  
  2244.  
  2245.