| 1 | /* |
| 2 | This file is part of the KDE project |
| 3 | SPDX-FileCopyrightText: 2025 Mirco Miranda <mircomir@outlook.com> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef KIMG_IFF_P_H |
| 9 | #define KIMG_IFF_P_H |
| 10 | |
| 11 | #include <QImageIOPlugin> |
| 12 | #include <QScopedPointer> |
| 13 | |
| 14 | class IFFHandlerPrivate; |
| 15 | class IFFHandler : public QImageIOHandler |
| 16 | { |
| 17 | public: |
| 18 | IFFHandler(); |
| 19 | |
| 20 | bool canRead() const override; |
| 21 | bool read(QImage *image) override; |
| 22 | |
| 23 | bool supportsOption(QImageIOHandler::ImageOption option) const override; |
| 24 | QVariant option(QImageIOHandler::ImageOption option) const override; |
| 25 | |
| 26 | bool jumpToNextImage() override; |
| 27 | bool jumpToImage(int imageNumber) override; |
| 28 | int imageCount() const override; |
| 29 | int currentImageNumber() const override; |
| 30 | |
| 31 | static bool canRead(QIODevice *device); |
| 32 | |
| 33 | private: |
| 34 | bool readStandardImage(QImage *image); |
| 35 | |
| 36 | bool readMayaImage(QImage *image); |
| 37 | |
| 38 | private: |
| 39 | const QScopedPointer<IFFHandlerPrivate> d; |
| 40 | }; |
| 41 | |
| 42 | class IFFPlugin : public QImageIOPlugin |
| 43 | { |
| 44 | Q_OBJECT |
| 45 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "iff.json" ) |
| 46 | |
| 47 | public: |
| 48 | Capabilities capabilities(QIODevice *device, const QByteArray &format) const override; |
| 49 | QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override; |
| 50 | }; |
| 51 | |
| 52 | #endif // KIMG_IFF_P_H |
| 53 | |