Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtGui/qimageiohandler.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QIMAGEIOHANDLER_H
0005 #define QIMAGEIOHANDLER_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtGui/qimage.h>
0009 #include <QtCore/qiodevice.h>
0010 #include <QtCore/qplugin.h>
0011 #include <QtCore/qfactoryinterface.h>
0012 #include <QtCore/qscopedpointer.h>
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 
0017 class QImage;
0018 class QRect;
0019 class QSize;
0020 class QVariant;
0021 
0022 class QImageIOHandlerPrivate;
0023 class Q_GUI_EXPORT QImageIOHandler
0024 {
0025     Q_DECLARE_PRIVATE(QImageIOHandler)
0026 public:
0027     QImageIOHandler();
0028     virtual ~QImageIOHandler();
0029 
0030     void setDevice(QIODevice *device);
0031     QIODevice *device() const;
0032 
0033     void setFormat(const QByteArray &format);
0034     void setFormat(const QByteArray &format) const;
0035     QByteArray format() const;
0036 
0037     virtual bool canRead() const = 0;
0038     virtual bool read(QImage *image) = 0;
0039     virtual bool write(const QImage &image);
0040 
0041     enum ImageOption {
0042         Size,
0043         ClipRect,
0044         Description,
0045         ScaledClipRect,
0046         ScaledSize,
0047         CompressionRatio,
0048         Gamma,
0049         Quality,
0050         Name,
0051         SubType,
0052         IncrementalReading,
0053         Endianness,
0054         Animation,
0055         BackgroundColor,
0056         ImageFormat,
0057         SupportedSubTypes,
0058         OptimizedWrite,
0059         ProgressiveScanWrite,
0060         ImageTransformation
0061     };
0062 
0063     enum Transformation {
0064         TransformationNone = 0,
0065         TransformationMirror = 1,
0066         TransformationFlip = 2,
0067         TransformationRotate180 = TransformationMirror | TransformationFlip,
0068         TransformationRotate90 = 4,
0069         TransformationMirrorAndRotate90 = TransformationMirror | TransformationRotate90,
0070         TransformationFlipAndRotate90 = TransformationFlip | TransformationRotate90,
0071         TransformationRotate270 = TransformationRotate180 | TransformationRotate90
0072     };
0073     Q_DECLARE_FLAGS(Transformations, Transformation)
0074 
0075     virtual QVariant option(ImageOption option) const;
0076     virtual void setOption(ImageOption option, const QVariant &value);
0077     virtual bool supportsOption(ImageOption option) const;
0078 
0079     // incremental loading
0080     virtual bool jumpToNextImage();
0081     virtual bool jumpToImage(int imageNumber);
0082     virtual int loopCount() const;
0083     virtual int imageCount() const;
0084     virtual int nextImageDelay() const;
0085     virtual int currentImageNumber() const;
0086     virtual QRect currentImageRect() const;
0087 
0088     static bool allocateImage(QSize size, QImage::Format format, QImage *image);
0089 
0090 protected:
0091     QImageIOHandler(QImageIOHandlerPrivate &dd);
0092     QScopedPointer<QImageIOHandlerPrivate> d_ptr;
0093 private:
0094     Q_DISABLE_COPY(QImageIOHandler)
0095 };
0096 
0097 #ifndef QT_NO_IMAGEFORMATPLUGIN
0098 
0099 #define QImageIOHandlerFactoryInterface_iid "org.qt-project.Qt.QImageIOHandlerFactoryInterface"
0100 
0101 class Q_GUI_EXPORT QImageIOPlugin : public QObject
0102 {
0103     Q_OBJECT
0104 public:
0105     explicit QImageIOPlugin(QObject *parent = nullptr);
0106     ~QImageIOPlugin();
0107 
0108     enum Capability {
0109         CanRead = 0x1,
0110         CanWrite = 0x2,
0111         CanReadIncremental = 0x4
0112     };
0113     Q_DECLARE_FLAGS(Capabilities, Capability)
0114 
0115     virtual Capabilities capabilities(QIODevice *device, const QByteArray &format) const = 0;
0116     virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0;
0117 };
0118 
0119 Q_DECLARE_OPERATORS_FOR_FLAGS(QImageIOPlugin::Capabilities)
0120 
0121 #endif // QT_NO_IMAGEFORMATPLUGIN
0122 
0123 QT_END_NAMESPACE
0124 
0125 #endif // QIMAGEIOHANDLER_H