home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / graph.zip / GRAPH.DOC < prev    next >
Text File  |  1987-06-10  |  7KB  |  197 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                   Graph.lib
  9.  
  10.                      Copyright 1987 by Natural Software
  11.                             19 South 5th. Street
  12.                          St. Charles Illinois 60174
  13.                                (312) 377-7320
  14.                              All Rights Reserved
  15.                          (see shareware note below)
  16.  
  17.  
  18.                                 June 10, 1987
  19.  
  20.  
  21.  
  22. The graph.lib  library contains  some graphics primitives that may be useful-
  23. especially to Turbo Pascal  programmers converting  to Turbo  C and  who have
  24. used some of the built-in Turbo Pascal graphic functions.
  25.  
  26. These routines  are for  the IBM  Color Graphic Adapter only! They are highly
  27. optimized for speed by  writing  directly  to  the  screen  buffer  in memory
  28. (location 0xB8000). They are for the high resolution graphics mode only - 640
  29. by 200 pixels (black background, one color foreground).
  30.  
  31. This library is being  offered as  shareware. You  can use  these routines in
  32. your programs  as long  as they are for your personal use. If you want to use
  33. them in a program for sale  to others,  see the  legal status  section below.
  34. Look below also if you would like to purchase the source code for graph.lib.
  35.  
  36. This package: GRAPH.ARC includes the following files:
  37.  
  38.      GRAPH.LIB      -    The library of graphics primitives described below.
  39.  
  40.      GRAPH.H        -    The function prototype header to be included in your
  41.                          programs that use graph.lib
  42.  
  43.      GRDEMO.C       -    An example program showing how to used graph.lib.
  44.  
  45.      GRDEMO.PRJ     -    The Turbo C project file for GRDEMO.C.
  46.  
  47.      GLOBAL.H       -    Declarations  of  global  vars  used  by  graph.lib.
  48.                          Include this in your program.
  49.  
  50.      GLOB_EXT.H     -    The  same  global  vars  declared as externals to be
  51.                          included in your sub-modules (if any).
  52.  
  53.      GLOB_DEF.H     -    Some useful macros and definitions. Include  this in
  54.                          your programs that use graph.lib
  55.  
  56.      GRAPH.DOC      -    What you are reading.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.                            Functions in Graph.lib
  67.                            ----------------------
  68.  
  69. In the  following functions  (except for  gotoxy), the values of x must be in
  70. the range from 0 to 639, and the values of  y must  be in  the range  of 0 to
  71. 199.
  72.  
  73. The global variable: draw_option controls what happens when a pixel is drawn.
  74. If draw_option = NORMAL (its initialized state), the pixel will be set  to on
  75. regardless of  its current setting. If draw_option = XOR_MODE, the pixel will
  76. be xor'd with its current setting.  This lets  you draw  over existing images
  77. with a transparent effect.
  78.  
  79. Please refer to the example program GRDEMO.C for example usage.
  80.  
  81.  
  82.                int    baseaddress(int y);  
  83.  
  84. baseaddress  returns  the  line  offset  in  the screen buffer for Y. You can
  85. directly access the graphics screen  by  referring  to  the  global variable:
  86. screen. For example to set eight dots a location x and y:
  87.  
  88.                screen[baseaddress(y) + (x >> 3)] = 0xff;
  89.  
  90. Note that x is divided by 8 to offset to the byte on the selected line.
  91.  
  92.  
  93.                BYTE   hardwarepresent();
  94.  
  95. returns true  (1) if  the CGA is present, otherwise returns false (0). A call
  96. to hardwarepresent should be made before any other  graphics calls  to ensure
  97. that your program has the correct environment. (Note that BYTE is an unsigned
  98. char as defined in GLOB_DEF.H)
  99.  
  100.  
  101.                void   init_graphics(int mode);
  102.  
  103. This sets the graphics mode. Since these graphics functions support  high res
  104. mode only,  the mode value must be 6 (for 640 by 200 graphics mode) and 3 (to
  105. return to 80 by 25 text  mode). The  defined constants:  HIGHRES and TEXTMODE
  106. are declared in GLOB_DEF.H for this purpose.
  107.  
  108. Also, the  macros: textmode() and hires() are included for compatibility with
  109. the Turbo Pascal calls.
  110.  
  111.  
  112.                void   hirescolor(int color);
  113.  
  114. This sets foreground color. The value of color should be in the  range from 0
  115. to 16. The valid colors are defined as constants in glob_def.h
  116.  
  117. Note, that  in high res mode the background is always black, and changing the
  118. foreground color means changing the full screen to that color.
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                void   gotoxy(int x, int y);
  127.  
  128. This does what its counterpart in Turbo Pascal does -  moves the  cursor to x
  129. (from 0 to 70) and y (from 0 to 24).
  130.  
  131.  
  132.                void   clearscreen();
  133.  
  134. This clears the full screen.
  135.  
  136.  
  137.                void   plot(int x, int y);
  138.  
  139. This draws one pixel at x, y using current drawing mode: NORMAL or XOR_MODE. 
  140.  
  141.  
  142.                void   draw_line(int x, int y, int newx, int newy);
  143.  
  144. This draws a line from x, y to newx, newy using the current drawing mode.
  145.  
  146.  
  147.                void   draw_box(int x1, int y1, int x2, int y2);
  148.  
  149. this draws a rectangular box given the opposing corners x1,y1 and x2,y2.
  150.  
  151.  
  152.                void   draw_circle(int bx, int by, int tox, int toy);
  153.  
  154. This draws  a circle  with bx,by as its center. tox and toy define a point on
  155. its circumference. The draw_circle function calculates the radius.
  156.  
  157.  
  158.                void   lips(int bx, int by, int tx, int ty);
  159.  
  160. This draws an ellipse with bx,by as its center. tx and ty  specify the corner
  161. of a box within which the ellipse is drawn.
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.                           Legal Status of Graph.lib
  172.                           -------------------------
  173.  
  174. The Graphics  functions in graph.lib are protected by copyright. They are not
  175. to be resold or used for any commercial  purpose or  included with  any other
  176. commercial product or software collection without our permission. It is being
  177. distributed as shareware. This means that you are granted the right to freely
  178. use Graph.lib  in your  own programs  for personal use and to make copies for
  179. your personal use and the personal use of your friends.
  180.  
  181. If you want to use Graph.lib in a commercial environment  (not for  your non-
  182. business personal  use) you  can obtain  a license to do so (with full source
  183. code):
  184.  
  185.                Send: $20.00 to:
  186.  
  187.                          Natural Software
  188.                          19 South 5th. Street
  189.                          St. Charles, Illinois 60174
  190.  
  191. If you would like  information on  our other  products, specifically PC-Draft
  192. II, or would like to order with your VISA or Master Card, call:
  193.  
  194.                          (312) 377-7320
  195.  
  196.  
  197.