1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtGui module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QPAINTENGINEEX_P_H
43 #define QPAINTENGINEEX_P_H
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
56 #include <QtGui/qpaintengine.h>
58 #include <private/qpaintengine_p.h>
59 #include <private/qstroker_p.h>
60 #include <private/qpainter_p.h>
61 #include <private/qvectorpath_p.h>
70 class QPaintEngineExPrivate;
71 class QStaticTextItem;
74 #ifndef QT_NO_DEBUG_STREAM
75 QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path);
80 class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine
82 Q_DECLARE_PRIVATE(QPaintEngineEx)
86 virtual QPainterState *createState(QPainterState *orig) const;
88 virtual void draw(const QVectorPath &path);
89 virtual void fill(const QVectorPath &path, const QBrush &brush) = 0;
90 virtual void stroke(const QVectorPath &path, const QPen &pen);
92 virtual void clip(const QVectorPath &path, Qt::ClipOperation op) = 0;
93 virtual void clip(const QRect &rect, Qt::ClipOperation op);
94 virtual void clip(const QRegion ®ion, Qt::ClipOperation op);
95 virtual void clip(const QPainterPath &path, Qt::ClipOperation op);
97 virtual void clipEnabledChanged() = 0;
98 virtual void penChanged() = 0;
99 virtual void brushChanged() = 0;
100 virtual void brushOriginChanged() = 0;
101 virtual void opacityChanged() = 0;
102 virtual void compositionModeChanged() = 0;
103 virtual void renderHintsChanged() = 0;
104 virtual void transformChanged() = 0;
106 virtual void fillRect(const QRectF &rect, const QBrush &brush);
107 virtual void fillRect(const QRectF &rect, const QColor &color);
109 virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
111 virtual void drawRects(const QRect *rects, int rectCount);
112 virtual void drawRects(const QRectF *rects, int rectCount);
114 virtual void drawLines(const QLine *lines, int lineCount);
115 virtual void drawLines(const QLineF *lines, int lineCount);
117 virtual void drawEllipse(const QRectF &r);
118 virtual void drawEllipse(const QRect &r);
120 virtual void drawPath(const QPainterPath &path);
122 virtual void drawPoints(const QPointF *points, int pointCount);
123 virtual void drawPoints(const QPoint *points, int pointCount);
125 virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
126 virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
128 virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) = 0;
129 virtual void drawPixmap(const QPointF &pos, const QPixmap &pm);
131 virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
132 Qt::ImageConversionFlags flags = Qt::AutoColor) = 0;
133 virtual void drawImage(const QPointF &pos, const QImage &image);
135 virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
137 virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
138 QFlags<QPainter::PixmapFragmentHint> hints);
140 virtual void updateState(const QPaintEngineState &state);
142 virtual void drawStaticTextItem(QStaticTextItem *);
144 virtual void setState(QPainterState *s);
145 inline QPainterState *state() { return static_cast<QPainterState *>(QPaintEngine::state); }
146 inline const QPainterState *state() const { return static_cast<const QPainterState *>(QPaintEngine::state); }
148 virtual void sync() {}
150 virtual void beginNativePainting() {}
151 virtual void endNativePainting() {}
153 // Return a pixmap filter of "type" that can render the parameters
154 // in "prototype". The returned filter is owned by the engine and
155 // will be destroyed when the engine is destroyed. The "prototype"
156 // allows the engine to pick different filters based on the parameters
157 // that will be requested, and not just the "type".
158 virtual QPixmapFilter *pixmapFilter(int /*type*/, const QPixmapFilter * /*prototype*/) { return 0; }
160 // These flags are needed in the implementation of paint buffers.
163 DoNotEmulate = 0x01, // If set, QPainter will not wrap this engine in an emulation engine.
164 IsEmulationEngine = 0x02 // If set, this object is a QEmulationEngine.
166 virtual uint flags() const {return 0;}
167 virtual bool supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const;
168 virtual bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const;
171 QPaintEngineEx(QPaintEngineExPrivate &data);
174 class Q_GUI_EXPORT QPaintEngineExPrivate : public QPaintEnginePrivate
176 Q_DECLARE_PUBLIC(QPaintEngineEx)
178 QPaintEngineExPrivate();
179 ~QPaintEngineExPrivate();
181 void replayClipOperations();
182 bool hasClipOperations() const;
186 StrokeHandler *strokeHandler;
187 QStrokerOps *activeStroker;