home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / msdos / graphics / hsa_tc.arc / HSA_GRAF.DOC < prev    next >
Text File  |  1987-09-10  |  47KB  |  1,387 lines

  1.  
  2.  
  3.      Hardwood Software Associates
  4.      
  5.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  6.      
  7.      
  8.      
  9.      
  10.      
  11.      
  12.      
  13.      
  14.      
  15.      
  16.      
  17.      
  18.      
  19.      
  20.                                   H S A _ G R A F                                  H S A _ G R A F
  21.                          Multi-Adapter Graphics Library for C
  22.      
  23.                                          by
  24.      
  25.                             Hardwood Software Associates
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  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.      10-Sep-87                                                          Page 1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.      Hardwood Software Associates
  70.      
  71.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  72.      
  73.      
  74.                             Hardwood Software Associates                            ____________________________
  75.      
  76.      HSA_GRAF is copyrighted by Hardwood Software Associates.  You are granted
  77.      a limited license to use HSA_GRAF. You may also copy and distribute it,
  78.      provided that the following conditions are met:
  79.      
  80.           1. No fee may be charged for such copying and distribution.
  81.           2. HSA_GRAF may ONLY be distributed in its original, unmodified state.
  82.      
  83.      Any voluntary contributions for the use of this program will be
  84.      appreciated, and should be sent to:
  85.      
  86.                      Hardwood Software Associates
  87.                      364 Benson Road
  88.                      Northbridge, Ma 01534
  89.      
  90.      A contribution of at least $15 will require that you accept a floppy disk
  91.      containing the source code for HSA_GRAF. Remember only you can support
  92.      shareware.  Your support encourages growth.  If you use it you should
  93.      support it.
  94.      
  95.      The author, Richard "Spike" Evans may be reached on CompuServe at
  96.      [75026,3604].
  97.      
  98.      All comments and suggestions are welcome.  We love to get mail.
  99.      
  100.      Please be advised that all the usual non-warranty warranties apply to
  101.      HSA_GRAF.  Hardwood Software Associates does not guarantee that HSA_GRAF
  102.      will do any thing useful  at all;  although it has for us.  Nor does
  103.      Hardwood Software Associates warrant that HSA_GRAF will not do anything
  104.      harmful; although it has not for us.
  105.      
  106.      
  107.                                      Trademarks                                     __________
  108.      
  109.      
  110.            Hercules Graphics Crad is a trademark of Hercules Computer Technology
  111.            IBM P.C. is a trademark of International Business Machines
  112.            Lattice is a trademark of Lattice, Inc.
  113.            Microsoft C is a trademark of Microsoft Corporation
  114.            Turbo C is a trademark of Borland International
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.      
  126.      10-Sep-87                                                          Page 2
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.      Hardwood Software Associates
  136.      
  137.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  138.      
  139.      
  140.                                        INTRODUCTION                                       ____________
  141.      
  142.      HSA_GRAF is a library of C functions that provide direct, fast ability to
  143.      create graphics on any one of the three major graphics boards available
  144.      for the IBM P.C. (Color Graphics Adapter (CGA), Enhanced Graphics Adapter
  145.      (EGA), and the Hercules Graphics Board).  A single setup call establishes
  146.      the board in use, all functions used to create the actual graphics are
  147.      device independent. The functions have been developed and  tested  for
  148.      the  Microsoft  versions  3.00  and 4.00, Turbo C version 1.00, and
  149.      Lattice version 3.10 compilers.  This library has two divisions.  All
  150.      basic graphics functions begin with the prefix "gr_".  The other
  151.      division, prefixed with "gs_" allows for creating scaled graphics. These
  152.      modules are:
  153.      
  154.              GR_STAT  - Status functions
  155.              GR_STR   - String display functions
  156.              GR_FILL  - Area fill functions
  157.              GR_MISC  - Miscellaneous functions
  158.              GR_ATTR  - Functions to control screen attributes
  159.              GR_DRAW  - Functions to draw points and lines
  160.              GR_SCALE - Function to perform screen scaling
  161.              GR_ARC   - Functions to draw arcs and circles
  162.              GR_EGA   - EGA support functions
  163.              GR_HERC  - Hercules support functions
  164.              GR_GETS  - Graphics get a string function
  165.      
  166.      
  167.      This distribution contains two object library files:
  168.      
  169.              S_MS_HSA.LIB - Small memory model library (Microsoft)
  170.              S_LC_HSA.LIB - Small memory model library (Lattice)
  171.              S_TC_HSA.LIB - Small memory model library (Turbo)
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.      
  192.      10-Sep-87                                                          Page 3
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.      Hardwood Software Associates
  202.      
  203.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  204.      
  205.      
  206.                                          GENERAL                                         _______
  207.      
  208.      The "gr" functions are a set of low level functions that get you fast
  209.      efficient control of the text screen.  These functions keep track of two
  210.      next sequential screen locations (x and  y); one for lines and points,
  211.      the other for string display. These locations are referred  to as the
  212.      current location.
  213.      
  214.      The X axis is the horizontal axis, with 0 at the left, positive direction
  215.      to the right.  The Y axis is the vertical axis with 0 optionally at the
  216.      top or the bottom, positive direction down or up. The X and Y coordinates
  217.      passed to all functions are 0 based. If the X or Y coordinate passed to
  218.      any function is equal to -1 the current X or Y location coordinate is
  219.      used.
  220.      
  221.      The header file hsa_gr.h defines all functions included in the HSA_GRAF
  222.      function  library.  Also  included  in  hsa_gr.h  are several useful
  223.      constants, macros, and structures.
  224.      
  225.      The current implementation supports the following graphics modes:
  226.               Hercules Monochrome  (720x348)
  227.               CGA - two color      (640x200)
  228.               EGA - 16 color       (640x350)
  229.               AT&T - two color     (640x400)
  230.      
  231.      Refer to MSC_GR.BAT, TCC_GR.BAT and LC_GR.BAT for information on how to
  232.      compile and link for the Microsoft and Lattice compilers.
  233.      
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.      
  258.      10-Sep-87                                                          Page 4
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.      Hardwood Software Associates
  268.      
  269.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  270.      
  271.      
  272.                                 GR_STAT - Status Functions                                __________________________
  273.      
  274.      
  275.      NAME:                G_STATE - Returns current video state                          G_STATE                              
  276.      SYNOPSIS:            g_state ();
  277.      DESCRIPTION:         Calls BIOS INT 10 with function code 15 to get
  278.                           current video state.
  279.      RETURNS:             Text modes:
  280.                             0 = 40x25 Black and white
  281.                             1 = 40x25 Color
  282.                             2 = 80x25 Black and white
  283.                             3 = 80x25 Color
  284.                           Graphics modes:
  285.                             4 = 320x200 Color
  286.                             5 = 320x200 Black and white
  287.                             6 = 640x200 Black and white
  288.                             7 = Monochrome
  289.                             D = 320x200 on color monitor        (EGA)
  290.                             E = 640x200                         (EGA)
  291.                             F = 640x350 on monochrome           (EGA)
  292.                            10 = 640x350 on EGA monitor          (EGA)
  293.                            64 = 640x400 Black and white         (AT&T)
  294.      
  295.      CAUTIONS:            Mode must be 7 for Hercules graphics routines
  296.      
  297.      NAME:                G_HERC - Use Hercules monochrome graphics board                          G_HERC                                         
  298.      SYNOPSIS:            g_herc ();
  299.      DESCRIPTION:         Use the Hercules monochrome graphics board.  This is
  300.                           the default mode.
  301.      
  302.      NAME:                G_CGA_HR - Use IBM CGA in high resolution (640x200)                          G_CGA_HR                                           
  303.                                        mode
  304.      SYNOPSIS:            g_cga_hr ();
  305.      DESCRIPTION:         Use the IBM color graphics adapter in high
  306.                           resolution mode.
  307.      
  308.      
  309.      NAME:                G_EGA_HR_CO - Use IBM EGA in high resolution                          G_EGA_HR_CO                                 
  310.                                           (640x350) mode
  311.      SYNOPSIS:            g_ega_hr_co ();
  312.      DESCRIPTION:         Use the IBM EGA in high resolution (640x350) color
  313.                           mode.
  314.      
  315.      NAME:                G_OTHER - Use another variety of graphics adapter                          G_OTHER                                          
  316.      SYNOPSIS:            g_other (x,y,interlace,segment,mode);
  317.                           int x,y;               Number of pixels in each
  318.                                                  direction
  319.                           int interlace;         Interlace factor
  320.                                                  (always a power of 2)
  321.                                                  For example:
  322.                                                  2 - IBM color (non interlaces
  323.      
  324.      10-Sep-87                                                          Page 5
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.      Hardwood Software Associates
  334.      
  335.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  336.      
  337.                                                      200 rows)
  338.                                                  4 - 400 rows interlaced (AT&T 64)
  339.                           unsigned int segment;  Segment for graphics memory
  340.                           int mode;              BIOS graphics mode to use
  341.      DESCRIPTION:         CRT controller is another type.  All mode switching
  342.                           is done via BIOS calls.
  343.      
  344.      NAME:                G_DELAY - Set delay for screen switching                          G_DELAY                                 
  345.      SYNOPSIS:            g_delay(delay);
  346.                           int delay;
  347.      DESCRIPTION:         Set the delay before turning screen on when
  348.                           switching between graphics and text modes on
  349.                           Hercules boards. In order to prevent screen jump,
  350.                           and sometimes garbage appearing on the screen, it is
  351.                           necessary to delay for a while before turning on the
  352.                           screen.  The delay loop count is set by this
  353.                           routine.  The default delay loop is 7000.
  354.      CAUTIONS:            Delays <=0 are ignored.
  355.      
  356.      NAME:                DISP_GRAPH - Set the display to graphics mode                          DISP_GRAPH                                   
  357.      SYNOPSIS:            disp_graph ();
  358.      DESCRIPTION:         The board is set to the graphics mode, displaying
  359.                           the currently active graphics page.  Before turning
  360.                           on the screen a delay loop controlled by "g_delay"
  361.                           is executed to prevent screen bounce. If not in the
  362.                           Hercules mode the BIOS equipment flag is retrieved
  363.                           and saved before switching it to the color crt mode.
  364.      RETURNS:             0 - All OK
  365.                           1 - Error (not in video mode 7 for Hercules)
  366.      
  367.      NAME:                DISP_TEXT - Set the board to the text mode                          DISP_TEXT                                 
  368.      SYNOPSIS:            disp_text(mode);
  369.                           int mode;              Text mode to use (non
  370.                                                  Hercules only)
  371.                                                  For IBM: 0 thru 3 OK
  372.      DESCRIPTION:         The board is set to the text mode.  Before turning
  373.                           on the screen a delay loop controlled by "g_delay"
  374.                           is executed to prevent screen bounce.  If in the
  375.                           BIOS mode the old equipment flag is restored.
  376.      
  377.      NAME:                G_LOC - Return current location                          G_LOC                          
  378.      SYNOPSIS:            g_loc (x,y);
  379.                           int *x;                     X coordinate
  380.                                                         (0 <= x <= max X)
  381.                           int *y;                     Y coordinate
  382.                                                         (0 <= y <= max Y)
  383.      DESCRIPTION:         Return the location of the current pixel unscaled.
  384.      
  385.      NAME:                G_R_ORIGIN - Return the current origin location                          G_R_ORIGIN                                     
  386.      SYNOPSIS:            g_r_origin();
  387.      DESCRIPTION:         Return the current origin location.
  388.      RETURNS:             0 - Upper left corner of screen
  389.      
  390.      10-Sep-87                                                          Page 6
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.      Hardwood Software Associates
  400.      
  401.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  402.      
  403.                           1 - Lower left corner of screen
  404.      
  405.      NAME:                G_R_POINT - Return the color of the specified pixel                          G_R_POINT                                          
  406.      SYNOPSIS:            g_r_point(x,y);
  407.                           int x;                      X coordinate
  408.                                                         (0 <= x <= max X)
  409.                           int y;                      Y coordinate
  410.                                                         (0 <= y <= max Y)
  411.      DESCRIPTION:         Return the color of the specified pixel.
  412.      RETURNS:             The color of the specified pixel.
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.      
  456.      10-Sep-87                                                          Page 7
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.      Hardwood Software Associates
  466.      
  467.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  468.      
  469.      
  470.                             GR_STR - String Display Functions                            _________________________________
  471.      
  472.      NAME:                G_STR_H - Display a horizontal message on screen                          G_STR_H                                         
  473.      SYNOPSIS:            g_str_h (x,y,msg);
  474.                           int x;                      pixel address of x
  475.                           int y;                      pixel address of y.
  476.                           char *msg;                  Message to display.
  477.      DESCRIPTION:         Display a horizontal message on the screen at the
  478.                           specified X,Y coordinates. (X = -1 - use last ones
  479.                           specified)
  480.      CAUTIONS:            Uses ROM character table.
  481.                           Last coordinates for characters are different than
  482.                           last point/line coordinates.
  483.      
  484.                               GR_FILL - Area Fill Function                              ____________________________
  485.      
  486.      NAME:                G_FILL - Fill an area from a seed                          G_FILL                           
  487.      SYNOPSIS:            g_fill (x,y,new_color);
  488.                           int x;                      Seed x pixel address
  489.                           int y;                      Seed y pixel address
  490.                           int new_color;              Color to fill with
  491.      DESCRIPTION:         Starting at the seed location fill the screen with
  492.                           the specified color until a boundary is reached.  A
  493.                           boundary pixel is one that has a color different
  494.                           than the original seed pixel color.
  495.      CAUTIONS:            Because this routine calls itself recursively, it
  496.                           can use a great deal of stack space.  Approximately
  497.                           26 bytes per horizontal line of fill should be
  498.                           allowed.  This means that to fill a Hercules screen
  499.                           would require a stack size of at least 8352 bytes.
  500.      NOTE:                This routine is adapted from a Pascal routine
  501.                           published in the May, 1986 issue of Computer
  502.                           Language Magazine by William F. Polik
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.      
  522.      10-Sep-87                                                          Page 8
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.      Hardwood Software Associates
  532.      
  533.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  534.      
  535.      
  536.                             GR_MISC - Miscellaneous Functions                            _________________________________
  537.      
  538.      NAME:                G_SAVE - Save the current graphics screen image in                          G_SAVE                                            
  539.                                      the buffer
  540.      SYNOPSIS:            g_save (buffer,number);
  541.                           int buffer[number];        Buffer to receive screen
  542.                                                      image
  543.                           int number;                Number of words to save
  544.      CAUTIONS:            This routine saves the entire graphics screen, it is
  545.                           not a window save,  No checking is done to insure
  546.                           that the buffer is large enough.  For the Hercules
  547.                           board the array should be 16384.  For the EGA
  548.                           board only the last bit plane is saved, therefore
  549.                           it might not be as useful.
  550.      
  551.      NAME:                G_RESTORE - Restore the graphics screen image from                          G_RESTORE                                         
  552.                                         the buffer
  553.      SYNOPSIS:            g_restore (buffer,number);
  554.                           int buffer[number];        Buffer containing screen
  555.                                                      image
  556.                           int number;                Number of words to save
  557.      CAUTIONS:            This routine restore the entire graphics screen, it
  558.                           is not a window restore.
  559.      
  560.      NAME:                G_ORIGIN - Set screen origin location                          G_ORIGIN                             
  561.      SYNOPSIS:            g_origin (loc);
  562.                           int loc;                   Origin location:
  563.                                                        0 - Upper left corner
  564.                                                        1 - Lower left corner
  565.      DESCRIPTION:         Set screen origin location.  If the origin is
  566.                           upper left (default) then positive Y is down.
  567.                           If the origin is lower left then positive Y
  568.                           is up.
  569.      RETURNS:             0  - successful
  570.                           -1 - Invalid location
  571.      
  572.      NAME:                G_BS_H - Back space one character position                          G_BS_H                                    
  573.      SYNOPSIS:            g_bs_h ();
  574.      DESCRIPTION:         Back space the current character position one place.
  575.      
  576.      NAME:                G_CLR - Clear the current graphics page                          G_CLR                                  
  577.      SYNOPSIS:            g_clr ();
  578.      DESCRIPTION:         Clears the current graphics page and the current
  579.                           coordinate values for lines and characters.
  580.                           If EGA, then background color fills screen.
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.      
  588.      10-Sep-87                                                          Page 9
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.      Hardwood Software Associates
  598.      
  599.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  600.      
  601.      
  602.                     GR_ATTR - Functions to Control Screen Attributes                    ________________________________________________
  603.      
  604.      
  605.      NAME:                G_SOLID - Set line type to solid                          G_SOLID                         
  606.      SYNOPSIS:            g_solid ();
  607.      DESCRIPTION:         Set line type to solid lines.
  608.      
  609.      NAME:                G_DOT - Set line type to dotted                          G_DOT                          
  610.      SYNOPSIS:            g_dot ();
  611.      DESCRIPTION:         Set line type to dotted lines.
  612.      
  613.      NAME:                G_DASH - Set line type to dashed                          G_DASH                          
  614.      SYNOPSIS:            g_dash ();
  615.      DESCRIPTION:         Set line type to dashed lines.
  616.      
  617.      NAME:                G_SET_LINE - Set line type mask                          G_SET_LINE                     
  618.      SYNOPSIS:            g_set_line (type);
  619.                           unsigned int type;         Line type mask
  620.      DESCRIPTION:         Set line type.  The line type is a word that defines
  621.                           if the next pel will be set.  If the bit is 1 the
  622.                           the element is set.  For example:
  623.                             type = 0x3333;  /* Set two pel then skip two */
  624.      
  625.      NAME:                G_FORE_COLOR - Set foreground color                          G_FORE_COLOR                       
  626.      SYNOPSIS:            g_fore_color (color);
  627.                           int color;                 Foreground color
  628.      DESCRIPTION:         Sets the foreground color.  The foreground color is
  629.                           used to draw lines and display strings.
  630.      
  631.      NAME:                G_BACK_COLOR - Set background color                          G_BACK_COLOR                       
  632.      SYNOPSIS:            g_back_color (color);
  633.                           int color;                 Background color
  634.      DESCRIPTION:         Sets the background color.  The background color is
  635.                           used to clear the screen and behind display strings.
  636.      
  637.      NAME:                G_REVERSE_COLOR - Swap foreground and background                          G_REVERSE_COLOR                                 
  638.                                               colors
  639.      SYNOPSIS:            g_reverse_color ();
  640.      DESCRIPTION:         Swaps the current foreground color with the current
  641.                           background color.
  642.      
  643.      NAME:                G_MODE - Set mode for screen drawing                          G_MODE                              
  644.      SYNOPSIS:            g_mode(mode);
  645.                           int mode;                  pixel set mode for all
  646.                                                      graphics commands.
  647.                                                      Graphics (lines/points):
  648.                                                        0 = clear bit
  649.                                                        1 = set bit
  650.                                                        2 = exclusive OR bit
  651.                                                      Graphics text:
  652.                                                        0 = reverse video
  653.      
  654.      10-Sep-87                                                          Page 10
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.      Hardwood Software Associates
  664.      
  665.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  666.      
  667.                                                        1 = normal video
  668.                                                        2 = exclusive OR
  669.      DESCRIPTION:         Set up the mode for setting pixels for all other
  670.                           commands.
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  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.      10-Sep-87                                                          Page 11
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.      Hardwood Software Associates
  730.      
  731.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  732.      
  733.      
  734.                       GR_DRAW - Functions to Draw Lines and Points                      ____________________________________________
  735.      
  736.      
  737.      NAME:                G_POINT - Set the specified pixel in the current                          G_POINT                                         
  738.                                       graphics page
  739.      SYNOPSIS:            g_point (x,y);
  740.                           int x;                      X coordinate of pixel
  741.                                                        (0 <= x <= max X)
  742.                           int y;                      Y coordinate of pixel
  743.                                                        (0 <= y <= max Y)
  744.      DESCRIPTION:         Sets the pixel at the specified coordinate according
  745.                           to the current mode (see g_mode). Saves the
  746.                           coordinates for future calls.
  747.      
  748.      NAME:                G_LINE - Draw a line                          G_LINE              
  749.      SYNOPSIS:            g_line (x1,y1,x2,y2);
  750.                           int x1;                    X coordinate of start of line
  751.                                                        (0 <= x1 <= max X)
  752.                           int y1                     Y coordinate of start of line
  753.                                                        (0 <= y1 <= max Y)
  754.                           int x2;                    X coordinate of end of line
  755.                                                        (0 <= x2 <= max X)
  756.                           int y2                     Y coordinate of end of line
  757.                                                        (0 <= y2 <= max Y)
  758.      DESCRIPTION:         Draw a line between the specified coordinates.
  759.                           If any coordinate value is equal to -1 then the
  760.                           coordinate value set by previous graphics call
  761.                           is used.
  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.      10-Sep-87                                                          Page 12
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.      Hardwood Software Associates
  796.      
  797.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  798.      
  799.      
  800.                   GR_SCALE - Functions to Perform Screen Scaled Actions                  _____________________________________________________
  801.      
  802.      
  803.      NAME:                G_SCALE - Set screen scale factors                          G_SCALE                           
  804.      SYNOPSIS:            g_scale (xdots,ydots);
  805.                           int xdots;                 pixels per inch horizontal
  806.                                                        (default = 90)
  807.                           int ydots;                 pixels per inch vertical
  808.                                                        (default = 63)
  809.      DESCRIPTION:         Set the scale factors for x and y axes (in pixels per
  810.                           inch). These scale factors are used by all "gs"
  811.                           routines.
  812.      CAUTIONS:            Both values must be <= 255.
  813.                           If scale factors set incorrectly, circles will not
  814.                           be round and squares will be rectangles.
  815.      
  816.      NAME:                GS_LOC - Return current location (scaled)                          GS_LOC                                   
  817.      SYNOPSIS:            gs_loc (x,y);
  818.                           int *x;                    X coordinate of pixel
  819.                                                      (0 <= x <= max X*xdots*1000)
  820.                           int *y;                    Y coordinate of pixel
  821.                                                      (0 <= y <= max Y*ydots*1000)
  822.      DESCRIPTION:         Return the location of the current pixel scaled.
  823.      
  824.      NAME:                GS_POINT - Set a pixel (scaled)                          GS_POINT                       
  825.      SYNOPSIS:            gs_point (x,y);
  826.                           int x;                     X coordinate of pixel
  827.                                                      (0 <= x <= max X*xdots*1000)
  828.                           int y;                     Y coordinate of pixel
  829.                                                      (0 <= y <= max Y*ydots*1000)
  830.      DESCRIPTION:         Set the pixel at the specified scaled coordinate
  831.                           according to the current mode (see g_mode).
  832.                           Save the coordinates for future calls, arguments in
  833.                           screen inches * 1000.
  834.      
  835.      NAME:                GS_R_POINT - Return the color of the specified pixel                          GS_R_POINT                                          
  836.      SYNOPSIS:            g_r_point(x,y);
  837.                           int x;                     X coordinate
  838.                                                      (0 <= x <= max X*xdots*1000)
  839.                           int y;                     Y coordinate
  840.                                                      (0 <= y <= max Y*ydots*1000)
  841.      DESCRIPTION:         Return the color of the specified pixel.
  842.      RETURNS:             The color of the specified pixel.
  843.      
  844.      NAME:                GS_LINE - Draw a line (scaled)                          GS_LINE                       
  845.      SYNOPSIS:            gs_line (x1,y1,x2,y2);
  846.                           int x1;                    X coordinate of start of line
  847.                                                      (0 <= x1 <= max X*xdots*1000)
  848.                           int y1;                    Y coordinate of start of line
  849.                                                      (0 <= y1 <= max Y*ydots*1000)
  850.                           int x2;                    X coordinate of end of line
  851.      
  852.      10-Sep-87                                                          Page 13
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.      Hardwood Software Associates
  862.      
  863.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  864.      
  865.                                                      (0 <= x2 <= max X*xdots*1000)
  866.                           int y2;                    Y coordinate of end of line
  867.                                                      (0 <= y2 <= max Y*ydots*1000)
  868.      DESCRIPTION:         Draw a line between the specified coordinates according
  869.                           to current mode (see g_mode) and line type.  If any
  870.                           coordinate value is equal to -1 then the coorniate
  871.                           value of the current location is used.
  872.      
  873.      NAME:                GS_STR_H - Display a horizontal message on screen                          GS_STR_H                                         
  874.                                        (scaled)
  875.      SYNOPSIS:            gs_str_h (x,y,msg);
  876.                           int x;                     X coordinate of start of message
  877.                           int y;                     Y coordinate of start of message
  878.                           char *msg;                 Message to display.
  879.      DESCRIPTION:         Display a horizontal message on the screen at the
  880.                           specified X,Y coordinates. (X = -1 - use last ones
  881.                           specified)
  882.      CAUTIONS:            Uses ROM character table.
  883.                           Last coordinates for characters are different than
  884.                           last point/line coordinates.
  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.      10-Sep-87                                                          Page 14
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.      Hardwood Software Associates
  928.      
  929.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  930.      
  931.      
  932.                                GR_ARC - Draw Circular Arcs                               ___________________________
  933.      
  934.      NAME:                GS_ARC - Draw a circular arc (scaled)                          GS_ARC                               
  935.                           gs_arc (x1,y1,x2,y2,xc,yc,cw);
  936.                           int x1;                    X coordinate of start of arc
  937.                                                      (0 <= x1 <= max X*xdots*1000)
  938.                           int y1;                    Y coordinate of start of arc
  939.                                                      (0 <= y1 <= max Y*ydots*1000)
  940.                           int x2;                    X coordinate of end of arc
  941.                                                      (0 <= x2 <= max X*xdots*1000)
  942.                           int y2;                    Y coordinate of end of arc
  943.                                                      (0 <= y2 <= max Y*ydots*1000)
  944.                           int xc;                    X coordinate of center of arc
  945.                                                      (0 <= x2 <= max X*xdots*1000)
  946.                           int yc;                    Y coordinate of center of arc
  947.                                                      (0 <= y2 <= max Y*ydots*1000)
  948.                           int cw;                    Direction of arc:
  949.                                                        1 = Clockwise
  950.                                                        0 = Counterclockwise
  951.      DESCRIPTION:         Draw a circular arc using scaled coordinates from
  952.                           (x1,y1) to (x2,y2) centered at (xc,yc).
  953.      RETRUNS:             1 = Bad circle defined by parameters
  954.                           0 = All OK
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.      
  984.      10-Sep-87                                                          Page 15
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.      Hardwood Software Associates
  994.      
  995.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  996.      
  997.      
  998.                            GR_HERC - Hercules Graphics Support                           ___________________________________
  999.      
  1000.      NAME:                G_PAGE - Set graphics page for Hercules                          G_PAGE                                 
  1001.      SYNOPSIS:            g_page (page);
  1002.                           int page;                  Page to use for all
  1003.                                                      subsequent calls
  1004.      DESCRIPTION:         Set the current graphics page that will be used for
  1005.                           all subsequent graphics calls.
  1006.      RETURNS:             0  - successful
  1007.                           -1 - Invalid page
  1008.      
  1009.                    GR_GETS - Get a String from User in Graphics Screen                   ___________________________________________________
  1010.      
  1011.      NAME:                G_GETS - Get a string from console in graphics mode                          G_GETS                                             
  1012.      SYNOPSIS:            char *g_gets (buffer);
  1013.                           char *buffer;               Buffer for input string
  1014.      DESCRIPTION:         Operates just like "gets".  Reads a string from the
  1015.                           keyboard, echoing to the graphics screen.  The
  1016.                           terminating newline is replaced with a null byte.
  1017.      RETURNS:             Pointer to string
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.      
  1050.      10-Sep-87                                                          Page 16
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.      Hardwood Software Associates
  1060.      
  1061.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  1062.      
  1063.      
  1064.                            Alphabetical List of HSA_GRAF Functions                           _______________________________________
  1065.      
  1066.      
  1067.      DISP_GRAPH      Set the display to graphics mode
  1068.      DISP_TEXT       Set the board to the text mode
  1069.      GS_ARC          Draw a circular arc (scaled)
  1070.      GS_LINE         Draw a line (scaled)
  1071.      GS_LOC          Return current location (scaled)
  1072.      GS_POINT        Set a point (scaled)
  1073.      GS_R_POINT      Return the color of the specified point
  1074.      GS_STR_H        Display a horizontal message on screen
  1075.      G_BACK_COLOR    Set background color
  1076.      G_BS_H          Back space one character position
  1077.      G_CGA_HR        Use IBM CGA in high resolution (640x200)
  1078.      G_CLR           Clear the current graphics page
  1079.      G_DASH          Set line type to dashed
  1080.      G_DELAY         Set delay for screen switching
  1081.      G_DOT           Set line type to dotted
  1082.      G_EGA_HR_CO     Use IBM EGA in high resolution
  1083.      G_FILL          Fill an area from a seed
  1084.      G_FORE_COLOR    Set foreground color
  1085.      G_GETS          Get a string from console in graphics mode
  1086.      G_HERC          Use Hercules monochrome graphics board
  1087.      G_LINE          Draw a line
  1088.      G_LOC           Return current location
  1089.      G_MODE          Set mode for screen drawing
  1090.      G_ORIGIN        Set screen origin location
  1091.      G_OTHER         Use another variety of graphics adapter
  1092.      G_PAGE          Set graphics page for Hercules
  1093.      G_POINT         Set the specified pixel in the current
  1094.      G_RESTORE       Restore the graphics screen image from buffer
  1095.      G_REVERSE_COLOR Swap foreground and background
  1096.      G_R_ORIGIN      Return the current origin location
  1097.      G_R_POINT       Return the color of the specified point
  1098.      G_SAVE          Save the current graphics screen image in buffer
  1099.      G_SCALE         Set screen scale factors
  1100.      G_SET_LINE      Set line type mask
  1101.      G_SOLID         Set line type to solid
  1102.      G_STATE         Returns current video state
  1103.      G_STR_H         Display a horizontal message on screen
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.      
  1116.      10-Sep-87                                                          Page 17
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.      Hardwood Software Associates
  1126.      
  1127.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  1128.      
  1129.      
  1130.                                  Companion Library                                 _________________
  1131.      
  1132.      Hardwood Software Associates has developed companion library to the
  1133.      HSA_GRAF library.
  1134.      
  1135.      HSA_TEXT is a library of C functions that provide direct, fast control
  1136.      over the IBM PC screen in text mode.  The functions have been developed
  1137.      and  tested  for the  Microsoft  versions  3.00  and 4.00, Turbo C
  1138.      version 1.00, and Lattice version 3.10 C compilers.  This library has two
  1139.      divisions.  All basic screen control functions begin with the prefix
  1140.      "tx_".  The window control functions all begin with "w_". The library is
  1141.      contained in several modules, grouped by function.
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  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.      10-Sep-87                                                          Page 18
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.      Hardwood Software Associates
  1192.      
  1193.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  1194.      
  1195.      
  1196.                               HSA_GRAF Change History                              _______________________
  1197.      
  1198.      Version         Date       Functions            Modifications                  __________________________________________________________________________
  1199.      
  1200.       1.01        24-Jul-87     All                  Released to the public
  1201.      
  1202.      
  1203.       1.02        22-Aug-87     gs_arc               Add function templates
  1204.                                                      to hsa_gr.h
  1205.                                 hsa_graf.doc         Correct a few
  1206.                                                      documentation errors
  1207.                                 gr_str               g_str_h was incorrectly
  1208.                                                      named g_msg_h
  1209.       1.03        10-Sep-87                          Turbo C support
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  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.      10-Sep-87                                                          Page 19
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.      Hardwood Software Associates
  1258.      
  1259.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  1260.      
  1261.      
  1262.                       Alphabetical List of HSA_TEXT Functions                      _______________________________________
  1263.      
  1264.      
  1265.      TX_ATTR         Read the current screen attribute
  1266.      TX_ATTR_SET     Set the current screen attribute
  1267.      TX_BIOS         Use BIOS for all I/O
  1268.      TX_BLINK        Set to blinking white on black
  1269.      TX_BOLD         Set to intense white on black
  1270.      TX_B_B          Set to intense blinking white on black
  1271.      TX_CHR          Display a character at a specified location
  1272.      TX_CHR_A        Display character using specified location and attribute
  1273.      TX_CHR_A_C      Continue display of character with specified attribute
  1274.      TX_CHR_C        Continue display of character
  1275.      TX_CHR_O        Display a character only at specified location
  1276.      TX_CHR_O_C      Display a character only, continued from current location
  1277.      TX_CLR          Clear the entire screen
  1278.      TX_CLR_EOL      Clear to the end of the line
  1279.      TX_CLR_ROWS     Clear a block of lines on the screen
  1280.      TX_COL          Read the current cursor column
  1281.      TX_CONF         Set crt screen memory address and 6845 address
  1282.      TX_CUR_HIDE     Hide the cursor
  1283.      TX_CUR_SET      Set the cursor start / stop scan lines
  1284.      TX_CUR_SHOW     Show the cursor
  1285.      TX_DIRECT       Access screen hardware directly
  1286.      TX_DOWN         Move the current location one row down
  1287.      TX_FILL         Fill a line with the specified number of a character
  1288.      TX_FILL_A       Fill a line with the specified number of a character
  1289.      TX_FILL_A_C     Fill a line with the specified number of a character
  1290.      TX_FILL_C       Fill a line with the specified number of a character
  1291.      TX_GET_STATUS   CRT status save
  1292.      TX_LEFT         Move the current location one column left
  1293.      TX_LOC          Set the current location
  1294.      TX_NL           Move the current location to the start of the next line
  1295.      TX_NORM         Set to white on black
  1296.      TX_NO_COL       Read the number of columns in screen
  1297.      TX_NO_SNOW      Don't wait for retrace to prevent snow
  1298.      TX_PUT_STATUS   CRT status restore
  1299.      TX_RD_BLK       Read a block of screen data
  1300.      TX_RD_BLK_C     Read a block of screen data, at current location
  1301.      TX_RD_STR       Read string from screen
  1302.      TX_RD_STR_C     Read string from screen at current location
  1303.      TX_REVERSE      Set to black on white
  1304.      TX_RIGHT        Move the current location one column right
  1305.      TX_ROW          Read the current cursor row
  1306.      TX_SCDN         Scroll window down one line
  1307.      TX_SCUP         Scroll window up one line
  1308.      TX_SNOW         Wait for retrace to prevent snow
  1309.      TX_STATE        Returns current video state
  1310.      TX_STR          Display string at specified location
  1311.      TX_STR_A        Display string using specified location and attribute
  1312.      TX_STR_A_C      Display a string, continued from current location
  1313.      
  1314.      10-Sep-87                                                          Page 20
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.      Hardwood Software Associates
  1324.      
  1325.              HSA_GRAF - Screen Graphics Library (V1.03)               HSA_GRAF - Screen Graphics Library (V1.03)  
  1326.      
  1327.      TX_STR_C        Display a string, continued from current location
  1328.      TX_UNDER        Set to underlined
  1329.      TX_UP           Move the current location one row up
  1330.      TX_WR_BLK       Write a block of screen data
  1331.      TX_WR_BLK_C     Write a block of screen data, at current location
  1332.      W_BOT_MSG       Display a message in the bottom border line
  1333.      W_CLOSE         Close a window
  1334.      W_CLR           Clear a window
  1335.      W_CUR_LOC       Display the screen cursor in the window
  1336.      W_MENU1_FILL    Fill a style 1 menu with data
  1337.      W_MENU1_OPEN    Open a menu style 1 window
  1338.      W_MOVE          Move a window
  1339.      W_OPEN          Open a window
  1340.      W_SCDN          Scroll data in window down
  1341.      W_SCUP          Scroll data in window up
  1342.      W_STR           Display a string in a window
  1343.      W_STR_C         Display a string in a window, at current location
  1344.      W_STR_A         Display a string in a window, with attribute
  1345.      W_STR_C_A       Display a string in a window, at current location
  1346.      W_STR_COL       Display a string in a window column
  1347.      W_TOP_MSG       Display a message in the top border line
  1348.      W_USER_BORDER   Set characters for user border
  1349.      
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.      
  1380.      10-Sep-87                                                          Page 21
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.