| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtOpenVG module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 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 |
|
|---|
| 59 | QT_BEGIN_NAMESPACE
|
|---|
| 60 |
|
|---|
| 61 | class QFixedPoint;
|
|---|
| 62 | class QVGPaintEnginePrivate;
|
|---|
| 63 | class QPixmapData;
|
|---|
| 64 | class QVGEGLWindowSurfacePrivate;
|
|---|
| 65 |
|
|---|
| 66 | class Q_OPENVG_EXPORT QVGPainterState : public QPainterState
|
|---|
| 67 | {
|
|---|
| 68 | public:
|
|---|
| 69 | QVGPainterState(QVGPainterState& other);
|
|---|
| 70 | QVGPainterState();
|
|---|
| 71 | ~QVGPainterState();
|
|---|
| 72 |
|
|---|
| 73 | bool isNew;
|
|---|
| 74 | QRegion clipRegion;
|
|---|
| 75 | QPaintEngine::DirtyFlags savedDirty;
|
|---|
| 76 | };
|
|---|
| 77 |
|
|---|
| 78 | class Q_OPENVG_EXPORT QVGPaintEngine : public QPaintEngineEx
|
|---|
| 79 | {
|
|---|
| 80 | Q_DECLARE_PRIVATE(QVGPaintEngine)
|
|---|
| 81 | public:
|
|---|
| 82 | QVGPaintEngine();
|
|---|
| 83 | ~QVGPaintEngine();
|
|---|
| 84 |
|
|---|
| 85 | Type type() const { return OpenVG; }
|
|---|
| 86 |
|
|---|
| 87 | QPainterState *createState(QPainterState *orig) const;
|
|---|
| 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 ®ion, 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,
|
|---|
| 142 | QFlags<QPainter::PixmapFragmentHint> hints);
|
|---|
| 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);
|
|---|
| 151 | QVGPainterState *state() { return static_cast<QVGPainterState *>(QPaintEngineEx::state()); }
|
|---|
| 152 | const QVGPainterState *state() const { return static_cast<const QVGPainterState *>(QPaintEngineEx::state()); }
|
|---|
| 153 |
|
|---|
| 154 | void beginNativePainting();
|
|---|
| 155 | void endNativePainting();
|
|---|
| 156 |
|
|---|
| 157 | QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype);
|
|---|
| 158 |
|
|---|
| 159 | QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; }
|
|---|
| 160 |
|
|---|
| 161 | void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize);
|
|---|
| 162 |
|
|---|
| 163 | protected:
|
|---|
| 164 | QVGPaintEngine(QVGPaintEnginePrivate &data);
|
|---|
| 165 |
|
|---|
| 166 | private:
|
|---|
| 167 | void restoreState(QPaintEngine::DirtyFlags dirty);
|
|---|
| 168 | void updateScissor();
|
|---|
| 169 | QRegion defaultClipRegion();
|
|---|
| 170 | bool isDefaultClipRegion(const QRegion& region);
|
|---|
| 171 | bool isDefaultClipRect(const QRect& rect);
|
|---|
| 172 | bool clearRect(const QRectF &rect, const QColor &color);
|
|---|
| 173 | bool canVgWritePixels(const QImage &image) const;
|
|---|
| 174 | };
|
|---|
| 175 |
|
|---|
| 176 | QT_END_NAMESPACE
|
|---|
| 177 |
|
|---|
| 178 | #endif
|
|---|