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 RS_Color & col);
42 void fillTriangle(const Vector & p1, const Vector & p2, const Vector & p3);
43 void drawHandle(const Vector & p, const RS_Color & c, int size = -1);
46 void setPen(const RS_Pen & pen);
47 void setPen(const RS_Color & color);
48 void setPen(int r, int g, int b);
50 void setBrush(const RS_Color & color);
51 void drawPolygon(const QPolygon & p);
57 void setPreviewMode();
59 void setOffset(const Vector & o);
60 void setClipRect(int x, int y, int w, int h);
62 int toScreenX(double x);
63 int toScreenY(double y);
68 * Current drawing mode.
70 RS2::DrawingMode drawingMode;
72 * A fixed offset added to all entities drawn (useful for previews).
78 #endif // __PAINTINTERFACE_H__