| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information ([email protected])
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** 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 are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at [email protected].
|
|---|
| 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 | };
|
|---|
| 69 | enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
|
|---|
| 70 | OpenGLClass, OpenVGClass, CustomClass = 1024 };
|
|---|
| 71 |
|
|---|
| 72 | QPixmapData(PixelType pixelpType, int classId);
|
|---|
| 73 | virtual ~QPixmapData();
|
|---|
| 74 |
|
|---|
| 75 | virtual void resize(int width, int height) = 0;
|
|---|
| 76 | virtual void fromImage(const QImage &image,
|
|---|
| 77 | Qt::ImageConversionFlags flags) = 0;
|
|---|
| 78 | virtual void fromFile(const QString &filename, const char *format,
|
|---|
| 79 | Qt::ImageConversionFlags flags);
|
|---|
| 80 | virtual void copy(const QPixmapData *data, const QRect &rect);
|
|---|
| 81 |
|
|---|
| 82 | virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0;
|
|---|
| 83 | virtual void fill(const QColor &color) = 0;
|
|---|
| 84 | virtual QBitmap mask() const;
|
|---|
| 85 | virtual void setMask(const QBitmap &mask);
|
|---|
| 86 | virtual bool hasAlphaChannel() const = 0;
|
|---|
| 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 = 0;
|
|---|
| 92 | virtual QPaintEngine* paintEngine() const = 0;
|
|---|
| 93 |
|
|---|
| 94 | inline int serialNumber() const { return ser_no; }
|
|---|
| 95 |
|
|---|
| 96 | inline PixelType pixelType() const { return type; }
|
|---|
| 97 | inline ClassId classId() const { return static_cast<ClassId>(id); }
|
|---|
| 98 |
|
|---|
| 99 | virtual QImage* buffer();
|
|---|
| 100 |
|
|---|
| 101 | int width() const { return metric(QPaintDevice::PdmWidth); }
|
|---|
| 102 | int height() const { return metric(QPaintDevice::PdmHeight); }
|
|---|
| 103 | int numColors() const { return metric(QPaintDevice::PdmNumColors); }
|
|---|
| 104 | int depth() const { return metric(QPaintDevice::PdmDepth); }
|
|---|
| 105 |
|
|---|
| 106 | protected:
|
|---|
| 107 | void setSerialNumber(int serNo);
|
|---|
| 108 |
|
|---|
| 109 | private:
|
|---|
| 110 | friend class QPixmap;
|
|---|
| 111 | friend class QGLContextPrivate;
|
|---|
| 112 | friend class QX11PixmapData;
|
|---|
| 113 |
|
|---|
| 114 | QAtomicInt ref;
|
|---|
| 115 | int detach_no;
|
|---|
| 116 |
|
|---|
| 117 | PixelType type;
|
|---|
| 118 | int id;
|
|---|
| 119 | int ser_no;
|
|---|
| 120 | uint is_cached;
|
|---|
| 121 | };
|
|---|
| 122 |
|
|---|
| 123 | #ifdef Q_WS_WIN
|
|---|
| 124 | #ifndef Q_OS_WINCE
|
|---|
| 125 | QPixmap convertHIconToPixmap( const HICON icon);
|
|---|
| 126 | #else
|
|---|
| 127 | QPixmap convertHIconToPixmap( const HICON icon, bool large = false);
|
|---|
| 128 | #endif
|
|---|
| 129 | QPixmap loadIconFromShell32( int resourceId, int size );
|
|---|
| 130 | #endif
|
|---|
| 131 |
|
|---|
| 132 | # define QT_XFORM_TYPE_MSBFIRST 0
|
|---|
| 133 | # define QT_XFORM_TYPE_LSBFIRST 1
|
|---|
| 134 | # if defined(Q_WS_WIN)
|
|---|
| 135 | # define QT_XFORM_TYPE_WINDOWSPIXMAP 2
|
|---|
| 136 | # endif
|
|---|
| 137 | extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int);
|
|---|
| 138 |
|
|---|
| 139 | QT_END_NAMESPACE
|
|---|
| 140 |
|
|---|
| 141 | #endif // QPIXMAPDATA_P_H
|
|---|