| 1 | /* |
| 2 | xcf.cpp: A Qt 5 plug-in for reading GIMP XCF image files |
| 3 | SPDX-FileCopyrightText: 2001 lignum Computing Inc. <allen@lignumcomputing.com> |
| 4 | SPDX-FileCopyrightText: 2004 Melchior FRANZ <mfranz@kde.org> |
| 5 | |
| 6 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef KIMG_XCF_P_H |
| 10 | #define KIMG_XCF_P_H |
| 11 | |
| 12 | #include <QImageIOPlugin> |
| 13 | |
| 14 | class XCFHandler : public QImageIOHandler |
| 15 | { |
| 16 | public: |
| 17 | XCFHandler(); |
| 18 | |
| 19 | bool canRead() const override; |
| 20 | bool read(QImage *image) override; |
| 21 | bool write(const QImage &image) override; |
| 22 | |
| 23 | bool supportsOption(QImageIOHandler::ImageOption option) const override; |
| 24 | QVariant option(QImageIOHandler::ImageOption option) const override; |
| 25 | |
| 26 | static bool canRead(QIODevice *device); |
| 27 | |
| 28 | private: |
| 29 | /*! |
| 30 | * \brief m_imageSize |
| 31 | * Image size cache used by option() |
| 32 | */ |
| 33 | QSize m_imageSize; |
| 34 | }; |
| 35 | |
| 36 | class XCFPlugin : public QImageIOPlugin |
| 37 | { |
| 38 | Q_OBJECT |
| 39 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "xcf.json" ) |
| 40 | |
| 41 | public: |
| 42 | Capabilities capabilities(QIODevice *device, const QByteArray &format) const override; |
| 43 | QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override; |
| 44 | }; |
| 45 | |
| 46 | #endif // KIMG_XCF_P_H |
| 47 | |