QtBase  v6.3.1
qpaintengineex_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QPAINTENGINEEX_P_H
41 #define QPAINTENGINEEX_P_H
42 
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 
54 #include <QtGui/private/qtguiglobal_p.h>
55 #include <QtGui/qpaintengine.h>
56 
57 #include <private/qpaintengine_p.h>
58 #include <private/qstroker_p.h>
59 #include <private/qpainter_p.h>
60 #include <private/qvectorpath_p.h>
61 
62 
64 
65 
66 class QPainterState;
68 class QStaticTextItem;
69 struct StrokeHandler;
70 
71 #ifndef QT_NO_DEBUG_STREAM
72 QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path);
73 #endif
74 
75 class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine
76 {
77  Q_DECLARE_PRIVATE(QPaintEngineEx)
78 public:
80 
81  virtual QPainterState *createState(QPainterState *orig) const;
82 
83  virtual void draw(const QVectorPath &path);
84  virtual void fill(const QVectorPath &path, const QBrush &brush) = 0;
85  virtual void stroke(const QVectorPath &path, const QPen &pen);
86 
87  virtual void clip(const QVectorPath &path, Qt::ClipOperation op) = 0;
88  virtual void clip(const QRect &rect, Qt::ClipOperation op);
89  virtual void clip(const QRegion &region, Qt::ClipOperation op);
90  virtual void clip(const QPainterPath &path, Qt::ClipOperation op);
91 
92  virtual void clipEnabledChanged() = 0;
93  virtual void penChanged() = 0;
94  virtual void brushChanged() = 0;
95  virtual void brushOriginChanged() = 0;
96  virtual void opacityChanged() = 0;
97  virtual void compositionModeChanged() = 0;
98  virtual void renderHintsChanged() = 0;
99  virtual void transformChanged() = 0;
100 
101  virtual void fillRect(const QRectF &rect, const QBrush &brush);
102  virtual void fillRect(const QRectF &rect, const QColor &color);
103 
104  virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
105 
106  virtual void drawRects(const QRect *rects, int rectCount) override;
107  virtual void drawRects(const QRectF *rects, int rectCount) override;
108 
109  virtual void drawLines(const QLine *lines, int lineCount) override;
110  virtual void drawLines(const QLineF *lines, int lineCount) override;
111 
112  virtual void drawEllipse(const QRectF &r) override;
113  virtual void drawEllipse(const QRect &r) override;
114 
115  virtual void drawPath(const QPainterPath &path) override;
116 
117  virtual void drawPoints(const QPointF *points, int pointCount) override;
118  virtual void drawPoints(const QPoint *points, int pointCount) override;
119 
120  virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
121  virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
122 
123  virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override = 0;
124  virtual void drawPixmap(const QPointF &pos, const QPixmap &pm);
125 
126  virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
127  Qt::ImageConversionFlags flags = Qt::AutoColor) override = 0;
128  virtual void drawImage(const QPointF &pos, const QImage &image);
129 
130  virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
131 
132  virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
134 
135  virtual void updateState(const QPaintEngineState &state) override;
136 
137  virtual void drawStaticTextItem(QStaticTextItem *);
138 
139  virtual void setState(QPainterState *s);
140  inline QPainterState *state() { return static_cast<QPainterState *>(QPaintEngine::state); }
141  inline const QPainterState *state() const { return static_cast<const QPainterState *>(QPaintEngine::state); }
142 
143  virtual void sync() {}
144 
145  virtual void beginNativePainting() {}
146  virtual void endNativePainting() {}
147 
148  // These flags are needed in the implementation of paint buffers.
149  enum Flags
150  {
151  DoNotEmulate = 0x01, // If set, QPainter will not wrap this engine in an emulation engine.
152  IsEmulationEngine = 0x02 // If set, this object is a QEmulationEngine.
153  };
154  virtual uint flags() const {return 0;}
155  virtual bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const;
156  virtual bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const;
157 
158 protected:
160 };
161 
162 class Q_GUI_EXPORT QPaintEngineExPrivate : public QPaintEnginePrivate
163 {
164  Q_DECLARE_PUBLIC(QPaintEngineEx)
165 public:
168 
169  void replayClipOperations();
170  bool hasClipOperations() const;
171 
177 
179 };
180 
182 
183 #endif
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:66
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
operator<<(QDataStream &ds, qfloat16 f)
Definition: qfloat16.cpp:327
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:65
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qflags.h:89
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:73
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:215
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:53
virtual void renderHintsChanged()=0
virtual void penChanged()=0
virtual void beginNativePainting()
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override=0
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0
virtual void sync()
virtual void clipEnabledChanged()=0
virtual void endNativePainting()
virtual void fill(const QVectorPath &path, const QBrush &brush)=0
virtual void opacityChanged()=0
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override=0
virtual void compositionModeChanged()=0
virtual void brushOriginChanged()=0
virtual uint flags() const
virtual void brushChanged()=0
virtual void transformChanged()=0
const QPainterState * state() const
QPainterState * state()
StrokeHandler * strokeHandler
QStrokerOps * activeStroker
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:87
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
virtual void drawRects(const QRect *rects, int rectCount)
virtual void updateState(const QPaintEngineState &state)=0
virtual void drawLines(const QLine *lines, int lineCount)
virtual void drawPoints(const QPointF *points, int pointCount)
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
QPaintEngineState * state
Definition: qpaintengine.h:234
virtual void drawEllipse(const QRectF &r)
virtual void drawPath(const QPainterPath &path)
The QPaintEngineState class provides information about the active paint engine's current state....
Definition: qpaintengine.h:268
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
Definition: qpainter.h:99
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:65
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:61
The QPixmap class is an off-screen image representation that can be used as a paint device.
Definition: qpixmap.h:63
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:242
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:63
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:56
rect
[4]
else opt state
[0]
@ AutoColor
Definition: qnamespace.h:503
SizeMode
Definition: qnamespace.h:1161
ClipOperation
Definition: qnamespace.h:1330
Definition: brush.cpp:52
Definition: image.cpp:51
QRectF fillRect(QRect rect, int background)
set set set set set set set macro pixldst1 op
QT_END_INCLUDE_NAMESPACE typedef double qreal
Definition: qglobal.h:341
unsigned int uint
Definition: qglobal.h:334
GLenum mode
const GLfloat * m
GLboolean r
[2]
GLuint color
[2]
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfixed GLfixed GLint GLint GLfixed points
Definition: qopenglext.h:5206
GLsizei const GLchar *const * path
Definition: qopenglext.h:4283
GLdouble s
[6]
Definition: qopenglext.h:235
myFilter draw(painter, QPoint(0, 0), originalPixmap)
widget render & pixmap