8#include <QtQuick/private/qsgcontext_p.h>
9#include <private/qqmlglobal_p.h>
10#include <QtGui/qcolorspace.h>
368 qWarning(
"ImageProvider supports Image type but has not implemented requestImage()");
397 qWarning(
"ImageProvider supports Pixmap type but has not implemented requestPixmap()");
428 qWarning(
"ImageProvider supports Texture type but has not implemented requestTexture()");
588 QQuickImageProvider::d->
type =
type;
631 qWarning(
"ImageProvider is of ImageResponse type but has not implemented requestImageResponse()");
649 qreal devicePixelRatio)
652 const bool formatIsScalable = (
format ==
"svg" ||
format ==
"svgz" ||
format ==
"pdf");
653 const bool noRequestedSize = requestedSize.
width() <= 0 && requestedSize.
height() <= 0;
654 if ((noRequestedSize && !formatIsScalable) || originalSize.
isEmpty())
659 if (noRequestedSize && formatIsScalable)
660 return originalSize * devicePixelRatio;
664 if (!preserveAspectCropOrFit && formatIsScalable && !requestedSize.
isEmpty())
665 return requestedSize;
668 if (requestedSize.
width() && (preserveAspectCropOrFit || formatIsScalable ||
669 requestedSize.
width() < originalSize.
width())) {
672 if (requestedSize.
height() && (preserveAspectCropOrFit || formatIsScalable ||
677 else if (!preserveAspectCropOrFit && (hr < ratio))
679 else if (preserveAspectCropOrFit && (hr > ratio))
699#include "moc_qquickimageprovider.cpp"
The QColorSpace class provides a color space abstraction.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
friend class QQuickImageProvider
ImageType
Defines the type of image supported by this image provider.
The QQuickAsyncImageProvider class provides an interface for asynchronous control of QML image reques...
QQuickAsyncImageProvider()
~QQuickAsyncImageProvider() override
QQuickImageProviderOptionsPrivate()
bool preserveAspectRatioFit
bool preserveAspectRatioCrop
QColorSpace targetColorSpace
QQuickImageProviderOptions::AutoTransform autoTransform
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
bool operator==(const QQuickImageProviderOptions &) const
bool preserveAspectRatioFit() const
Returns whether the image request is for a PreserveAspectFit Image.
void setPreserveAspectRatioCrop(bool preserveAspectRatioCrop)
QColorSpace targetColorSpace() const
Returns the color space the image provider should return the image in.
AutoTransform
Whether the image provider should apply transformation metadata on read().
@ UsePluginDefaultTransform
AutoTransform autoTransform() const
Returns whether the image provider should apply transformation metadata on read().
QQuickImageProviderOptions()
void setPreserveAspectRatioFit(bool preserveAspectRatioFit)
~QQuickImageProviderOptions()
void setAutoTransform(AutoTransform autoTransform)
QQuickImageProviderOptions & operator=(const QQuickImageProviderOptions &)
bool preserveAspectRatioCrop() const
Returns whether the image request is for a PreserveAspectCrop Image.
void setTargetColorSpace(const QColorSpace &colorSpace)
QQuickImageProvider::ImageType type
bool isProviderWithOptions
QQuickImageProvider::Flags flags
static QQuickImageProviderWithOptions * checkedCast(QQuickImageProvider *provider)
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override
Implement this method to return the pixmap with id.
QQuickTextureFactory * requestTexture(const QString &id, QSize *size, const QSize &requestedSize) override
Implement this method to return the texture with id.
QQuickImageResponse * requestImageResponse(const QString &id, const QSize &requestedSize) override
Implement this method to return the job that will provide the texture with id.
static QSize loadSize(const QSize &originalSize, const QSize &requestedSize, const QByteArray &format, const QQuickImageProviderOptions &options, qreal devicePixelRatio=1.0)
Returns the recommended scaled image size for loading and storage.
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override
Implement this method to return the image with id.
The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image request...
ImageType imageType() const override
Returns the image type supported by this provider.
virtual QQuickTextureFactory * requestTexture(const QString &id, QSize *size, const QSize &requestedSize)
Implement this method to return the texture with id.
Flags flags() const override
Returns the flags set for this provider.
friend class QQuickImageProviderWithOptions
virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize)
Implement this method to return the image with id.
virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
Implement this method to return the pixmap with id.
~QQuickImageProvider() override
Destroys the QQuickImageProvider.
The QQuickImageResponse class provides an interface for asynchronous image loading in QQuickAsyncImag...
virtual QString errorString() const
Returns the error string for the job execution.
void finished()
Signals that the job execution has finished (be it successfully, because an error happened or because...
~QQuickImageResponse() override
Destructs the image response.
QQuickImageResponse()
Constructs the image response.
virtual void cancel()
This method is used to communicate that the response is no longer required by the engine.
The QQuickTextureFactory class provides an interface for loading custom textures from QML....
~QQuickTextureFactory() override
Destroys the texture factory.
virtual QImage image() const
Returns an image version of this texture.
static QQuickTextureFactory * textureFactoryForImage(const QImage &image)
Returns a QQuickTextureFactory holding the given image.
QQuickTextureFactory()
Constructs a texture factory.
static QQuickTextureFactory * createTextureFactoryFromImage(const QImage &image)
Calls into the scene graph adaptation if available and creates a texture factory.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
int qRound(qfloat16 d) noexcept
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum format
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.