source: trunk/src/gui/image/qpixmapdata_p.h@ 603

Last change on this file since 603 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 5.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
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**
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** 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 have questions regarding the use of this file, please contact
37** Nokia 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
59QT_BEGIN_NAMESPACE
60
61class Q_GUI_EXPORT QPixmapData
62{
63public:
64 enum PixelType {
65 // WARNING: Do not change the first two
66 // Must match QPixmap::Type
67 PixmapType, BitmapType
68 };
69#if defined(Q_OS_SYMBIAN)
70 enum NativeType {
71 FbsBitmap,
72 SgImage
73 };
74#endif
75 enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
76 OpenGLClass, OpenVGClass, CustomClass = 1024 };
77
78 QPixmapData(PixelType pixelType, int classId);
79 virtual ~QPixmapData();
80
81 virtual QPixmapData *createCompatiblePixmapData() const;
82
83 virtual void resize(int width, int height) = 0;
84 virtual void fromImage(const QImage &image,
85 Qt::ImageConversionFlags flags) = 0;
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,
90 Qt::ImageConversionFlags flags);
91
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
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; }
120
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
128protected:
129 void setSerialNumber(int serNo);
130 int w;
131 int h;
132 int d;
133 bool is_null;
134
135private:
136 friend class QPixmap;
137 friend class QX11PixmapData;
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>;
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
157extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int);
158
159QT_END_NAMESPACE
160
161#endif // QPIXMAPDATA_P_H
Note: See TracBrowser for help on using the repository browser.