Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwebphandler_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QWEBPHANDLER_P_H
7#define QWEBPHANDLER_P_H
8
9#include <QtGui/qcolor.h>
10#include <QtGui/qcolorspace.h>
11#include <QtGui/qimage.h>
12#include <QtGui/qimageiohandler.h>
13#include <QtCore/qbytearray.h>
14#include <QtCore/qsize.h>
15
16#include "webp/decode.h"
17#include "webp/demux.h"
18
19QT_BEGIN_NAMESPACE
20
21class QWebpHandler : public QImageIOHandler
22{
23public:
24 QWebpHandler();
25 ~QWebpHandler();
26
27public:
28 bool canRead() const override;
29 bool read(QImage *image) override;
30
31 static bool canRead(QIODevice *device);
32
33 bool write(const QImage &image) override;
34 QVariant option(ImageOption option) const override;
35 void setOption(ImageOption option, const QVariant &value) override;
36 bool supportsOption(ImageOption option) const override;
37
38 int imageCount() const override;
39 int currentImageNumber() const override;
40 QRect currentImageRect() const override;
41 int loopCount() const override;
42 int nextImageDelay() const override;
43
44private:
45 bool ensureScanned() const;
46 bool ensureDemuxer();
47
48private:
49 enum ScanState {
50 ScanError = -1,
51 ScanNotScanned = 0,
52 ScanSuccess = 1,
53 };
54
55 int m_quality;
56 mutable ScanState m_scanState;
57 WebPBitstreamFeatures m_features;
58 uint32_t m_formatFlags;
59 int m_loop;
60 int m_frameCount;
61 QColor m_bgColor;
62 QByteArray m_rawData;
63 WebPData m_webpData;
64 WebPDemuxer *m_demuxer;
65 WebPIterator m_iter;
66 QColorSpace m_colorSpace;
67 QImage *m_composited; // For animation frames composition
68};
69
70QT_END_NAMESPACE
71
72#endif // WEBPHANDLER_H
QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const override
Creates and returns a QImageIOHandler subclass, with device and format set.
Definition main.cpp:47
Combined button and popup list for selecting options.