home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / GRAPHICS / HSA.ZIP / HSA_GRAF.DOC < prev    next >
Encoding:
Text File  |  1987-09-10  |  45.4 KB  |  1,387 lines

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