| 67ad051 by Lars Knoll at 2009-03-23 |
1 |
/**************************************************************************** |
|
2 |
** |
| fbc2c44 by Jason McDonald at 2011-01-10 |
3 |
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). |
| 04e3b30 by Jason McDonald at 2009-09-09 |
4 |
** All rights reserved. |
| 858c70f by Jason McDonald at 2009-06-16 |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
| 67ad051 by Lars Knoll at 2009-03-23 |
6 |
** |
|
7 |
** This file is part of the QtGui 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 |
| 309db73 by Jason McDonald at 2009-08-31 |
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
| 67ad051 by Lars Knoll at 2009-03-23 |
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 |
** |
| 04e3b30 by Jason McDonald at 2009-09-09 |
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. |
| 67ad051 by Lars Knoll at 2009-03-23 |
27 |
** |
| 309db73 by Jason McDonald at 2009-08-31 |
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 |
** |
| 67ad051 by Lars Knoll at 2009-03-23 |
37 |
** |
|
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 |
}; |
| 7dcf984 by Jason Barron at 2009-09-23 |
69 |
#if defined(Q_OS_SYMBIAN) |
|
70 |
enum NativeType { |
|
71 |
FbsBitmap, |
|
72 |
SgImage |
|
73 |
}; |
|
74 |
#endif |
| 67ad051 by Lars Knoll at 2009-03-23 |
75 |
enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass, |
|
76 |
OpenGLClass, OpenVGClass, CustomClass = 1024 }; |
|
77 |
|
| d310f7c by Samuel Rødal at 2009-10-14 |
78 |
QPixmapData(PixelType pixelType, int classId); |
| 67ad051 by Lars Knoll at 2009-03-23 |
79 |
virtual ~QPixmapData(); |
|
80 |
|
| d310f7c by Samuel Rødal at 2009-10-14 |
81 |
virtual QPixmapData *createCompatiblePixmapData() const; |
|
82 |
|
| 67ad051 by Lars Knoll at 2009-03-23 |
83 |
virtual void resize(int width, int height) = 0; |
|
84 |
virtual void fromImage(const QImage &image, |
|
85 |
Qt::ImageConversionFlags flags) = 0; |
| dd21f56 by gunnar at 2009-08-24 |
86 |
|
|
87 |
virtual bool fromFile(const QString &filename, const char *format, |
|
88 |
Qt::ImageConversionFlags flags); |
|
89 |
virtual bool fromData(const uchar *buffer, uint len, const char *format, |
| 67ad051 by Lars Knoll at 2009-03-23 |
90 |
Qt::ImageConversionFlags flags); |
| dd21f56 by gunnar at 2009-08-24 |
91 |
|
| 67ad051 by Lars Knoll at 2009-03-23 |
92 |
virtual void copy(const QPixmapData *data, const QRect &rect); |
|
93 |
virtual bool scroll(int dx, int dy, const QRect &rect); |
|
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 |
|
| fa8030a by Andreas Aardal Hanssen at 2009-06-17 |
114 |
inline int width() const { return w; } |
|
115 |
inline int height() const { return h; } |
| e53c26b by Marius Storm-Olsen at 2009-11-06 |
116 |
QT_DEPRECATED inline int numColors() const { return metric(QPaintDevice::PdmNumColors); } |
|
117 |
inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); } |
| fa8030a by Andreas Aardal Hanssen at 2009-06-17 |
118 |
inline int depth() const { return d; } |
|
119 |
inline bool isNull() const { return is_null; } |
| 9e95ce2 by Tom Cooksey at 2010-01-29 |
120 |
inline qint64 cacheKey() const { |
|
121 |
int classKey = id; |
|
122 |
if (classKey >= 1024) |
|
123 |
classKey = -(classKey >> 10); |
|
124 |
return ((((qint64) classKey) << 56) |
|
125 |
| (((qint64) ser_no) << 32) |
|
126 |
| ((qint64) detach_no)); |
|
127 |
} |
| 67ad051 by Lars Knoll at 2009-03-23 |
128 |
|
| ad32d9a by Aleksandar Sasha Babic at 2009-09-18 |
129 |
#if defined(Q_OS_SYMBIAN) |
| 7dcf984 by Jason Barron at 2009-09-23 |
130 |
virtual void* toNativeType(NativeType type); |
|
131 |
virtual void fromNativeType(void* pixmap, NativeType type); |
| ad32d9a by Aleksandar Sasha Babic at 2009-09-18 |
132 |
#endif |
|
133 |
|
| 79eef27 by Gunnar Sletta at 2009-10-30 |
134 |
static QPixmapData *create(int w, int h, PixelType type); |
|
135 |
|
| 67ad051 by Lars Knoll at 2009-03-23 |
136 |
protected: |
|
137 |
void setSerialNumber(int serNo); |
| fa8030a by Andreas Aardal Hanssen at 2009-06-17 |
138 |
int w; |
|
139 |
int h; |
|
140 |
int d; |
|
141 |
bool is_null; |
| 67ad051 by Lars Knoll at 2009-03-23 |
142 |
|
|
143 |
private: |
|
144 |
friend class QPixmap; |
| dc789e3 by Trond Kjernaasen at 2009-03-23 |
145 |
friend class QX11PixmapData; |
| 7dcf984 by Jason Barron at 2009-09-23 |
146 |
friend class QS60PixmapData; |
| 4531ffb by Samuel Rødal at 2009-10-29 |
147 |
friend class QImagePixmapCleanupHooks; // Needs to set is_cached |
| 65702aa by Tom Cooksey at 2009-07-29 |
148 |
friend class QGLTextureCache; //Needs to check the reference count |
| fe00645 by Harald Fernengel at 2009-08-20 |
149 |
friend class QExplicitlySharedDataPointer<QPixmapData>; |
| 67ad051 by Lars Knoll at 2009-03-23 |
150 |
|
|
151 |
QAtomicInt ref; |
|
152 |
int detach_no; |
|
153 |
|
|
154 |
PixelType type; |
|
155 |
int id; |
|
156 |
int ser_no; |
|
157 |
uint is_cached; |
|
158 |
}; |
|
159 |
|
|
160 |
# define QT_XFORM_TYPE_MSBFIRST 0 |
|
161 |
# define QT_XFORM_TYPE_LSBFIRST 1 |
|
162 |
# if defined(Q_WS_WIN) |
|
163 |
# define QT_XFORM_TYPE_WINDOWSPIXMAP 2 |
|
164 |
# endif |
|
165 |
extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); |
|
166 |
|
|
167 |
QT_END_NAMESPACE |
|
168 |
|
|
169 |
#endif // QPIXMAPDATA_P_H |