19#include <QtCore/qcoreapplication.h>
20#include <QtCore/qstring.h>
21#include <QtGui/qpixmap.h>
22#include <QtCore/qmutex.h>
23#include <QtCore/qurl.h>
24#include <private/qtquickglobal_p.h>
25#include <QtQuick/qquickimageprovider.h>
31class QQuickTextureFactory;
62 UsePluginDefaultTransform = -1,
64 DoNotApplyTransform = 1
67 QQuickImageProviderOptions();
68 ~QQuickImageProviderOptions();
70 QQuickImageProviderOptions(
const QQuickImageProviderOptions&);
71 QQuickImageProviderOptions& operator=(
const QQuickImageProviderOptions&);
73 bool operator==(
const QQuickImageProviderOptions&)
const;
75 AutoTransform autoTransform()
const;
76 void setAutoTransform(AutoTransform autoTransform);
78 bool preserveAspectRatioCrop()
const;
79 void setPreserveAspectRatioCrop(
bool preserveAspectRatioCrop);
81 bool preserveAspectRatioFit()
const;
82 void setPreserveAspectRatioFit(
bool preserveAspectRatioFit);
84 QColorSpace targetColorSpace()
const;
85 void setTargetColorSpace(
const QColorSpace &colorSpace);
87 QRectF sourceClipRect()
const;
88 void setSourceClipRect(
const QRectF &rect);
91 QSharedDataPointer<QQuickImageProviderOptionsPrivate> d;
95
96
97
98
99
100
101
102
103
106 Q_DECLARE_TR_FUNCTIONS(QQuickPixmap)
108 enum Status { Null, Ready, Error, Loading };
114 Q_DECLARE_FLAGS(Options, Option)
118 QQuickPixmap(QQmlEngine *,
const QUrl &, Options options);
119 QQuickPixmap(QQmlEngine *,
const QUrl &,
const QRect ®ion,
const QSize &);
138 void setPixmap(
const QQuickPixmap &other);
148 void load(QQmlEngine *,
const QUrl &);
149 void load(QQmlEngine *,
const QUrl &, QQuickPixmap::Options options);
150 void load(QQmlEngine *,
const QUrl &,
const QRect &requestRegion,
const QSize &requestSize);
151 void load(QQmlEngine *,
const QUrl &,
const QRect &requestRegion,
const QSize &requestSize, QQuickPixmap::Options options);
152 void load(QQmlEngine *,
const QUrl &,
const QRect &requestRegion,
const QSize &requestSize,
153 QQuickPixmap::Options options,
const QQuickImageProviderOptions &providerOptions,
int frame = 0,
int frameCount = 1,
154 qreal devicePixelRatio = 1.0);
156 const QRect &requestRegion,
const QSize &requestSize,
157 const QQuickImageProviderOptions &providerOptions,
int frame = 0,
int frameCount = 1);
160 void clear(QObject *);
168 static bool isCached(
const QUrl &url,
const QRect &requestRegion,
const QSize &requestSize,
169 const int frame,
const QQuickImageProviderOptions &options);
175 Q_DISABLE_COPY(QQuickPixmap)
180Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickPixmap::Options)
184class Q_QUICK_EXPORT QQuickImageProviderWithOptions :
public QQuickAsyncImageProvider
187 QQuickImageProviderWithOptions(ImageType type, Flags flags = Flags());
189 QImage requestImage(
const QString &id, QSize *size,
const QSize& requestedSize) override;
190 QPixmap requestPixmap(
const QString &id, QSize *size,
const QSize& requestedSize) override;
191 QQuickTextureFactory *requestTexture(
const QString &id, QSize *size,
const QSize &requestedSize) override;
192 QQuickImageResponse *requestImageResponse(
const QString &id,
const QSize &requestedSize) override;
194 virtual QImage requestImage(
const QString &id, QSize *size,
const QSize& requestedSize,
const QQuickImageProviderOptions &options);
195 virtual QPixmap requestPixmap(
const QString &id, QSize *size,
const QSize& requestedSize,
const QQuickImageProviderOptions &options);
196 virtual QQuickTextureFactory *requestTexture(
const QString &id, QSize *size,
const QSize &requestedSize,
const QQuickImageProviderOptions &options);
197 virtual QQuickImageResponse *requestImageResponse(
const QString &id,
const QSize &requestedSize,
const QQuickImageProviderOptions &options);
199 static QSize loadSize(
const QSize &originalSize,
const QSize &requestedSize,
const QByteArray &format,
const QQuickImageProviderOptions &options,
200 qreal devicePixelRatio = 1.0);
201 static QQuickImageProviderWithOptions *checkedCast(QQuickImageProvider *provider);
bool autoTransform() const
ImageReaderError error() const
Returns the type of error that occurred last.
qreal width() const
Returns the width of the generated outlines.
bool isLoading() const
Returns true if the incubator's status() is Loading.
bool isError() const
Returns true if the incubator's status() is Error.
bool isNull() const
Returns true if the incubator's status() is Null.
Status status() const
Return the current status of the incubator.
bool isReady() const
Returns true if the incubator's status() is Ready.
The QQuickAsyncImageProvider class provides an interface for asynchronous control of QML image reques...
QImage image() const override
Returns an image version of this texture.
QSize textureSize() const override
Returns the size of the texture.
int textureByteCount() const override
Returns the number of bytes of memory the texture consumes.
QSGTexture * createTexture(QQuickWindow *window) const override
This function is called on the scene graph rendering thread to create a QSGTexture instance from the ...
QQuickImageProviderOptionsPrivate()
bool preserveAspectRatioFit
bool preserveAspectRatioCrop
QColorSpace targetColorSpace
QQuickImageProviderOptions::AutoTransform autoTransform
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
bool isProviderWithOptions
The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image request...
The QQuickImageResponse class provides an interface for asynchronous image loading in QQuickAsyncImag...
QColorSpace colorSpace() const
QQuickPixmap(QQmlEngine *, const QUrl &, const QRect ®ion, const QSize &)
QQuickPixmap(QQmlEngine *, const QUrl &, Options options)
void load(QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize, QQuickPixmap::Options options, const QQuickImageProviderOptions &providerOptions, int frame=0, int frameCount=1, qreal devicePixelRatio=1.0)
bool connectDownloadProgress(QObject *, const char *)
static bool isScalableImageFormat(const QUrl &url)
QQuickTextureFactory * textureFactory() const
void load(QQmlEngine *, const QUrl &, QQuickPixmap::Options options)
const QSize & requestSize() const
void load(QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize, QQuickPixmap::Options options)
QQuickPixmap(QQmlEngine *, const QUrl &)
QQuickPixmap(const QUrl &, const QImage &image)
static bool isCached(const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const int frame, const QQuickImageProviderOptions &options)
void load(QQmlEngine *, const QUrl &)
void loadImageFromDevice(QQmlEngine *engine, QIODevice *device, const QUrl &url, const QRect &requestRegion, const QSize &requestSize, const QQuickImageProviderOptions &providerOptions, int frame=0, int frameCount=1)
const QRect & requestRegion() const
const QSize & implicitSize() const
void setImage(const QImage &)
void setPixmap(const QQuickPixmap &other)
static const QLatin1String itemGrabberScheme
void load(QQmlEngine *, const QUrl &, const QRect &requestRegion, const QSize &requestSize)
bool connectFinished(QObject *, const char *)
bool connectFinished(QObject *, int)
bool connectDownloadProgress(QObject *, int)
The QQuickTextureFactory class provides an interface for loading custom textures from QML....
void clear()
Clears the entire result set and releases any associated resources.