diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-03-19 19:10:59 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-03-19 19:10:59 (GMT) |
commit | f689813804f73c179e5053b2fc9d4dd4cf621bb4 (patch) | |
tree | 41738b04a41fac5c9b44c6fa3efeb0428ce212ae /tksao | |
parent | e04b80382f90d1b31a27c92693fdf1110ce91822 (diff) | |
download | blt-f689813804f73c179e5053b2fc9d4dd4cf621bb4.zip blt-f689813804f73c179e5053b2fc9d4dd4cf621bb4.tar.gz blt-f689813804f73c179e5053b2fc9d4dd4cf621bb4.tar.bz2 |
clean up ps code supporting fill
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/baseellipse.C | 55 | ||||
-rw-r--r-- | tksao/frame/baseellipse.h | 4 | ||||
-rw-r--r-- | tksao/frame/circle.C | 7 | ||||
-rw-r--r-- | tksao/frame/circle.h | 2 | ||||
-rw-r--r-- | tksao/frame/ellipse.C | 7 | ||||
-rw-r--r-- | tksao/frame/ellipse.h | 2 |
6 files changed, 32 insertions, 45 deletions
diff --git a/tksao/frame/baseellipse.C b/tksao/frame/baseellipse.C index 8e6166f..e99d120 100644 --- a/tksao/frame/baseellipse.C +++ b/tksao/frame/baseellipse.C @@ -419,6 +419,10 @@ void BaseEllipse::renderPSEllipse(int mode) a2 += M_TWOPI; for (int ii=0; ii<numAnnuli_; ii++) { + ostringstream str; + str << "newpath" << endl << ends; + Tcl_AppendResult(parent->interp, str.str().c_str(), NULL); + Vector r = annuli_[ii]; int s1 =0; @@ -437,9 +441,25 @@ void BaseEllipse::renderPSEllipse(int mode) if (s1&&s2) s1=s2=0; } + + renderPSEllipseDraw(); } } +void BaseEllipse::renderPSEllipseDraw() +{ + ostringstream str; + str << "stroke" << endl << ends; + Tcl_AppendResult(parent->interp, str.str().c_str(), NULL); +} + +void BaseEllipse::renderPSEllipseFillDraw() +{ + ostringstream str; + str << "fill" << endl << ends; + Tcl_AppendResult(parent->interp, str.str().c_str(), NULL); +} + void BaseEllipse::renderPSEllipsePrep(double a1, double a2, double b1, double b2, Vector& rr) @@ -483,44 +503,13 @@ void BaseEllipse::renderPSEllipseArc(double a1, double a2, Vector& rr) Vector xx2 = fwdMap(x2*FlipY(),Coord::CANVAS); Vector tt1 = fwdMap(t1*FlipY(),Coord::CANVAS); - renderPSEllipseArcDraw(tt0, xx1, xx2, tt1); -} - -void BaseEllipse::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1, - Vector& xx2, Vector& tt1) -{ ostringstream str; - str << "newpath " - << tt0.TkCanvasPs(parent->canvas) << ' ' + str << tt0.TkCanvasPs(parent->canvas) << ' ' << "moveto " << xx1.TkCanvasPs(parent->canvas) << ' ' << xx2.TkCanvasPs(parent->canvas) << ' ' << tt1.TkCanvasPs(parent->canvas) << ' ' - << "curveto stroke" << endl << ends; - Tcl_AppendResult(parent->interp, str.str().c_str(), NULL); -} - -void BaseEllipse::renderPSEllipseArcFillDraw(Vector& tt0, Vector& xx1, - Vector& xx2, Vector& tt1) -{ - Vector cc = parent->mapFromRef(center,Coord::CANVAS); - ostringstream str; - str << "newpath " - << tt0.TkCanvasPs(parent->getCanvas()) << ' ' - << "moveto " - << xx1.TkCanvasPs(parent->getCanvas()) << ' ' - << xx2.TkCanvasPs(parent->getCanvas()) << ' ' - << tt1.TkCanvasPs(parent->getCanvas()) << ' ' - << "curveto fill" << endl - << "newpath " - << cc.TkCanvasPs(parent->getCanvas()) << ' ' - << "moveto " - << tt0.TkCanvasPs(parent->getCanvas()) << ' ' - << "lineto " - << tt1.TkCanvasPs(parent->getCanvas()) << ' ' - << "lineto closepath gsave" << endl - << "1 setlinejoin 1 setlinewidth stroke" << endl - << "grestore fill" << endl << ends; + << "curveto" << endl << ends; Tcl_AppendResult(parent->interp, str.str().c_str(), NULL); } diff --git a/tksao/frame/baseellipse.h b/tksao/frame/baseellipse.h index f4794b4..ec97144 100644 --- a/tksao/frame/baseellipse.h +++ b/tksao/frame/baseellipse.h @@ -58,8 +58,8 @@ class BaseEllipse : public BaseMarker { void renderPS(int); virtual void renderPSCircleDraw(Vector& cc, double l, float a1, float a2); void renderPSCircleFillDraw(Vector& cc, double l, float a1, float a2); - virtual void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&); - void renderPSEllipseArcFillDraw(Vector&, Vector&, Vector&, Vector&); + virtual void renderPSEllipseDraw(); + void renderPSEllipseFillDraw(); #ifdef MAC_OSX_TK void renderMACOSX(); diff --git a/tksao/frame/circle.C b/tksao/frame/circle.C index f3f08c9..4e111c1 100644 --- a/tksao/frame/circle.C +++ b/tksao/frame/circle.C @@ -86,13 +86,12 @@ void Circle::renderPSCircleDraw(Vector& cc, double l, float a1, float a2) BaseEllipse::renderPSCircleDraw(cc, l, a1, a2); } -void Circle::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1, - Vector& xx2, Vector& tt1) +void Circle::renderPSEllipseDraw() { if (fill_) - BaseEllipse::renderPSEllipseArcFillDraw(tt0, xx1, xx2, tt1); + BaseEllipse::renderPSEllipseFillDraw(); else - BaseEllipse::renderPSEllipseArcDraw(tt0, xx1, xx2, tt1); + BaseEllipse::renderPSEllipseDraw(); } #ifdef MAC_OSX_TK diff --git a/tksao/frame/circle.h b/tksao/frame/circle.h index ac856b7..2ce4e2b 100644 --- a/tksao/frame/circle.h +++ b/tksao/frame/circle.h @@ -16,7 +16,7 @@ class Circle : public BaseEllipse { void renderXEllipseDraw(Drawable, GC); void renderPSCircleDraw(Vector& cc, double l, float a1, float a2); - void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&); + void renderPSEllipseDraw(); #ifdef MAC_OSX_TK void renderMACOSXCircleDraw(Vector&, double, float, float); diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C index 6dbedb7..55bdc78 100644 --- a/tksao/frame/ellipse.C +++ b/tksao/frame/ellipse.C @@ -74,13 +74,12 @@ void Ellipse::renderPSCircleDraw(Vector& cc, double l, float a1, float a2) BaseEllipse::renderPSCircleDraw(cc, l, a1, a2); } -void Ellipse::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1, - Vector& xx2, Vector& tt1) +void Ellipse::renderPSEllipseDraw() { if (fill_) - BaseEllipse::renderPSEllipseArcFillDraw(tt0, xx1, xx2, tt1); + BaseEllipse::renderPSEllipseFillDraw(); else - BaseEllipse::renderPSEllipseArcDraw(tt0, xx1, xx2, tt1); + BaseEllipse::renderPSEllipseDraw(); } #ifdef MAC_OSX_TK diff --git a/tksao/frame/ellipse.h b/tksao/frame/ellipse.h index 8fe00d6..3390e55 100644 --- a/tksao/frame/ellipse.h +++ b/tksao/frame/ellipse.h @@ -16,7 +16,7 @@ class Ellipse : public BaseEllipse { void renderXEllipseDraw(Drawable, GC); void renderPSCircleDraw(Vector& cc, double l, float a1, float a2); - void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&); + void renderPSEllipseDraw(); #ifdef MAC_OSX_TK void renderMACOSXCircleDraw(Vector&, double, float, float); |