blob: 57c97ffcbbb7b86d576c9b736c1c386bb15e2390 (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// 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
#ifndef QQUICKIMAGEPROVIDER_H
#define QQUICKIMAGEPROVIDER_H
#include <QtQuick/qtquickglobal.h>
#include <QtGui/qimage.h>
#include <QtGui/qpixmap.h>
#include <QtQml/qqmlengine.h>
QT_BEGIN_NAMESPACE
class QQuickImageProviderPrivate;
class QQuickAsyncImageProviderPrivate;
class QQuickImageProviderOptionsPrivate;
class QSGTexture;
class QQuickWindow;
class Q_QUICK_EXPORT QQuickTextureFactory : public QObject
{
Q_OBJECT
public:
QQuickTextureFactory();
~QQuickTextureFactory() override;
virtual QSGTexture *createTexture(QQuickWindow *window) const = 0;
virtual QSize textureSize() const = 0;
virtual int textureByteCount() const = 0;
virtual QImage image() const;
static QQuickTextureFactory *textureFactoryForImage(const QImage &image);
};
class QQuickImageResponsePrivate;
class Q_QUICK_EXPORT QQuickImageResponse : public QObject
{
Q_OBJECT
public:
QQuickImageResponse();
~QQuickImageResponse() override;
virtual QQuickTextureFactory *textureFactory() const = 0;
virtual QString errorString() const;
public Q_SLOTS:
virtual void cancel();
Q_SIGNALS:
void finished();
private:
Q_DECLARE_PRIVATE(QQuickImageResponse)
Q_PRIVATE_SLOT(d_func(), void _q_finished())
};
class QQuickImageProviderOptions;
class Q_QUICK_EXPORT QQuickImageProvider : public QQmlImageProviderBase
{
friend class QQuickImageProviderWithOptions;
Q_OBJECT
public:
QQuickImageProvider(ImageType type, Flags flags = Flags());
~QQuickImageProvider() override;
ImageType imageType() const override;
Flags flags() const override;
virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize);
virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize);
virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize);
private:
QQuickImageProviderPrivate *d;
};
class Q_QUICK_EXPORT QQuickAsyncImageProvider : public QQuickImageProvider
{
public:
QQuickAsyncImageProvider();
~QQuickAsyncImageProvider() override;
virtual QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) = 0;
private:
QQuickAsyncImageProviderPrivate *d;
};
QT_END_NAMESPACE
#endif // QQUICKIMAGEPROVIDER_H
|