home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 334_01 / hpgl.trm < prev    next >
Text File  |  1991-02-05  |  3KB  |  142 lines

  1. /* GNUPLOT - hpgl.trm */
  2. /*
  3.  * Copyright (C) 1990   
  4.  *
  5.  * Permission to use, copy, and distribute this software and its
  6.  * documentation for any purpose with or without fee is hereby granted, 
  7.  * provided that the above copyright notice appear in all copies and 
  8.  * that both that copyright notice and this permission notice appear 
  9.  * in supporting documentation.
  10.  *
  11.  * Permission to modify the software is granted, but not the right to
  12.  * distribute the modified code.  Modifications are to be distributed 
  13.  * as patches to released version.
  14.  *  
  15.  * This software  is provided "as is" without express or implied warranty.
  16.  * 
  17.  * This file is included by ../term.c.
  18.  *
  19.  * This terminal driver supports:
  20.  *  hpgl, hp7580b
  21.  *
  22.  * AUTHORS
  23.  *  Colin Kelley, Thomas Williams, Russell Lang
  24.  * 
  25.  * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
  26.  * 
  27.  */
  28.  
  29. #define HPGL_XMAX 15200
  30. #define HPGL_YMAX 10000
  31.  
  32. #define HPGL_XLAST (HPGL_XMAX - 1)
  33. #define HPGL_YLAST (HPGL_XMAX - 1)
  34.  
  35. /* HPGL_VCHAR, HPGL_HCHAR  are not used */
  36. #define HPGL_VCHAR    (HPGL_YMAX/100*32/10) /* 3.2% */
  37. #define HPGL_HCHAR    (HPGL_XMAX/100*12/10) /* 1.2% */
  38. #define HPGL_VTIC    (HPGL_YMAX/70)        
  39. #define HPGL_HTIC    (HPGL_YMAX/70)        
  40.  
  41. int HPGL_ang = 0;
  42.  
  43. HPGL_init()
  44. {
  45. }
  46.  
  47.  
  48. HPGL_graphics()
  49. {
  50.     fputs("\033.Y\n",outfile);
  51. /*           1
  52.     1. enable eavesdropping
  53. */
  54.     fprintf(outfile,
  55.     "IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
  56.         HPGL_XMAX,HPGL_YMAX,
  57.         ((float)(HPGL_HCHAR)*200/3/HPGL_XMAX),
  58.         ((float)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
  59. /*     1    2             3 
  60.     1. reset to power-up defaults
  61.     2. set SCaling
  62.     3. set character size
  63. */
  64.     HPGL_ang = 0;
  65. }
  66.  
  67.  
  68. HPGL_text()
  69. {
  70.     fputs("PU;\nSP0;\n\033.Z\0",outfile);
  71. /*           1    2     3
  72.     1. pen up
  73.     2. park pen
  74.     3. disable eavesdropping
  75. */
  76. }
  77.  
  78.  
  79. HPGL_linetype(linetype)
  80. int linetype;
  81. {
  82. /* allow for 6 pens */
  83.     fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1); 
  84. }
  85.  
  86.  
  87. HP75_linetype(linetype)
  88. int linetype;
  89. {
  90. /* allow for 4 pens */
  91.     fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1); 
  92. }
  93.  
  94.  
  95. /* some early HPGL plotters (e.g. HP7220C) require the
  96.  * Pen Up/Down and Pen (move) Absolute commands to be separate
  97.  */
  98. HPGL_move(x,y)
  99. int x,y;
  100. {
  101.     fprintf(outfile,"PU;PA%d,%d;\n",x,y);
  102. }
  103.  
  104.  
  105. HPGL_vector(x,y)
  106. int x,y;
  107. {
  108.     fprintf(outfile,"PD;PA%d,%d;\n",x,y);
  109. }
  110.  
  111.  
  112. HPGL_put_text(x,y,str)
  113. int x, y;
  114. char *str;
  115. {
  116.     if (HPGL_ang == 1)
  117.         HPGL_move(x + HPGL_VCHAR/4,y);
  118.     else
  119.         HPGL_move(x,y - HPGL_VCHAR/4);
  120.     fprintf(outfile,"LB%s\003\n",str);
  121. }
  122.  
  123.  
  124. int HPGL_text_angle(ang)
  125. int ang;
  126. {
  127.     HPGL_ang = ang;
  128.     if (ang == 1)
  129.         /* vertical */
  130.         fprintf(outfile,"DI0,1;\n");
  131.     else
  132.         /* horizontal */
  133.         fprintf(outfile,"DI1,0;\n");
  134.     return TRUE;
  135. }
  136.  
  137.  
  138. HPGL_reset()
  139. {
  140. }
  141.  
  142.