00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QPIXMAPDATA_P_H
00043 #define QPIXMAPDATA_P_H
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #include <QtGui/qpixmap.h>
00057 #include <QtCore/qatomic.h>
00058
00059 QT_BEGIN_NAMESPACE
00060
00061 class Q_GUI_EXPORT QPixmapData
00062 {
00063 public:
00064 enum PixelType {
00065
00066
00067 PixmapType, BitmapType
00068 };
00069 enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
00070 OpenGLClass, OpenVGClass, CustomClass = 1024 };
00071
00072 QPixmapData(PixelType pixelpType, int classId);
00073 virtual ~QPixmapData();
00074
00075 virtual void resize(int width, int height) = 0;
00076 virtual void fromImage(const QImage &image,
00077 Qt::ImageConversionFlags flags) = 0;
00078 virtual void fromFile(const QString &filename, const char *format,
00079 Qt::ImageConversionFlags flags);
00080 virtual void copy(const QPixmapData *data, const QRect &rect);
00081
00082 virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0;
00083 virtual void fill(const QColor &color) = 0;
00084 virtual QBitmap mask() const;
00085 virtual void setMask(const QBitmap &mask);
00086 virtual bool hasAlphaChannel() const = 0;
00087 virtual QPixmap transformed(const QTransform &matrix,
00088 Qt::TransformationMode mode) const;
00089 virtual void setAlphaChannel(const QPixmap &alphaChannel);
00090 virtual QPixmap alphaChannel() const;
00091 virtual QImage toImage() const = 0;
00092 virtual QPaintEngine* paintEngine() const = 0;
00093
00094 inline int serialNumber() const { return ser_no; }
00095
00096 inline PixelType pixelType() const { return type; }
00097 inline ClassId classId() const { return static_cast<ClassId>(id); }
00098
00099 virtual QImage* buffer();
00100
00101 int width() const { return metric(QPaintDevice::PdmWidth); }
00102 int height() const { return metric(QPaintDevice::PdmHeight); }
00103 int numColors() const { return metric(QPaintDevice::PdmNumColors); }
00104 int depth() const { return metric(QPaintDevice::PdmDepth); }
00105
00106 protected:
00107 void setSerialNumber(int serNo);
00108
00109 private:
00110 friend class QPixmap;
00111 friend class QGLContextPrivate;
00112 friend class QX11PixmapData;
00113
00114 QAtomicInt ref;
00115 int detach_no;
00116
00117 PixelType type;
00118 int id;
00119 int ser_no;
00120 uint is_cached;
00121 };
00122
00123 #ifdef Q_WS_WIN
00124 #ifndef Q_OS_WINCE
00125 QPixmap convertHIconToPixmap( const HICON icon);
00126 #else
00127 QPixmap convertHIconToPixmap( const HICON icon, bool large = false);
00128 #endif
00129 QPixmap loadIconFromShell32( int resourceId, int size );
00130 #endif
00131
00132 # define QT_XFORM_TYPE_MSBFIRST 0
00133 # define QT_XFORM_TYPE_LSBFIRST 1
00134 # if defined(Q_WS_WIN)
00135 # define QT_XFORM_TYPE_WINDOWSPIXMAP 2
00136 # endif
00137 extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int);
00138
00139 QT_END_NAMESPACE
00140
00141 #endif // QPIXMAPDATA_P_H