31059016e90d9d6d65e11f55808869efacb8d4e2 kate Tue Apr 10 18:16:17 2018 -0700 Add postscript for ellipse drawing. refs #21109 diff --git src/lib/psGfx.c src/lib/psGfx.c index c0522eb..5765411 100644 --- src/lib/psGfx.c +++ src/lib/psGfx.c @@ -346,58 +346,57 @@ psLineTo(ps, p->x, p->y); if (p == poly->ptList) break; } if (filled) { fprintf(f, "fill\n"); } else { fprintf(f, "closepath\n"); fprintf(f, "stroke\n"); } } - -void psFillEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad) -{ -FILE *f = ps->f; -fprintf(f, "newpath\n"); -psXyOut(ps, x, y); -psWhOut(ps, xrad, yrad); -psFloatOut(f, 0.0); -psFloatOut(f, 360.0); -fprintf(f, "ellipse\n"); -fprintf(f, "closepath\n"); -fprintf(f, "fill\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, "closepath\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]; int sysVal = 0; struct lineFile *lf = NULL; char *line; int lineSize=0; float width=0, height=0; pdfTmpName = cloneString(epsFile); /* Get the dimensions of bounding box. */ lf = lineFileOpen(epsFile, TRUE); while(lineFileNext(lf, &line, &lineSize))