1 // paintintf.h: Qt Painter interface
4 // (C) 2010 Underground Software
6 #ifndef __PAINTINTF_H__
7 #define __PAINTINTF_H__
15 // This is an interface class to the rest of the RS_* functions that are supposed
16 // to be toolkit independent, but, because the author of QCad had no idea how to
17 // do that cleanly, we have the present clusterfuck of disaster and failure that
18 // is RS_Painter & friends. This class proposes to fix that.
20 // The QPainter passed in is only used, never created. Once this class finishes,
21 // it does *nothing* to the QPainter passed in. But this class *MUST^ pass a valid
22 // one in, or else nothing happens.
26 PaintInterface(QPainter * p);
28 void setDrawingMode(RS2::DrawingMode m);
29 RS2::DrawingMode getDrawingMode();
30 void drawGridPoint(const Vector & p);
31 void drawPoint(const Vector & p);
32 void drawLine(const Vector & p1, const Vector & p2);
33 void drawRect(const Vector & p1, const Vector & p2);
34 void drawArc(const Vector & cp, double radius, double a1, double a2,
35 const Vector & p1, const Vector & p2, bool reversed);
36 void drawArc(const Vector & cp, double radius,
37 double a1, double a2, bool reversed);
38 void drawArcMac(const Vector & cp, double radius, double a1, double a2, bool reversed);
39 void createArc(QPolygon & pa, const Vector & cp, double radius,
40 double a1, double a2, bool reversed);
41 void drawCircle(const Vector & cp, double radius);
42 void drawEllipse(const Vector & cp, double radius1, double radius2,
43 double angle, double angle1, double angle2, bool reversed);
44 void drawImg(QImage & img, const Vector & pos,
45 double angle, const Vector & factor, int sx, int sy, int sw, int sh);
46 void fillRect(int x1, int y1, int w, int h, const RS_Color & col);
47 void fillTriangle(const Vector & p1, const Vector & p2, const Vector & p3);
48 void drawHandle(const Vector & p, const RS_Color & c, int size = -1);
51 void setPen(const RS_Pen & pen);
52 void setPen(const RS_Color & color);
53 void setPen(int r, int g, int b);
55 void setBrush(const RS_Color & color);
56 void drawPolygon(const QPolygon & p);
62 void setPreviewMode();
64 void setOffset(const Vector & o);
65 void setClipRect(int x, int y, int w, int h);
67 int toScreenX(double x);
68 int toScreenY(double y);
73 * Current drawing mode.
75 RS2::DrawingMode drawingMode;
77 * A fixed offset added to all entities drawn (useful for previews).
83 #endif // __PAINTINTF_H__