diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/hpgl2ps/plotps.c |
Initial commit
Diffstat (limited to 'graphics/hpgl2ps/plotps.c')
-rw-r--r-- | graphics/hpgl2ps/plotps.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/graphics/hpgl2ps/plotps.c b/graphics/hpgl2ps/plotps.c new file mode 100644 index 0000000000..9f6db9d20a --- /dev/null +++ b/graphics/hpgl2ps/plotps.c @@ -0,0 +1,64 @@ +#include "defn.h" + +#define MAXDRAWPOINTS 100 + +plotps(type) +char *type; +{ + if (type == MOVE || type == RMOVE) + { + while (SIGNED_NUMERIC) + { + if (type == MOVE) + { + end_draw(); + absX = lastXmove = getval() * XSCALE; + absY = lastYmove = getval() * YSCALE; + } else + if (type == RMOVE) + { + end_draw(); + lastXmove = absX += getval() * XSCALE; + lastYmove = absY += getval() * YSCALE; + } + } + } + else /* Must be a DRAW or RDRAW */ + { + while (SIGNED_NUMERIC) + { + if (dcount++ >= MAXDRAWPOINTS) + { + end_draw(); + printf("newpath\n"); + printf(" %g %g %s\n", absX, absY, MOVE); + DRAW_FLAG = 1; + fprintf(stderr, "Warning exceeded 100 draw points\n"); + } + xval = getval() * XSCALE; + yval = getval() * YSCALE; + if (!DRAW_FLAG) + { + printf("newpath\n"); + printf(" %g %g %s\n", absX, absY, MOVE); + DRAW_FLAG = 1; + } + if (type == RDRAW) + { + absX += xval; + absY += yval; + printf(" %g %g %s\n", xval, yval, RDRAW); + } else + if (type == DRAW) + { + absX = xval; + absY = yval; + printf(" %g %g %s\n", absX, absY, DRAW); + } else + { + fprintf(stderr, "Error: expecting draw command not %s\n", type); + exit(1); + } + } + } +} |