home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / src / plhrsh.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-27  |  964 b   |  49 lines

  1. /* Writes the Hershey symbol "ch" centred at the physical */
  2. /* coordinate (x,y) */
  3.  
  4. #include "plplot.h"
  5.  
  6. void plhrsh(ch,x,y)
  7. PLINT ch, x, y;
  8. {
  9.    PLINT cx, cy, k, penup;
  10.    SCHAR *xygrid;
  11.    PLFLT symdef, symht, scale, xscale, yscale, xpmm, ypmm;
  12.  
  13.    gsym(&symdef,&symht);
  14.    gpixmm(&xpmm,&ypmm);
  15.    penup = 1;
  16.    scale = 0.05 * symht;
  17.  
  18.    if (!plcvec(ch,&xygrid)) {
  19.      movphy(x,y);
  20.      return;
  21.    }
  22.  
  23.    /* Compute how many physical pixels correspond to a character pixel */
  24.  
  25.    xscale = scale * xpmm;
  26.    yscale = scale * ypmm;
  27.  
  28.    k = 4;
  29.    for(;;) {
  30.       cx = xygrid[k++];
  31.       cy = xygrid[k++];
  32.       if (cx == 64 && cy == 64) {
  33.          movphy(x,y);
  34.          return;
  35.       }
  36.       else if (cx == 64 && cy == 0)
  37.          penup = 1;
  38.       else  {
  39.          if (penup != 0) {
  40.             movphy(round(x+xscale*cx),round(y+yscale*cy));
  41.             penup = 0;
  42.          }
  43.          else
  44.             draphy(round(x+xscale*cx),round(y+yscale*cy));
  45.       }
  46.    }
  47. }
  48.  
  49.