blob: f98b586407b05955cfe1a5f44f0e99cd1c869757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qimageiohandler.h>
#include <qstringlist.h>
#ifdef QT_NO_IMAGEFORMAT_GIF
#undef QT_NO_IMAGEFORMAT_GIF
#endif
#include <qgifhandler_p.h>
QT_BEGIN_NAMESPACE
class QGifPlugin : public QImageIOPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "gif.json")
public:
QGifPlugin();
~QGifPlugin();
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
QGifPlugin::QGifPlugin()
{
}
QGifPlugin::~QGifPlugin()
{
}
QImageIOPlugin::Capabilities QGifPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{
if (format == "gif" || (device && device->isReadable() && QGifHandler::canRead(device)))
return Capabilities(CanRead);
return { };
}
QImageIOHandler *QGifPlugin::create(QIODevice *device, const QByteArray &format) const
{
QImageIOHandler *handler = new QGifHandler;
handler->setDevice(device);
handler->setFormat(format);
return handler;
}
QT_END_NAMESPACE
#include "main.moc"
|