Go to the
documentation of this file.
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 QIMAGEIOHANDLER_H
00043 #define QIMAGEIOHANDLER_H
00044
00045 #include <QtCore/qplugin.h>
00046 #include <QtCore/qfactoryinterface.h>
00047 #include <QtCore/qscopedpointer.h>
00048
00049 QT_BEGIN_HEADER
00050
00051 QT_BEGIN_NAMESPACE
00052
00053 QT_MODULE(Gui)
00054
00055 class QImage;
00056 class QRect;
00057 class QSize;
00058 class QVariant;
00059
00060 class QImageIOHandlerPrivate;
00061 class Q_GUI_EXPORT QImageIOHandler
00062 {
00063 Q_DECLARE_PRIVATE(QImageIOHandler)
00064 public:
00065 QImageIOHandler();
00066 virtual ~QImageIOHandler();
00067
00068 void setDevice(QIODevice *device);
00069 QIODevice *device() const;
00070
00071 void setFormat(const QByteArray &format);
00072 void setFormat(const QByteArray &format) const;
00073 QByteArray format() const;
00074
00075 virtual QByteArray name() const;
00076
00077 virtual bool canRead() const = 0;
00078 virtual bool read(QImage *image) = 0;
00079 virtual bool write(const QImage &image);
00080
00081 enum ImageOption {
00082 Size,
00083 ClipRect,
00084 Description,
00085 ScaledClipRect,
00086 ScaledSize,
00087 CompressionRatio,
00088 Gamma,
00089 Quality,
00090 Name,
00091 SubType,
00092 IncrementalReading,
00093 Endianness,
00094 Animation,
00095 BackgroundColor,
00096 ImageFormat
00097 };
00098 virtual QVariant option(ImageOption option) const;
00099 virtual void setOption(ImageOption option, const QVariant &value);
00100 virtual bool supportsOption(ImageOption option) const;
00101
00102
00103 virtual bool jumpToNextImage();
00104 virtual bool jumpToImage(int imageNumber);
00105 virtual int loopCount() const;
00106 virtual int imageCount() const;
00107 virtual int nextImageDelay() const;
00108 virtual int currentImageNumber() const;
00109 virtual QRect currentImageRect() const;
00110
00111 protected:
00112 QImageIOHandler(QImageIOHandlerPrivate &dd);
00113 QScopedPointer<QImageIOHandlerPrivate> d_ptr;
00114 private:
00115 Q_DISABLE_COPY(QImageIOHandler)
00116 };
00117
00118 struct Q_GUI_EXPORT QImageIOHandlerFactoryInterface : public QFactoryInterface
00119 {
00120 virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0;
00121 };
00122
00123 #define QImageIOHandlerFactoryInterface_iid "com.trolltech.Qt.QImageIOHandlerFactoryInterface"
00124 Q_DECLARE_INTERFACE(QImageIOHandlerFactoryInterface, QImageIOHandlerFactoryInterface_iid)
00125
00126 class Q_GUI_EXPORT QImageIOPlugin : public QObject, public QImageIOHandlerFactoryInterface
00127 {
00128 Q_OBJECT
00129 Q_INTERFACES(QImageIOHandlerFactoryInterface:QFactoryInterface)
00130 public:
00131 explicit QImageIOPlugin(QObject *parent = 0);
00132 virtual ~QImageIOPlugin();
00133
00134 enum Capability {
00135 CanRead = 0x1,
00136 CanWrite = 0x2,
00137 CanReadIncremental = 0x4
00138 };
00139 Q_DECLARE_FLAGS(Capabilities, Capability)
00140
00141 virtual Capabilities capabilities(QIODevice *device, const QByteArray &format) const = 0;
00142 virtual QStringList keys() const = 0;
00143 virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0;
00144 };
00145
00146 Q_DECLARE_OPERATORS_FOR_FLAGS(QImageIOPlugin::Capabilities)
00147
00148 QT_END_NAMESPACE
00149
00150 QT_END_HEADER
00151
00152 #endif // QIMAGEIOHANDLER_H