aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickimageprovider.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-09 13:44:31 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-31 11:04:06 +0100
commita6e661d25bf7ebeb8f4e58925aa9375f5ca10ef3 (patch)
treeeff5daac853cbc4d6e75a25a71b89a19141d21e0 /src/quick/util/qquickimageprovider.cpp
parent276d00cff956cb54612ec425b7c40eb50a20d78a (diff)
Image ColorSpace bindings for Quick/QML
Adds a ColorSpace type mapped to QColorSpace, and adds a property to Image nodes to read and change it, converting the image if necessary on read. Fixes: QTBUG-80616 Change-Id: Ie80c8bc045f66de01de3a5d2c4a9974f07d2871d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/util/qquickimageprovider.cpp')
-rw-r--r--src/quick/util/qquickimageprovider.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index db82b2d807..80873e2ad5 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -43,6 +43,7 @@
#include "qquickpixmapcache_p.h"
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qqmlglobal_p.h>
+#include <QtGui/qcolorspace.h>
QT_BEGIN_NAMESPACE
@@ -510,6 +511,7 @@ public:
{
}
+ QColorSpace targetColorSpace;
QQuickImageProviderOptions::AutoTransform autoTransform = QQuickImageProviderOptions::UsePluginDefaultTransform;
bool preserveAspectRatioCrop = false;
bool preserveAspectRatioFit = false;
@@ -558,7 +560,8 @@ bool QQuickImageProviderOptions::operator==(const QQuickImageProviderOptions &ot
{
return d->autoTransform == other.d->autoTransform &&
d->preserveAspectRatioCrop == other.d->preserveAspectRatioCrop &&
- d->preserveAspectRatioFit == other.d->preserveAspectRatioFit;
+ d->preserveAspectRatioFit == other.d->preserveAspectRatioFit &&
+ d->targetColorSpace == other.d->targetColorSpace;
}
/*!
@@ -602,6 +605,19 @@ void QQuickImageProviderOptions::setPreserveAspectRatioFit(bool preserveAspectRa
d->preserveAspectRatioFit = preserveAspectRatioFit;
}
+/*!
+ Returns the color space the image provider should return the image in.
+*/
+QColorSpace QQuickImageProviderOptions::targetColorSpace() const
+{
+ return d->targetColorSpace;
+}
+
+void QQuickImageProviderOptions::setTargetColorSpace(const QColorSpace &colorSpace)
+{
+ d->targetColorSpace = colorSpace;
+}
+
QQuickImageProviderWithOptions::QQuickImageProviderWithOptions(ImageType type, Flags flags)
: QQuickAsyncImageProvider()
{