summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-03-12 20:12:43 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-03-12 20:12:43 (GMT)
commitaabb922a6082ccc5253e8206c5d15ec0073a1063 (patch)
treeb089110c99acede52852a676eb0a90093a834749
parent75a3a39ed8f422f44c1d969e8f96eecedebb3a5a (diff)
downloadblt-aabb922a6082ccc5253e8206c5d15ec0073a1063.zip
blt-aabb922a6082ccc5253e8206c5d15ec0073a1063.tar.gz
blt-aabb922a6082ccc5253e8206c5d15ec0073a1063.tar.bz2
add fill option ellipse
-rw-r--r--tksao/frame/ellipse.C65
-rw-r--r--tksao/frame/ellipse.h4
2 files changed, 69 insertions, 0 deletions
diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C
index e67b550..cc75ef8 100644
--- a/tksao/frame/ellipse.C
+++ b/tksao/frame/ellipse.C
@@ -41,6 +41,71 @@ Ellipse::Ellipse(Base* p, const Vector& ctr,
updateBBox();
}
+void Ellipse::renderXCircleDraw(Drawable drawable, GC lgc,
+ Vector& st, Vector& size,
+ int a1, int aa)
+{
+ if (fill_)
+ XFillArc(display, drawable, lgc, st[0], st[1], size[0], size[1], a1, aa);
+ else
+ XDrawArc(display, drawable, lgc, st[0], st[1], size[0], size[1], a1, aa);
+}
+
+void Ellipse::renderPSCircleDraw(Vector& cc, double l, float a1, float a2)
+{
+ ostringstream str;
+ if (fill_)
+ str << "newpath "
+ << cc.TkCanvasPs(parent->canvas) << ' '
+ << l << ' '
+ << a1 << ' ' << a2 << ' '
+ << "arc fill" << endl << ends;
+ else
+ str << "newpath "
+ << cc.TkCanvasPs(parent->canvas) << ' '
+ << l << ' '
+ << a1 << ' ' << a2 << ' '
+ << "arc stroke" << endl << ends;
+
+ Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
+}
+
+void Ellipse::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1,
+ Vector& xx2, Vector& tt1)
+{
+ ostringstream str;
+ if (fill_) {
+ Vector cc = parent->mapFromRef(center,Coord::CANVAS);
+
+ str << "newpath "
+ << tt0.TkCanvasPs(parent->canvas) << ' '
+ << "moveto "
+ << xx1.TkCanvasPs(parent->canvas) << ' '
+ << xx2.TkCanvasPs(parent->canvas) << ' '
+ << tt1.TkCanvasPs(parent->canvas) << ' '
+ << "curveto fill" << endl
+ << "newpath "
+ << cc.TkCanvasPs(parent->canvas) << ' '
+ << "moveto "
+ << tt0.TkCanvasPs(parent->canvas) << ' '
+ << "lineto "
+ << tt1.TkCanvasPs(parent->canvas) << ' '
+ << "lineto closepath gsave" << endl
+ << "1 setlinejoin .5 setlinewidth stroke" << endl
+ << "grestore fill" << endl << ends;
+ }
+ else
+ str << "newpath "
+ << 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 Ellipse::edit(const Vector& v, int h)
{
Matrix mm = bckMatrix();
diff --git a/tksao/frame/ellipse.h b/tksao/frame/ellipse.h
index 5a81c2e..27d6184 100644
--- a/tksao/frame/ellipse.h
+++ b/tksao/frame/ellipse.h
@@ -10,6 +10,10 @@
class Ellipse : public BaseEllipse, public BaseFill {
protected:
+ void renderXCircleDraw(Drawable, GC, Vector&, Vector&, int, int);
+ void renderPSCircleDraw(Vector& cc, double l, float a1, float a2);
+ void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+
void listNonCel(FitsImage*, ostream&, Coord::CoordSystem);
public: