66ee7c172964fe9665479973fa7c7536afe03fa2 kate Tue Apr 10 22:05:33 2018 -0700 Add Postscript for bezier curve. Fix ellipse. refs #21109 diff --git src/lib/psGfx.c src/lib/psGfx.c index 5765411..d96b342 100644 --- src/lib/psGfx.c +++ src/lib/psGfx.c @@ -356,37 +356,51 @@ fprintf(f, "closepath\n"); fprintf(f, "stroke\n"); } } void psDrawEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad, double startAngle, double endAngle) /* Draw ellipse. Args are center point x and y, horizontal radius, vertical radius, start and end angles (e.g. 0 and 180 to draw top half, 180 and 360 for bottom) */ { FILE *f = ps->f; fprintf(f, "newpath\n"); psXyOut(ps, x, y); psWhOut(ps, xrad, yrad); -//warn("ellipse: x=%d, y=%d, xrad=%d, yrad=%d. ", (int)x, (int)y, (int)xrad, (int)yrad); psFloatOut(f, startAngle); psFloatOut(f, endAngle); fprintf(f, "ellipse\n"); fprintf(f, "stroke\n"); } +void psDrawCurve(struct psGfx *ps, double x1, double y1, double x2, double y2, + double x3, double y3, double x4, double y4) +/* Draw Bezier curve specified by 4 points: first (p1) and last (p4) + * and 2 control points (p2, p3) */ +{ +FILE *f = ps->f; +psXyOut(ps, x1, y1); +fprintf(f, "moveto\n"); +psXyOut(ps, x2, y2); +psXyOut(ps, x3, y3); +psXyOut(ps, x4, y4); +fprintf(f, "curveto\n"); +fprintf(f, "stroke\n"); +} + void psSetDash(struct psGfx *ps, boolean on) /* Set dashed line mode on or off. If set on, show two points marked, with one point of space */ { FILE *f = ps->f; if (on) fprintf(f, "[2 1] 0 setdash\n"); else fprintf(f, "[] 0 setdash\n"); } char * convertEpsToPdf(char *epsFile) /* Convert EPS to PDF and return filename, or NULL if failure. */ { char *pdfTmpName = NULL, *pdfName=NULL; char cmdBuffer[2048];