Qt 4.8
qpaintengine_vg_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtOpenVG 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QPAINTENGINE_VG_P_H
43 #define QPAINTENGINE_VG_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
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.
52 //
53 // We mean it.
54 //
55 
56 #include <QtGui/private/qpaintengineex_p.h>
57 #include <QtGui/private/qtextureglyphcache_p.h>
58 
60 
61 struct QFixedPoint;
63 class QPixmapData;
65 
67 {
68 public:
71  ~QVGPainterState();
72 
73  bool isNew;
75  QPaintEngine::DirtyFlags savedDirty;
76 };
77 
79 {
81 public:
83  ~QVGPaintEngine();
84 
85  Type type() const { return OpenVG; }
86 
88 
89  bool begin(QPaintDevice *pdev);
90  bool end();
91 
92  void draw(const QVectorPath &path);
93  void fill(const QVectorPath &path, const QBrush &brush);
94  void stroke(const QVectorPath &path, const QPen &pen);
95 
96  void clip(const QVectorPath &path, Qt::ClipOperation op);
97  void clip(const QRect &rect, Qt::ClipOperation op);
98  void clip(const QRegion &region, Qt::ClipOperation op);
99  void clip(const QPainterPath &path, Qt::ClipOperation op);
100 
101  void clipEnabledChanged();
102  void penChanged();
103  void brushChanged();
104  void brushOriginChanged();
105  void opacityChanged();
106  void compositionModeChanged();
107  void renderHintsChanged();
108  void transformChanged();
109 
110  void fillRect(const QRectF &rect, const QBrush &brush);
111  void fillRect(const QRectF &rect, const QColor &color);
112 
113  void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
114 
115  void drawRects(const QRect *rects, int rectCount);
116  void drawRects(const QRectF *rects, int rectCount);
117 
118  void drawLines(const QLine *lines, int lineCount);
119  void drawLines(const QLineF *lines, int lineCount);
120 
121  void drawEllipse(const QRectF &r);
122  void drawEllipse(const QRect &r);
123 
124  void drawPath(const QPainterPath &path);
125 
126  void drawPoints(const QPointF *points, int pointCount);
127  void drawPoints(const QPoint *points, int pointCount);
128 
129  void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
130  void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
131 
132  void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
133  void drawPixmap(const QPointF &pos, const QPixmap &pm);
134 
135  void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
136  Qt::ImageConversionFlags flags = Qt::AutoColor);
137  void drawImage(const QPointF &pos, const QImage &image);
138 
139  void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
140 
141  void drawPixmapFragments(const QPainter::PixmapFragment *drawingData, int dataCount, const QPixmap &pixmap,
143 
144  void drawTextItem(const QPointF &p, const QTextItem &textItem);
145  void drawStaticTextItem(QStaticTextItem *staticTextItem);
146  bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font,
147  QFontEngine *fontEngine, const QPointF &p,
148  const QFixedPoint *positions);
149 
150  void setState(QPainterState *s);
152  const QVGPainterState *state() const { return static_cast<const QVGPainterState *>(QPaintEngineEx::state()); }
153 
154  void beginNativePainting();
155  void endNativePainting();
156 
158 
160 
161  void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize);
162  bool supportsTransformations(qreal, const QTransform &) const { return true; }
163 
164 protected:
166 
167 private:
168  void restoreState(QPaintEngine::DirtyFlags dirty);
169  void updateScissor();
170  QRegion defaultClipRegion();
171  bool isDefaultClipRegion(const QRegion& region);
172  bool isDefaultClipRect(const QRect& rect);
173  bool clearRect(const QRectF &rect, const QColor &color);
174  bool canVgWritePixels(const QImage &image) const;
175 };
176 
178 
179 #endif
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
virtual void compositionModeChanged()=0
double qreal
Definition: qglobal.h:1193
virtual void penChanged()=0
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual void clipEnabledChanged()=0
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
virtual void transformChanged()=0
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
QPaintEngine::DirtyFlags savedDirty
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)=0
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p...
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
virtual void draw(const QVectorPath &path)
virtual void beginNativePainting()
bool supportsTransformations(qreal, const QTransform &) const
Type type() const
Reimplement this function to return the paint engine Type.
virtual bool begin(QPaintDevice *pdev)=0
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
#define Q_D(Class)
Definition: qglobal.h:2482
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
virtual void brushOriginChanged()=0
virtual void fillRect(const QRectF &rect, const QBrush &brush)
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
virtual void renderHintsChanged()=0
virtual void stroke(const QVectorPath &path, const QPen &pen)
QVGPaintEnginePrivate * vgPrivate()
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
virtual QPixmapFilter * pixmapFilter(int, const QPixmapFilter *)
static void clearRect(IDirectFBSurface *surface, const QColor &color, const QRect &rect)
virtual void endNativePainting()
static void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush)
Definition: qwidget.cpp:2392
virtual void brushChanged()=0
static const QCssKnownValue positions[NumKnownPositionModes - 1]
Definition: qcssparser.cpp:329
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static const char * data(const QByteArray &arr)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual void setState(QPainterState *s)
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
virtual void opacityChanged()=0
virtual void drawLines(const QLine *lines, int lineCount)
The default implementation converts the first lineCount lines in lines to a QLineF and calls the floa...
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
static QByteArray prototype(const QList< QByteArray > &parameterTypes, const QList< QByteArray > &parameterNames, bool *ok)
Definition: qaxserver.cpp:685
virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
Definition: qpainter.h:103
The QPixmapFilter class provides the basic functionality for pixmap filter classes.
const QVGPainterState * state() const
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
virtual void drawStaticTextItem(QStaticTextItem *)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
virtual void fill(const QVectorPath &path, const QBrush &brush)=0
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
virtual bool end()=0
Reimplement this function to finish painting on the current paint device.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qglobal.h:2313
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
SizeMode
Definition: qnamespace.h:1187
The QTextItem class provides all the information required to draw text in a custom paint engine...
Definition: qpaintengine.h:68
#define Q_OPENVG_EXPORT
Definition: qglobal.h:1457
unsigned int glyph_t
QPainterState * state()
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
QVGPainterState * state()
ClipOperation
Definition: qnamespace.h:1495
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0
virtual QPainterState * createState(QPainterState *orig) const
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.