home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume8 / gnuplot1.10A / part04 / postscpt.trm < prev    next >
Encoding:
Text File  |  1989-09-09  |  2.0 KB  |  97 lines

  1. /* thanks to richb@yarra.OZ (Rich Burridge) for the Postscript driver */
  2. #define PS_XMAX 540
  3. #define PS_YMAX 720
  4.  
  5. #define PS_XLAST (PS_XMAX - 1)
  6. #define PS_YLAST (PS_YMAX - 1)
  7.  
  8. #define PS_VCHAR (PS_YMAX/30)
  9. #define PS_HCHAR (PS_XMAX/72)
  10. #define PS_VTIC (PS_YMAX/80)
  11. #define PS_HTIC (PS_XMAX/80)
  12.  
  13.  
  14. PS_init()
  15. {
  16.   (void) fprintf(outfile,"%%!\n") ;
  17.   (void) fprintf(outfile,"/off {36 add} def\n") ;
  18.   (void) fprintf(outfile,"/mv {off exch off moveto} def\n") ;
  19.   (void) fprintf(outfile,"/ln {off exch off lineto} def\n") ;
  20.   (void) fprintf(outfile,"/Times-Roman findfont 12 scalefont setfont\n") ;
  21.   (void) fprintf(outfile,"0.25 setlinewidth\n") ;
  22. }
  23.  
  24.  
  25. PS_graphics()
  26. {
  27.   (void) fprintf(outfile,"newpath\n") ;
  28. }
  29.  
  30.  
  31. PS_text()
  32. {
  33.   (void) fprintf(outfile,"stroke\n") ;
  34.   (void) fprintf(outfile,"showpage\n") ;
  35. }
  36.  
  37.  
  38. PS_linetype(linetype)
  39. int linetype ;
  40. {
  41.   (void) fprintf(outfile,"stroke [") ;
  42.   switch ((linetype+2)%7)
  43.     {
  44.       case 0 :                                 /* solid. */
  45.       case 2 : break ;
  46.       case 1 :                                 /* longdashed. */
  47.       case 6 : (void) fprintf(outfile,"9 3") ;
  48.                break ;
  49.       case 3 : (void) fprintf(outfile,"3") ;            /* dotted. */
  50.                break ;
  51.       case 4 : (void) fprintf(outfile,"6 3") ;          /* shortdashed. */
  52.                break ;
  53.       case 5 : (void) fprintf(outfile,"3 3 6 3") ;      /* dotdashed. */
  54.     }
  55.   (void) fprintf(outfile,"] 0 setdash\n") ;
  56. }
  57.  
  58.  
  59. PS_move(x,y)
  60. unsigned int x,y ;
  61. {
  62.   (void) fprintf(outfile,"%1d %1d mv\n",y,x) ;
  63. }
  64.  
  65.  
  66. PS_vector(x,y)
  67. unsigned int x,y ;
  68. {
  69.   (void) fprintf(outfile,"%1d %1d ln\n",y,x) ;
  70. }
  71.  
  72.  
  73. PS_lrput_text(row,str)
  74. unsigned int row ;
  75. char str[] ;
  76. {
  77.   PS_move(PS_XMAX - PS_HTIC - PS_HCHAR*(strlen(str)+1),
  78.           PS_VTIC + PS_VCHAR*(row+1)) ;
  79.   (void) fprintf(outfile,"(%s) show\n",str) ;
  80. }
  81.  
  82.  
  83. PS_ulput_text(row,str)
  84. unsigned int row ;
  85. char str[] ;
  86. {
  87.   PS_move(PS_HTIC, PS_YMAX - PS_VTIC - PS_VCHAR*(row+1)) ;
  88.   (void) fprintf(outfile,"(%s) show\n",str) ;
  89. }
  90.  
  91.  
  92. PS_reset()
  93. {
  94. }
  95.  
  96.  
  97.