ET++: Public Port Drawing Primitives

Port uses the Bridge pattern to separate the implementation of its drawing primitives from their interface. The methods below are part of the public interface to Port. These methods provide basic pen and line operations, such as support for drawing straight lines, drawing oval outlines, and changing the current Ink color. This is only a small part of the public interface to Port-- there are dozens of additional methods which provide for text, clipping, and other operations. For an example of the implementation of these methods, see Port::StrokeLine().


class Port : public Object {

	[ ... ]

	//---- Pen and Lines
	void SetPenNormal();
	void SetPenInk(Ink *p)
		{ penink= p; }
	Ink *GetPenInk()
		{ return penink; }
	void SetLineCap(GrLineCap lc)
		{ pencap= lc; }
	void SetPenSize(int w)
		{ pensize= w; }
	void Moveto(const Point &p)
		{ penpos= p; }
	void Moveby(const Point &p)
		{ penpos+= p; }

	void StrokeLine(Ink*, int, GrLineCap, const Point&, const Point&);
	void Line(const Point &p1, const Point &p2)
		{ StrokeLine(penink, pensize, pencap, p1, p2); }
	void PaintLine(Ink *ink, GrLineCap cap, const Point &p1, const Point &p2)
		{ StrokeLine(ink, pensize, cap, p1, p2); }
	void Lineto(const Point &p)
		{ StrokeLine(penink, pensize, pencap, penpos, p); penpos= p; }

	void StrokeRect(Ink*, int, const Rectangle &r);
	void StrokeOval(Ink*, int, const Rectangle &);
	void StrokeRRect(Ink*, int, const Rectangle &r, const Point &corner);
	void StrokeWedge(Ink*, int, GrLineCap, const Rectangle &r, int, int);
	void StrokePolygon(const Point &at, Ink*, Point*, int, GrPolyType, int, GrLineCap);
}

Back to the graphical layout description

Back to the main ET++ page