1 #ifndef ____PAINTINTERFACE_H____
2 #define ____PAINTINTERFACE_H____
10 // This is an interface class to the rest of the RS_* functions that are supposed
11 // to be toolkit independent, but, because the author of QCad had no idea how to
12 // do that cleanly, we have the present clusterfuck of disaster and failure that
13 // is RS_Painter & friends. This class proposes to fix that.
15 // The QPainter passed in is only used, never created. Once this class finishes,
16 // it does *nothing* to the QPainter passed in. But this class *MUST^ pass a valid
17 // one in, or else nothing happens.
21 PaintInterface(QPainter * p);
23 void setDrawingMode(RS2::DrawingMode m);
24 RS2::DrawingMode getDrawingMode();
25 void drawGridPoint(const Vector & p);
26 void drawPoint(const Vector & p);
27 void drawLine(const Vector & p1, const Vector & p2);
28 void drawRect(const Vector & p1, const Vector & p2);
29 void drawArc(const Vector & cp, double radius, double a1, double a2,
30 const Vector & p1, const Vector & p2, bool reversed);
31 void drawArc(const Vector & cp, double radius,
32 double a1, double a2, bool reversed);
33 void drawArcMac(const Vector & cp, double radius, double a1, double a2, bool reversed);
34 void createArc(QPolygon & pa, const Vector & cp, double radius,
35 double a1, double a2, bool reversed);
36 void drawCircle(const Vector & cp, double radius);
37 void drawEllipse(const Vector & cp, double radius1, double radius2,
38 double angle, double angle1, double angle2, bool reversed);
39 void drawImg(QImage & img, const Vector & pos,
40 double angle, const Vector & factor, int sx, int sy, int sw, int sh);
41 void fillRect(int x1, int y1, int w, int h, const Color & col);
42 void fillTriangle(const Vector & p1, const Vector & p2, const Vector & p3);
43 void drawHandle(const Vector & p, const Color & c, int size = -1);
46 void setPen(const Pen & pen);
47 void setPen(const Color & color);
48 void setPen(int r, int g, int b);
50 void setBrush(const Color & color);
52 void drawPolygon(const QPolygon & p);
58 void setPreviewMode();
60 void setOffset(const Vector & o);
61 void setClipRect(int x, int y, int w, int h);
63 int toScreenX(double x);
64 int toScreenY(double y);
69 * Current drawing mode.
71 RS2::DrawingMode drawingMode;
73 * A fixed offset added to all entities drawn (useful for previews).
79 #endif // __PAINTINTERFACE_H____