1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the plugins of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QGRAPHICSSYSTEM_RUNTIME_P_H
43 #define QGRAPHICSSYSTEM_RUNTIME_P_H
49 // This file is not part of the Qt API. It exists for the convenience
50 // of other Qt classes. This header file may change from version to
51 // version without notice, or even be removed.
56 #include "qgraphicssystem_p.h"
58 #include <private/qpixmapdata_p.h>
62 class QRuntimeGraphicsSystem;
64 class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData {
66 QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type);
67 ~QRuntimePixmapData();
69 virtual QPixmapData *createCompatiblePixmapData() const;
70 virtual void resize(int width, int height);
71 virtual void fromImage(const QImage &image,
72 Qt::ImageConversionFlags flags);
74 virtual bool fromFile(const QString &filename, const char *format,
75 Qt::ImageConversionFlags flags);
76 virtual bool fromData(const uchar *buffer, uint len, const char *format,
77 Qt::ImageConversionFlags flags);
79 virtual void copy(const QPixmapData *data, const QRect &rect);
80 virtual bool scroll(int dx, int dy, const QRect &rect);
82 virtual int metric(QPaintDevice::PaintDeviceMetric metric) const;
83 virtual void fill(const QColor &color);
84 virtual QBitmap mask() const;
85 virtual void setMask(const QBitmap &mask);
86 virtual bool hasAlphaChannel() const;
87 virtual QPixmap transformed(const QTransform &matrix,
88 Qt::TransformationMode mode) const;
89 virtual void setAlphaChannel(const QPixmap &alphaChannel);
90 virtual QPixmap alphaChannel() const;
91 virtual QImage toImage() const;
92 virtual QPaintEngine *paintEngine() const;
94 virtual QImage *buffer();
100 #if defined(Q_OS_SYMBIAN)
101 void* toNativeType(NativeType type);
102 void fromNativeType(void* pixmap, NativeType type);
105 virtual QPixmapData *runtimeData() const;
108 const QRuntimeGraphicsSystem *m_graphicsSystem;
112 class QRuntimeWindowSurface : public QWindowSurface {
114 QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window);
115 ~QRuntimeWindowSurface();
117 virtual QPaintDevice *paintDevice();
118 virtual void flush(QWidget *widget, const QRegion ®ion,
119 const QPoint &offset);
120 virtual void setGeometry(const QRect &rect);
122 virtual bool scroll(const QRegion &area, int dx, int dy);
124 virtual void beginPaint(const QRegion &);
125 virtual void endPaint(const QRegion &);
127 virtual QImage* buffer(const QWidget *widget);
128 virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const;
130 virtual QPoint offset(const QWidget *widget) const;
132 virtual WindowSurfaceFeatures features() const;
134 QScopedPointer<QWindowSurface> m_windowSurface;
135 QScopedPointer<QWindowSurface> m_pendingWindowSurface;
138 const QRuntimeGraphicsSystem *m_graphicsSystem;
141 class QRuntimeGraphicsSystem : public QGraphicsSystem
145 enum WindowSurfaceDestroyPolicy
148 DestroyAfterFirstFlush
152 QRuntimeGraphicsSystem();
154 QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
155 QWindowSurface *createWindowSurface(QWidget *widget) const;
157 void removePixmapData(QRuntimePixmapData *pixmapData) const;
158 void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const;
160 void setGraphicsSystem(const QString &name);
161 QString graphicsSystemName() const { return m_graphicsSystemName; }
163 void setWindowSurfaceDestroyPolicy(WindowSurfaceDestroyPolicy policy)
165 m_windowSurfaceDestroyPolicy = policy;
168 int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; }
172 int m_windowSurfaceDestroyPolicy;
173 QGraphicsSystem *m_graphicsSystem;
174 mutable QList<QRuntimePixmapData *> m_pixmapDatas;
175 mutable QList<QRuntimeWindowSurface *> m_windowSurfaces;
176 QString m_graphicsSystemName;
178 QString m_pendingGraphicsSystemName;
180 friend class QRuntimePixmapData;
181 friend class QRuntimeWindowSurface;
182 friend class QMeeGoGraphicsSystem;