1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2003 Dominik Seichter <domseichter@web.de>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KIMG_TGA_P_H
9#define KIMG_TGA_P_H
10
11#include <QImageIOPlugin>
12#include <QScopedPointer>
13
14class TGAHandlerPrivate;
15class TGAHandler : public QImageIOHandler
16{
17public:
18 TGAHandler();
19
20 bool canRead() const override;
21 bool read(QImage *image) override;
22 bool write(const QImage &image) override;
23
24 bool supportsOption(QImageIOHandler::ImageOption option) const override;
25 void setOption(ImageOption option, const QVariant &value) override;
26 QVariant option(QImageIOHandler::ImageOption option) const override;
27
28 static bool canRead(QIODevice *device);
29
30private:
31 bool writeIndexed(const QImage &image);
32 bool writeGrayscale(const QImage &image);
33 bool writeRGB555(const QImage &image);
34 bool writeRGBA(const QImage &image);
35
36 bool writeMetadata(const QImage &image);
37 bool readMetadata(QImage &image);
38
39 const QScopedPointer<TGAHandlerPrivate> d;
40};
41
42class TGAPlugin : public QImageIOPlugin
43{
44 Q_OBJECT
45 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "tga.json")
46
47public:
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_TGA_P_H
53

source code of kimageformats/src/imageformats/tga_p.h