diff options
author | joye <joye> | 2014-05-30 21:31:04 (GMT) |
---|---|---|
committer | joye <joye> | 2014-05-30 21:31:04 (GMT) |
commit | f8a01906e319c1d68d96f6bf20510cf771f6e7e3 (patch) | |
tree | 8014823bb5d7c11452240f645ca317ffbe6dbf87 | |
parent | b4e1bb34955d01729ee9e29bae532c06b71b1afa (diff) | |
download | blt-f8a01906e319c1d68d96f6bf20510cf771f6e7e3.zip blt-f8a01906e319c1d68d96f6bf20510cf771f6e7e3.tar.gz blt-f8a01906e319c1d68d96f6bf20510cf771f6e7e3.tar.bz2 |
*** empty log message ***
-rw-r--r-- | src/bltGrElemLine.C | 6 | ||||
-rw-r--r-- | src/bltGrMarkerPolygon.C | 2 | ||||
-rw-r--r-- | src/bltGrPSOutput.C | 60 | ||||
-rw-r--r-- | src/bltGrPSOutput.h | 9 | ||||
-rw-r--r-- | src/bltGraph.C | 25 | ||||
-rw-r--r-- | src/bltGraph.h | 14 |
6 files changed, 37 insertions, 79 deletions
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index ba0bd68..7425f97 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -668,7 +668,7 @@ void LineElement::print(Blt_Ps ps) if (fillPts_) { // Create a path to use for both the polygon and its outline Blt_Ps_Append(ps, "% start fill area\n"); - Blt_Ps_Polyline(ps, fillPts_, nFillPts_); + graphPtr_->printPolyline(ps, fillPts_, nFillPts_); // If the background fill color was specified, draw the polygon in a // solid fashion with that color @@ -2768,8 +2768,8 @@ void LineElement::printTraces(Blt_Ps ps, LinePen* penPtr) bltTrace *tracePtr = (bltTrace*)Blt_Chain_GetValue(link); if (tracePtr->screenPts.length > 0) { Blt_Ps_Append(ps, "% start trace\n"); - Blt_Ps_DrawPolyline(ps, tracePtr->screenPts.points, - tracePtr->screenPts.length); + graphPtr_->printMaxPolyline(ps, tracePtr->screenPts.points, + tracePtr->screenPts.length); Blt_Ps_Append(ps, "% end trace\n"); } } diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C index c8e614e..326e2f2 100644 --- a/src/bltGrMarkerPolygon.C +++ b/src/bltGrMarkerPolygon.C @@ -335,7 +335,7 @@ void PolygonMarker::print(Blt_Ps ps) PolygonMarkerOptions* ops = (PolygonMarkerOptions*)ops_; if (ops->fill) { - Blt_Ps_Polyline(ps, fillPts_, nFillPts_); + graphPtr_->printPolyline(ps, fillPts_, nFillPts_); if (ops->fillBg) { Blt_Ps_XSetBackground(ps, ops->fillBg); Blt_Ps_Append(ps, "gsave fill grestore\n"); diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C index aff7749..4548a61 100644 --- a/src/bltGrPSOutput.C +++ b/src/bltGrPSOutput.C @@ -47,9 +47,6 @@ using namespace Blt; # define HAVE_UTF 0 #endif -#define PS_MAXPATH 1500 /* Maximum number of components in a - * PostScript (level 1) path. */ - static Tcl_Interp *psInterp = NULL; int Blt_Ps_ComputeBoundingBox(PageSetup *setupPtr, int width, int height) @@ -420,18 +417,6 @@ void Blt_Ps_PolylineFromXPoints(Blt_Ps ps, XPoint *points, int n) } } -void Blt_Ps_Polyline(Blt_Ps ps, Point2d *screenPts, int nScreenPts) -{ - Point2d *pp, *pend; - - pp = screenPts; - Blt_Ps_Append(ps, "newpath\n"); - Blt_Ps_Format(ps, " %g %g moveto\n", pp->x, pp->y); - for (pp++, pend = screenPts + nScreenPts; pp < pend; pp++) { - Blt_Ps_Format(ps, " %g %g lineto\n", pp->x, pp->y); - } -} - void Blt_Ps_Polygon(Blt_Ps ps, Point2d *screenPts, int nScreenPts) { Point2d *pp, *pend; @@ -452,17 +437,6 @@ void Blt_Ps_XFillPolygon(Blt_Ps ps, Point2d *screenPts, int nScreenPts) Blt_Ps_Append(ps, "fill\n"); } -void Blt_Ps_XDrawSegments(Blt_Ps ps, XSegment *segments, int nSegments) -{ - XSegment *sp, *send; - - for (sp = segments, send = sp + nSegments; sp < send; sp++) { - Blt_Ps_Format(ps, "%d %d moveto %d %d lineto\n", sp->x1, sp->y1, - sp->x2, sp->y2); - Blt_Ps_Append(ps, "DashesProc stroke\n"); - } -} - void Blt_Ps_XFillRectangles(Blt_Ps ps, XRectangle *rectangles, int nRectangles) { XRectangle *rp, *rend; @@ -724,40 +698,6 @@ void Blt_Ps_DrawText(Blt_Ps ps, const char *string, double x, double y) } #endif -void Blt_Ps_XDrawLines(Blt_Ps ps, XPoint *points, int n) -{ - int nLeft; - - if (n <= 0) { - return; - } - for (nLeft = n; nLeft > 0; nLeft -= PS_MAXPATH) { - int length; - - length = MIN(PS_MAXPATH, nLeft); - Blt_Ps_PolylineFromXPoints(ps, points, length); - Blt_Ps_Append(ps, "DashesProc stroke\n"); - points += length; - } -} - -void Blt_Ps_DrawPolyline(Blt_Ps ps, Point2d *points, int nPoints) -{ - int nLeft; - - if (nPoints <= 0) { - return; - } - for (nLeft = nPoints; nLeft > 0; nLeft -= PS_MAXPATH) { - int length; - - length = MIN(PS_MAXPATH, nLeft); - Blt_Ps_Polyline(ps, points, length); - Blt_Ps_Append(ps, "DashesProc stroke\n"); - points += length; - } -} - void Blt_Ps_DrawBitmap( Blt_Ps ps, Display *display, diff --git a/src/bltGrPSOutput.h b/src/bltGrPSOutput.h index 422faa2..156b14d 100644 --- a/src/bltGrPSOutput.h +++ b/src/bltGrPSOutput.h @@ -91,15 +91,6 @@ extern void Blt_Ps_XSetLineAttributes(Blt_Ps ps, XColor* colorPtr, extern void Blt_Ps_XSetStipple(Blt_Ps ps, Display *display, Pixmap bitmap); -extern void Blt_Ps_Polyline(Blt_Ps ps, Point2d *screenPts, int nScreenPts); - -extern void Blt_Ps_XDrawLines(Blt_Ps ps, XPoint *points, int n); - -extern void Blt_Ps_XDrawSegments(Blt_Ps ps, XSegment *segments, - int nSegments); - -extern void Blt_Ps_DrawPolyline(Blt_Ps ps, Point2d *points, int n); - extern void Blt_Ps_Draw3DRectangle(Blt_Ps ps, Tk_3DBorder border, double x, double y, int width, int height, int borderWidth, int relief); diff --git a/src/bltGraph.C b/src/bltGraph.C index ab4eae0..e5fae53 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -1423,6 +1423,31 @@ void Graph::drawSegments(Drawable drawable, GC gc, delete [] xsegments; } +void Graph::printPolyline(Blt_Ps ps, Point2d* screenPts, int nScreenPts) +{ + Point2d *pp, *pend; + + pp = screenPts; + Blt_Ps_Append(ps, "newpath\n"); + Blt_Ps_Format(ps, " %g %g moveto\n", pp->x, pp->y); + for (pp++, pend = screenPts + nScreenPts; pp < pend; pp++) { + Blt_Ps_Format(ps, " %g %g lineto\n", pp->x, pp->y); + } +} + +void Graph::printMaxPolyline(Blt_Ps ps, Point2d* points, int nPoints) +{ + if (nPoints <= 0) + return; + + for (int nLeft = nPoints; nLeft > 0; nLeft -= 1500) { + int length = MIN(1500, nLeft); + printPolyline(ps, points, length); + Blt_Ps_Append(ps, "DashesProc stroke\n"); + points += length; + } +} + void Graph::printSegments(Blt_Ps ps, Segment2d* segments, int nSegments) { Segment2d* sp; diff --git a/src/bltGraph.h b/src/bltGraph.h index c2bcf11..a63f796 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -247,18 +247,20 @@ class Graph { virtual int createPen(const char*, int, Tcl_Obj* const []) =0; int getPen(Tcl_Obj*, Pen**); - void drawSegments(Drawable, GC, Segment2d*, int); - void printSegments(Blt_Ps, Segment2d*, int); - - GC getPrivateGC(unsigned long, XGCValues*); - void freePrivateGC(GC); - void getTextExtents(Tk_Font, const char*, int, int*, int*); void getBoundingBox(int, int, float, double*, double*, Point2d*); Point2d anchorPoint(double, double, double, double, Tk_Anchor); const char** getTags(ClientData, ClassId, int*); ClientData pickEntry(int, int, ClassId*); + + void drawSegments(Drawable, GC, Segment2d*, int); + void printSegments(Blt_Ps, Segment2d*, int); + void printPolyline(Blt_Ps, Point2d*, int); + void printMaxPolyline(Blt_Ps, Point2d*, int); + + GC getPrivateGC(unsigned long, XGCValues*); + void freePrivateGC(GC); }; #endif |