home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume9 / draw_jt / part01 / dr_lib.h next >
Encoding:
C/C++ Source or Header  |  1989-12-12  |  3.9 KB  |  143 lines

  1. /*
  2.  
  3. Copyright (C) 1988, 1989 by Juha Takala, jta@sah.vtt.fi
  4.  
  5.      This program is free software; you can redistribute it and/or modify
  6.      it under the terms of the GNU General Public License as published by
  7.      the Free Software Foundation; version 1.
  8.  
  9.      This program is distributed in the hope that it will be useful,
  10.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.      the file "License" for more details
  13.  
  14.      You should have received a copy of the GNU General Public License
  15.      along with this program; if not, write to the Free Software
  16.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.  
  19.  */
  20.  
  21.  
  22. /* $Id: dr_lib.h,v 2.3 89/12/08 14:00:31 jta Exp Locker: jta $
  23.  *
  24.  * This is header file for a subroutine package that contains
  25.  * device level routines to manipulate graphics devices such as
  26.  *  - hpgl output for hp7475 plotter
  27.  *  - gl_plot(3) calls for EGA or matrix printer output
  28.  *  - plot(3) interface
  29.  *
  30.  * Following routines are provided:
  31.  *
  32.  *
  33.  * void circle()
  34.  *    - draw a small circle at current point
  35.  *
  36.  * void dr_set_pen(n)
  37.  * int n;
  38.  *    - select pen n
  39.  *    - n==0 menas 'put it away'
  40.  *    - n = 1..6 means select pen n
  41.  *    - n<0 or n>6 issues error message and selects pen 1
  42.  *
  43.  * void dr_goto(x,y,linetype,penup,relative)
  44.  * float x, y; int linetype, penup;
  45.  *    - move pen to point (x,y)
  46.  *    - if penup!=0, will draw line of type linetype
  47.  *    - if relative!=0, will move relative to current point
  48.  *
  49.  * void dr_draw_line(x1, y1, x2, y2, linetype)
  50.  * float x1, y1, x2, y2; int linetype;
  51.  *    - draw a line of type linetype from poin (x1,y1) to point (x2,y2)
  52.  *
  53.  * void dr_set_shape(x)
  54.  * float x;
  55.  *    - change text 'fatness'
  56.  * 
  57.  * void dr_set_size(x)
  58.  * float x;
  59.  *    - change text size
  60.  * 
  61.  * void dr_draw_array(x, y, n, linetype)
  62.  * float x[], y[]; int n, linetype;
  63.  *    - points (x[i],y[i]) (i = 0..n-1) will be connected
  64.  *      with line of linetype
  65.  *
  66.  * void dr_put_mark(x, y, mark) 
  67.  * float x, y; char mark;
  68.  *    - put marker mark at point (x,y)
  69.  *
  70.  * void dr_put_text(xpos, ypos, xofs, yofs, dir, size, s)
  71.  * float xpos, ypos, xofs, yofs; char *dir, *size, *s;
  72.  *    - put text s to position (xpos+xofs,ypos+yofs) in direction dir
  73.  *
  74.  * int dr_finish()
  75.  *    - finish plotting, report errors, return number of them
  76.  *
  77.  * void dr_start(xlow, xhigh, ylow, yhigh, dev)
  78.  * float xlow, xhigh, ylow, yhigh; int dev;
  79.  *    - prepare plotting for device dev, establish relative drawing area
  80.  *
  81.  * void dr_xgrid(n)
  82.  * int n;
  83.  *    - draw vertical grid lines
  84.  *
  85.  * void dr_ygrid(n)
  86.  * int n;
  87.  *    - draw horizontal grid lines
  88.  *
  89.  * void dr_area_def(xlow, xincr, xhigh, ylow, yincr, yhigh, no_axes)
  90.  * float xlow, xincr, xhigh, ylow, yincr, yhigh;
  91.  * int no_axes;
  92.  *    - establish user coordinates
  93.  *    - draw x- and y-axis and tick marks (only if no_axes == 0)
  94.  *
  95.  * void dr_errmsg(s)
  96.  * char *s;
  97.  *    - send string s to error log file
  98.  */
  99.  
  100. int dr_set_ltype();
  101. void dr_goto(), dr_draw_line(), dr_draw_array(), dr_put_mark();
  102. void dr_set_pen(), dr_set_shape(), dr_set_size(), dr_put_text(), dr_set_cset();
  103. int dr_finish();
  104. void dr_start(), dr_area_def();
  105. void dr_xgrid(), dr_ygrid(), dr_draw_circle();
  106. void dr_errmsg(), dr_warnmsg();
  107.  
  108.  
  109. /* The following devices are supported: */
  110. #define HP7475 1        /* hp 7475 plotter */
  111. #define SCREEN 2        /* ega == dtlewis's gl_plot */
  112. #define PLOTLIB 3        /* UNIX plot(3) interface */
  113. #define FIRSTDEV HP7475
  114. #define LASTDEV PLOTLIB
  115. #define INVDEV -1
  116. #define DEVMASK 0xff
  117.  
  118. /* the following are paper size coding */
  119. #define SIZE_A4 0x100
  120. #define SIZE_A3 0x200
  121. #define SIZE_A  0x400
  122. #define SIZE_B  0x800
  123. #define SIZEMASK 0xff00
  124.  
  125. #ifdef PLOT
  126. extern void openpl();
  127. extern void erase();
  128. extern void label();
  129. extern void line();
  130. extern void circle();
  131. extern void arc();
  132. extern void move();
  133. extern void cont();
  134. extern void point();
  135. extern void linemod();
  136. extern void space();
  137. extern void closepl();
  138. #endif
  139.  
  140. #ifdef MSDOS
  141. #define M_PI_2 1.5707963268
  142. #endif
  143.