src/openvg/qpaintengine_vg_p.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtOpenVG module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    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 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    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 
       
    58 QT_BEGIN_NAMESPACE
       
    59 
       
    60 class QVGPaintEnginePrivate;
       
    61 class QPixmapData;
       
    62 class QVGEGLWindowSurfacePrivate;
       
    63 
       
    64 class Q_OPENVG_EXPORT QVGPainterState : public QPainterState
       
    65 {
       
    66 public:
       
    67     QVGPainterState(QVGPainterState& other);
       
    68     QVGPainterState();
       
    69     ~QVGPainterState();
       
    70 
       
    71     bool isNew;
       
    72     QRegion clipRegion;
       
    73     QPaintEngine::DirtyFlags savedDirty;
       
    74 };
       
    75 
       
    76 class Q_OPENVG_EXPORT QVGPaintEngine : public QPaintEngineEx
       
    77 {
       
    78     Q_DECLARE_PRIVATE(QVGPaintEngine)
       
    79 public:
       
    80     QVGPaintEngine();
       
    81     ~QVGPaintEngine();
       
    82 
       
    83     Type type() const { return OpenVG; }
       
    84 
       
    85     QPainterState *createState(QPainterState *orig) const;
       
    86 
       
    87     bool begin(QPaintDevice *pdev);
       
    88     bool end();
       
    89 
       
    90     void draw(const QVectorPath &path);
       
    91     void fill(const QVectorPath &path, const QBrush &brush);
       
    92     void stroke(const QVectorPath &path, const QPen &pen);
       
    93 
       
    94     void clip(const QVectorPath &path, Qt::ClipOperation op);
       
    95     void clip(const QRect &rect, Qt::ClipOperation op);
       
    96     void clip(const QRegion &region, Qt::ClipOperation op);
       
    97     void clip(const QPainterPath &path, Qt::ClipOperation op);
       
    98 
       
    99     void clipEnabledChanged();
       
   100     void penChanged();
       
   101     void brushChanged();
       
   102     void brushOriginChanged();
       
   103     void opacityChanged();
       
   104     void compositionModeChanged();
       
   105     void renderHintsChanged();
       
   106     void transformChanged();
       
   107 
       
   108     void fillRect(const QRectF &rect, const QBrush &brush);
       
   109     void fillRect(const QRectF &rect, const QColor &color);
       
   110 
       
   111     void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
       
   112 
       
   113     void drawRects(const QRect *rects, int rectCount);
       
   114     void drawRects(const QRectF *rects, int rectCount);
       
   115 
       
   116     void drawLines(const QLine *lines, int lineCount);
       
   117     void drawLines(const QLineF *lines, int lineCount);
       
   118 
       
   119     void drawEllipse(const QRectF &r);
       
   120     void drawEllipse(const QRect &r);
       
   121 
       
   122     void drawPath(const QPainterPath &path);
       
   123 
       
   124     void drawPoints(const QPointF *points, int pointCount);
       
   125     void drawPoints(const QPoint *points, int pointCount);
       
   126 
       
   127     void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
       
   128     void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
       
   129 
       
   130     void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
       
   131     void drawPixmap(const QPointF &pos, const QPixmap &pm);
       
   132 
       
   133     void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
       
   134                    Qt::ImageConversionFlags flags = Qt::AutoColor);
       
   135     void drawImage(const QPointF &pos, const QImage &image);
       
   136 
       
   137     void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
       
   138 
       
   139     void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints);
       
   140 
       
   141     void drawTextItem(const QPointF &p, const QTextItem &textItem);
       
   142 
       
   143     void setState(QPainterState *s);
       
   144     QVGPainterState *state() { return static_cast<QVGPainterState *>(QPaintEngineEx::state()); }
       
   145     const QVGPainterState *state() const { return static_cast<const QVGPainterState *>(QPaintEngineEx::state()); }
       
   146 
       
   147     void beginNativePainting();
       
   148     void endNativePainting();
       
   149 
       
   150     QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype);
       
   151 
       
   152     QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; }
       
   153 
       
   154 protected:
       
   155     QVGPaintEngine(QVGPaintEnginePrivate &data);
       
   156 
       
   157 private:
       
   158     void restoreState(QPaintEngine::DirtyFlags dirty);
       
   159     void updateScissor();
       
   160     QRegion defaultClipRegion();
       
   161     bool isDefaultClipRegion(const QRegion& region);
       
   162     bool isDefaultClipRect(const QRect& rect);
       
   163     bool clearRect(const QRectF &rect, const QColor &color);
       
   164 };
       
   165 
       
   166 
       
   167 QT_END_NAMESPACE
       
   168 
       
   169 #endif