OSDN Git Service

drop support for static text [ci reset]
[kde/Katie.git] / src / gui / painting / qpaintengineex_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivailo Monev
5 **
6 ** This file is part of the QtGui module of the Katie Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 **
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file.  Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** $QT_END_LICENSE$
19 **
20 ****************************************************************************/
21
22 #ifndef QPAINTENGINEEX_P_H
23 #define QPAINTENGINEEX_P_H
24
25 //
26 //  W A R N I N G
27 //  -------------
28 //
29 // This file is not part of the Katie API.  It exists purely as an
30 // implementation detail.  This header file may change from version to
31 // version without notice, or even be removed.
32 //
33 // We mean it.
34 //
35
36 #include <QtGui/qpaintengine.h>
37
38 #include "qpaintengine_p.h"
39 #include "qstroker_p.h"
40 #include "qpainter_p.h"
41 #include "qvectorpath_p.h"
42
43
44
45 QT_BEGIN_NAMESPACE
46
47
48 class QPainterState;
49 class QPaintEngineExPrivate;
50 struct StrokeHandler;
51
52 class QRectVectorPath : public QVectorPath {
53 public:
54     inline void set(const QRect &r) {
55         qreal left = r.x();
56         qreal right = r.x() + r.width();
57         qreal top = r.y();
58         qreal bottom = r.y() + r.height();
59         pts[0] = left;
60         pts[1] = top;
61         pts[2] = right;
62         pts[3] = top;
63         pts[4] = right;
64         pts[5] = bottom;
65         pts[6] = left;
66         pts[7] = bottom;
67     }
68
69     inline void set(const QRectF &r) {
70         qreal left = r.x();
71         qreal right = r.x() + r.width();
72         qreal top = r.y();
73         qreal bottom = r.y() + r.height();
74         pts[0] = left;
75         pts[1] = top;
76         pts[2] = right;
77         pts[3] = top;
78         pts[4] = right;
79         pts[5] = bottom;
80         pts[6] = left;
81         pts[7] = bottom;
82     }
83     inline QRectVectorPath(const QRect &r)
84         : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
85     {
86         set(r);
87     }
88     inline QRectVectorPath(const QRectF &r)
89         : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
90     {
91         set(r);
92     }
93     inline QRectVectorPath()
94         : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
95     { }
96
97     qreal pts[8];
98 };
99
100 #ifndef QT_NO_DEBUG_STREAM
101 QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path);
102 #endif
103
104 class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine
105 {
106     Q_DECLARE_PRIVATE(QPaintEngineEx)
107 public:
108     QPaintEngineEx();
109
110     virtual QPainterState *createState(QPainterState *orig) const;
111
112     virtual void draw(const QVectorPath &path);
113     virtual void fill(const QVectorPath &path, const QBrush &brush) = 0;
114     virtual void stroke(const QVectorPath &path, const QPen &pen);
115
116     virtual void clip(const QVectorPath &path, Qt::ClipOperation op) = 0;
117     virtual void clip(const QRect &rect, Qt::ClipOperation op);
118     virtual void clip(const QRegion &region, Qt::ClipOperation op);
119     virtual void clip(const QPainterPath &path, Qt::ClipOperation op);
120
121     virtual void clipEnabledChanged() = 0;
122     virtual void penChanged() = 0;
123     virtual void brushChanged() = 0;
124     virtual void brushOriginChanged() = 0;
125     virtual void opacityChanged() = 0;
126     virtual void compositionModeChanged() = 0;
127     virtual void renderHintsChanged() = 0;
128     virtual void transformChanged() = 0;
129
130     virtual void fillRect(const QRectF &rect, const QBrush &brush);
131     virtual void fillRect(const QRectF &rect, const QColor &color);
132
133     virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
134
135     virtual void drawRects(const QRect *rects, int rectCount);
136     virtual void drawRects(const QRectF *rects, int rectCount);
137
138     virtual void drawLines(const QLine *lines, int lineCount);
139     virtual void drawLines(const QLineF *lines, int lineCount);
140
141     virtual void drawEllipse(const QRectF &r);
142     virtual void drawEllipse(const QRect &r);
143
144     virtual void drawPath(const QPainterPath &path);
145
146     virtual void drawPoints(const QPointF *points, int pointCount);
147     virtual void drawPoints(const QPoint *points, int pointCount);
148
149     virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
150     virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
151
152     virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) = 0;
153     virtual void drawPixmap(const QPointF &pos, const QPixmap &pm);
154
155     virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
156                            Qt::ImageConversionFlags flags = Qt::AutoColor) = 0;
157     virtual void drawImage(const QPointF &pos, const QImage &image);
158
159     virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
160
161     virtual void updateState(const QPaintEngineState &state);
162
163     virtual void setState(QPainterState *s);
164     inline QPainterState *state() { return static_cast<QPainterState *>(QPaintEngine::state); }
165     inline const QPainterState *state() const { return static_cast<const QPainterState *>(QPaintEngine::state); }
166
167     virtual bool supportsTransformations(const qreal pixelSize, const QTransform &m) const;
168
169 protected:
170     QPaintEngineEx(QPaintEngineExPrivate &data);
171 };
172
173 class Q_GUI_EXPORT QPaintEngineExPrivate : public QPaintEnginePrivate
174 {
175     Q_DECLARE_PUBLIC(QPaintEngineEx)
176 public:
177     QPaintEngineExPrivate();
178     ~QPaintEngineExPrivate();
179
180     QStroker stroker;
181     QDashStroker dasher;
182     StrokeHandler *strokeHandler;
183     QStrokerOps *activeStroker;
184     QPen strokerPen;
185
186     QRect exDeviceRect;
187 };
188
189 QT_END_NAMESPACE
190
191
192 #endif