[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the QtGui 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 | **
|
---|
[561] | 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.
|
---|
[2] | 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 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef QPIXMAPDATA_P_H
|
---|
| 43 | #define QPIXMAPDATA_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/qpixmap.h>
|
---|
| 57 | #include <QtCore/qatomic.h>
|
---|
| 58 |
|
---|
| 59 | QT_BEGIN_NAMESPACE
|
---|
| 60 |
|
---|
| 61 | class Q_GUI_EXPORT QPixmapData
|
---|
| 62 | {
|
---|
| 63 | public:
|
---|
| 64 | enum PixelType {
|
---|
| 65 | // WARNING: Do not change the first two
|
---|
| 66 | // Must match QPixmap::Type
|
---|
| 67 | PixmapType, BitmapType
|
---|
| 68 | };
|
---|
[561] | 69 | #if defined(Q_OS_SYMBIAN)
|
---|
| 70 | enum NativeType {
|
---|
| 71 | FbsBitmap,
|
---|
| 72 | SgImage
|
---|
| 73 | };
|
---|
| 74 | #endif
|
---|
[2] | 75 | enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
|
---|
| 76 | OpenGLClass, OpenVGClass, CustomClass = 1024 };
|
---|
| 77 |
|
---|
[561] | 78 | QPixmapData(PixelType pixelType, int classId);
|
---|
[2] | 79 | virtual ~QPixmapData();
|
---|
| 80 |
|
---|
[561] | 81 | virtual QPixmapData *createCompatiblePixmapData() const;
|
---|
| 82 |
|
---|
[2] | 83 | virtual void resize(int width, int height) = 0;
|
---|
| 84 | virtual void fromImage(const QImage &image,
|
---|
| 85 | Qt::ImageConversionFlags flags) = 0;
|
---|
[561] | 86 |
|
---|
| 87 | virtual bool fromFile(const QString &filename, const char *format,
|
---|
[2] | 88 | Qt::ImageConversionFlags flags);
|
---|
[561] | 89 | virtual bool fromData(const uchar *buffer, uint len, const char *format,
|
---|
| 90 | Qt::ImageConversionFlags flags);
|
---|
| 91 |
|
---|
[2] | 92 | virtual void copy(const QPixmapData *data, const QRect &rect);
|
---|
[561] | 93 | virtual bool scroll(int dx, int dy, const QRect &rect);
|
---|
[2] | 94 |
|
---|
| 95 | virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0;
|
---|
| 96 | virtual void fill(const QColor &color) = 0;
|
---|
| 97 | virtual QBitmap mask() const;
|
---|
| 98 | virtual void setMask(const QBitmap &mask);
|
---|
| 99 | virtual bool hasAlphaChannel() const = 0;
|
---|
| 100 | virtual QPixmap transformed(const QTransform &matrix,
|
---|
| 101 | Qt::TransformationMode mode) const;
|
---|
| 102 | virtual void setAlphaChannel(const QPixmap &alphaChannel);
|
---|
| 103 | virtual QPixmap alphaChannel() const;
|
---|
| 104 | virtual QImage toImage() const = 0;
|
---|
| 105 | virtual QPaintEngine* paintEngine() const = 0;
|
---|
| 106 |
|
---|
| 107 | inline int serialNumber() const { return ser_no; }
|
---|
| 108 |
|
---|
| 109 | inline PixelType pixelType() const { return type; }
|
---|
| 110 | inline ClassId classId() const { return static_cast<ClassId>(id); }
|
---|
| 111 |
|
---|
| 112 | virtual QImage* buffer();
|
---|
| 113 |
|
---|
[561] | 114 | inline int width() const { return w; }
|
---|
| 115 | inline int height() const { return h; }
|
---|
| 116 | QT_DEPRECATED inline int numColors() const { return metric(QPaintDevice::PdmNumColors); }
|
---|
| 117 | inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); }
|
---|
| 118 | inline int depth() const { return d; }
|
---|
| 119 | inline bool isNull() const { return is_null; }
|
---|
[2] | 120 |
|
---|
[561] | 121 | #if defined(Q_OS_SYMBIAN)
|
---|
| 122 | virtual void* toNativeType(NativeType type);
|
---|
| 123 | virtual void fromNativeType(void* pixmap, NativeType type);
|
---|
| 124 | #endif
|
---|
| 125 |
|
---|
| 126 | static QPixmapData *create(int w, int h, PixelType type);
|
---|
| 127 |
|
---|
[2] | 128 | protected:
|
---|
| 129 | void setSerialNumber(int serNo);
|
---|
[561] | 130 | int w;
|
---|
| 131 | int h;
|
---|
| 132 | int d;
|
---|
| 133 | bool is_null;
|
---|
[2] | 134 |
|
---|
| 135 | private:
|
---|
| 136 | friend class QPixmap;
|
---|
| 137 | friend class QX11PixmapData;
|
---|
[561] | 138 | friend class QS60PixmapData;
|
---|
| 139 | friend class QImagePixmapCleanupHooks; // Needs to set is_cached
|
---|
| 140 | friend class QGLTextureCache; //Needs to check the reference count
|
---|
| 141 | friend class QExplicitlySharedDataPointer<QPixmapData>;
|
---|
[2] | 142 |
|
---|
| 143 | QAtomicInt ref;
|
---|
| 144 | int detach_no;
|
---|
| 145 |
|
---|
| 146 | PixelType type;
|
---|
| 147 | int id;
|
---|
| 148 | int ser_no;
|
---|
| 149 | uint is_cached;
|
---|
| 150 | };
|
---|
| 151 |
|
---|
| 152 | # define QT_XFORM_TYPE_MSBFIRST 0
|
---|
| 153 | # define QT_XFORM_TYPE_LSBFIRST 1
|
---|
| 154 | # if defined(Q_WS_WIN)
|
---|
| 155 | # define QT_XFORM_TYPE_WINDOWSPIXMAP 2
|
---|
| 156 | # endif
|
---|
| 157 | extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int);
|
---|
| 158 |
|
---|
| 159 | QT_END_NAMESPACE
|
---|
| 160 |
|
---|
| 161 | #endif // QPIXMAPDATA_P_H
|
---|