home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / msdos / animutil / anim13 / grafsupp.h < prev    next >
Text File  |  1990-02-07  |  3KB  |  79 lines

  1. /* grafsupp.h
  2.  
  3. Header file to accompany the functions in grafsupp.c,
  4. which are supplemental to those in Borland Turbo C.
  5. This header file defines constants, etc. which make it possible
  6. for the user to think in terms of coordinates which are natural
  7. for the variables to be plotted and which are independent of the graphics
  8. mode in operation (CGA, EGA, VGA, etc).
  9. We call these coordinates "generic" coordinates, which always
  10. lie between 0 and 1, and "user" coordinates, which lie in whatever
  11. range the user wants.
  12.  
  13. Jon Ahlquist, 26 June 1988, 13 Jan 1990.
  14.  
  15. Copyright 1990 by Jon Ahlquist, Department of Meteorology B-161,
  16. Florida State University, Tallahassee, Florida 32306-3034, USA.
  17. Telephone: (904) 644-1558.
  18. Telnet address: ahlquist@metsat.met.fsu.edu (ahlquist@128.186.5.2)
  19.  
  20. This software may be freely copied without charge.
  21. Copyright is made to prevent anyone from trying to impose restrictions
  22. on this software.
  23. All software and documentation is provided "as is" without warranty
  24. of any kind.
  25.  
  26. Development of this material was sponsored by NSF grant ATM-8714674.
  27. */
  28.  
  29. /* Import global variables that ar defined in grafsupp.c */
  30.  
  31. /* Declare global variables set by scale(). */
  32.  
  33. extern
  34. float _xscale,     _xoffset,     _yscale,     _yoffset,
  35.       _xscale_gen, _xoffset_gen, _yscale_gen, _yoffset_gen,
  36.       _X_left, _X_right, _Y_bottom, _Y_top,
  37.       pixel_aspect_ratio;
  38.  
  39. extern
  40. int   XX_max, YY_max, XX_width;
  41.  
  42.  
  43.  
  44. /* 
  45. Define the transformation equations between the user's coordinates (x,y)
  46. and the pixel coordinates (XX,YY) of the particular graphics mode for which
  47. the user's graphics board is set. Also define the transformation
  48. equations between generic screen coordinates (X,Y), where both X and Y
  49. range from 0 to 1, and the pixel coordinates (XG,YG) of the particular
  50. graphics mode for which the user's graphics board is set.
  51. The values for
  52. _xscale,     _xoffset,     _yscale,         _yoffset,
  53. _xscale_gen, _xoffset_gen, _yscale_gen, and _yoffset_gen
  54. are determined by function scale(), which was written by Jon Ahlquist.
  55. */
  56.  
  57. #define XX(x) ((int) ((x)*_xscale     + _xoffset))
  58. #define YY(y) ((int) ((y)*_yscale     + _yoffset))
  59. #define XG(X) ((int) ((X)*_xscale_gen + _xoffset_gen))
  60. #define YG(Y) ((int) ((Y)*_yscale_gen + _yoffset_gen))
  61.  
  62. /**************************
  63. Define function prototypes.
  64. **************************/
  65.  
  66. void scale(float X_left,        float X_right,
  67.            float Y_bottom,      float Y_top,
  68.  
  69.            float x_left_user,   float x_right_user,
  70.            float y_bottom_user, float y_top_user);
  71.  
  72. /* After initgraph() and then scale() have been called,
  73. the following functions can be called. */
  74.  
  75. void load_array(float *x, int n, float xmin, float xmax);
  76. void draw_perimeter(int n_major_x, int n_minor_x,
  77.                     int n_major_y, int n_minor_y);
  78. void label_plot(char *title, char *xlabel, char *ylabel);
  79. void plot_curve(float *x, float *y, int n);