1
/****************************************************************************
3
** This file is part of the LibreCAD project, a 2D CAD program
5
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
6
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
9
** This file may be distributed and/or modified under the terms of the
10
** GNU General Public License version 2 as published by the Free Software
11
** Foundation and appearing in the file gpl-2.0.txt included in the
12
** packaging of this file.
14
** This program is distributed in the hope that it will be useful,
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
** GNU General Public License for more details.
19
** You should have received a copy of the GNU General Public License
20
** along with this program; if not, write to the Free Software
21
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
** This copyright notice MUST APPEAR in all copies of the script!
25
**********************************************************************/
28
#ifndef RS_PAINTERQT_H
29
#define RS_PAINTERQT_H
33
#include "rs_painter.h"
36
* The Qt implementation of a painter. It can draw objects such as
37
* lines or arcs in a widget. All coordinates are screen coordinates
38
* and have nothing to do with the graphic view.
40
class RS_PainterQt: public QPainter, public RS_Painter {
43
RS_PainterQt( QPaintDevice* pd);
44
virtual ~RS_PainterQt();
46
virtual void moveTo(int x, int y);
47
virtual void lineTo(int x, int y);
48
virtual void drawGridPoint(const RS_Vector& p);
49
virtual void drawPoint(const RS_Vector& p);
50
virtual void drawLine(const RS_Vector& p1, const RS_Vector& p2);
51
//virtual void drawRect(const RS_Vector& p1, const RS_Vector& p2);
52
virtual void fillRect ( const QRectF & rectangle, const RS_Color & color );
53
virtual void fillRect ( const QRectF & rectangle, const QBrush & brush );
54
virtual void drawArc(const RS_Vector& cp, double radius,
56
const RS_Vector& p1, const RS_Vector& p2,
59
virtual void drawArc(const RS_Vector& cp, double radius,
62
virtual void drawArcMac(const RS_Vector& cp, double radius,
65
virtual void drawCircle(const RS_Vector&, double radius);
66
virtual void drawEllipse(const RS_Vector& cp,
67
double radius1, double radius2,
71
virtual void drawImg(QImage& img, const RS_Vector& pos,
72
double angle, const RS_Vector& factor,
73
int sx, int sy, int sw, int sh);
74
virtual void drawTextH(int x1, int y1, int x2, int y2,
76
virtual void drawTextV(int x1, int y1, int x2, int y2,
79
virtual void fillRect(int x1, int y1, int w, int h,
82
virtual void fillTriangle(const RS_Vector& p1,
86
virtual void drawPolygon(const QPolygon& a,Qt::FillRule rule=Qt::WindingFill);
87
virtual void drawPath ( const QPainterPath & path );
89
virtual int getWidth();
90
/** get Density per millimeter on screen/print device
91
*@return density per millimeter in pixel/mm
93
virtual double getDpmm();
94
virtual int getHeight();
96
virtual RS_Pen getPen();
97
virtual void setPen(const RS_Pen& pen);
98
virtual void setPen(const RS_Color& color);
99
virtual void setPen(int r, int g, int b);
100
virtual void disablePen();
101
//virtual void setColor(const QColor& color);
102
virtual void setBrush(const RS_Color& color);
104
virtual void setClipRect(int x, int y, int w, int h);
105
virtual void resetClipping();
109
long rememberX; // Used for the moment because QPainter doesn't support moveTo anymore, thus we need to remember ourselve the moveTo positions