Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!huxley!glenn From: glenn@huxley.huxley.bitstream.com (Glenn P. Parker) Newsgroups: comp.windows.interviews Subject: Re: Arcs in Interviews Message-ID: Date: 6 May 91 14:47:21 GMT References: <9105031422.AA14732@applga.aa.cad.slb.com> Sender: glenn@huxley.UUCP Reply-To: (Glenn Parker) Distribution: comp Organization: Bitstream, Inc. Lines: 75 In-reply-to: applga!mcginnis@SHARKEY.CC.UMICH.EDU's message of 3 May 91 14:22:35 GMT In article <9105031422.AA14732@applga.aa.cad.slb.com> applga!mcginnis@SHARKEY.CC.UMICH.EDU (Brian McGinnis) writes: > Does Interviews have an easy way of drawing arcs or has anyone > implemented arcs in intervies. I was able to extend the Painter class (in InterViews 2.6) to handle arcs rather cleanly. That is, I didn't have to modify the base Painter class at all (thanks to the rep classes). The whole thing is small enough that I might as well post it. // Begin ArcPainter.H #include class Canvas; class ArcPainter : public Painter { public: ArcPainter(); ArcPainter(Painter*); ~ArcPainter(); void Arc(Canvas*, Coord cx, Coord cy, unsigned int radius, int angle, int delta); void Arc(Canvas*, Coord left, Coord bottom, Coord right, Coord top, int angle, int delta); }; // End ArcPainter.H // Begin ArcPainter.C #include "ArcPainter.H" #include #include #include #include #include extern "C" { int XDrawArc(Display*, Drawable, GC, int x, int y, unsigned int w, unsigned int h, int a1, int a2); } ArcPainter::ArcPainter() {} ArcPainter::~ArcPainter() {} ArcPainter::ArcPainter(Painter* p) : Painter(p) {} void ArcPainter::Arc(Canvas* c, Coord x, Coord y, unsigned int radius, int angle, int delta) { const int left = x - radius; const int xtop = c->Height() - 1 - (y + radius); const unsigned int width = 2 * radius; const unsigned int height = width; XDrawArc(_world->display(), (Drawable)c->Id(), Rep()->dashgc, left, xtop, width, height, angle, delta); } void ArcPainter::Arc(Canvas* c, Coord left, Coord bottom, Coord right, Coord top, int angle, int delta) { int xtop = c->Height() - 1 - top; XDrawArc(_world->display(), (Drawable)c->Id(), Rep()->dashgc, left, xtop, right - left + 1, top - bottom + 1, angle, delta); } // End ArcPainter.C -- Glenn P. Parker glenn@bitstream.com Bitstream, Inc. uunet!huxley!glenn 215 First Street BIX: parker Cambridge, MA 02142-1270