Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Move KisColorimetryUtils into Pigment as KoColorimetryUtils, and replace colorant API with it.

Wolthera van Hövell tot Westerflier70339693e65e
diff --git a/libs/pigment/CMakeLists.txt b/libs/pigment/CMakeLists.txt
index b08c65345c..2a18f8a307 100644
--- a/libs/pigment/CMakeLists.txt
+++ b/libs/pigment/CMakeLists.txt
@@ -33,6 +33,7 @@ set(kritapigment_SRCS
KoColorSpaceEngine.cpp
KoColorSpaceFactory.cpp
KoColorSpaceMaths.cpp
+ KoColorimetryUtils.cpp
KoCmykColorSpaceMaths.cpp
KoLabColorSpaceMaths.cpp
KoColorSpaceRegistry.cpp
diff --git a/libs/pigment/KoColorProfile.cpp b/libs/pigment/KoColorProfile.cpp
index 4eeb4877cf..2d5e509346 100644
--- a/libs/pigment/KoColorProfile.cpp
+++ b/libs/pigment/KoColorProfile.cpp
@@ -81,18 +81,18 @@ ColorPrimaries KoColorProfile::getColorPrimaries() const
{
if (d->primaries == -1) {
ColorPrimaries primaries = PRIMARIES_UNSPECIFIED;
- QVector<qreal> wp = getWhitePointxyY();
+ KoColorimetryUtils::xyY wp = getWhitePointxyY();
bool match = false;
if (hasColorants()) {
- QVector<qreal> col = getColorantsxyY();
+ QVector<KoColorimetryUtils::xyY> col = getColorantsxyY();
if (col.size()<8) {
KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(col.size() < 8, PRIMARIES_UNSPECIFIED);
//too few colorants.
d->primaries = int(primaries);
return (primaries);
}
- QVector<double> colorants = {wp[0], wp[1], col[0], col[1], col[3], col[4], col[6], col[7]};
+ QVector<double> colorants = {wp.x, wp.y, col[0].x, col[0].y, col[1].x, col[1].y, col[2].x, col[2].y};
QVector<double> compare;
QVector<ColorPrimaries> primariesList = {PRIMARIES_ITU_R_BT_709_5, PRIMARIES_ITU_R_BT_601_6, PRIMARIES_ITU_R_BT_470_6_SYSTEM_M,
diff --git a/libs/pigment/KoColorProfile.h b/libs/pigment/KoColorProfile.h
index 5f8acbe4a9..684d6bd4de 100644
--- a/libs/pigment/KoColorProfile.h
+++ b/libs/pigment/KoColorProfile.h
@@ -14,6 +14,7 @@
#include "KoColorProfileConstants.h"
#include "kritapigment_export.h"
+#include <KoColorimetryUtils.h>
/**
* Contains information needed for color transformation.
@@ -134,21 +135,21 @@ public:
*/
virtual bool hasColorants() const = 0;
/**
- * @return a qvector <double>(9) with the RGB colorants in XYZ
+ * @return a qvector <KoColorimetryUtils::XYZ> with the RGB colorants in XYZ
*/
- virtual QVector <qreal> getColorantsXYZ() const = 0;
+ virtual QVector <KoColorimetryUtils::XYZ> getColorantsXYZ() const = 0;
/**
- * @return a qvector <double>(9) with the RGB colorants in xyY
+ * @return a qvector <KoColorimetryUtils::xyY> with the colorants in xyY
*/
- virtual QVector <qreal> getColorantsxyY() const = 0;
+ virtual QVector <KoColorimetryUtils::xyY> getColorantsxyY() const = 0;
/**
- * @return a qvector <double>(3) with the whitepoint in XYZ
+ * @return a KoColorimetryUtils::XYZ with the whitepoint in XYZ
*/
- virtual QVector <qreal> getWhitePointXYZ() const = 0;
+ virtual KoColorimetryUtils::XYZ getWhitePointXYZ() const = 0;
/**
- * @return a qvector <double>(3) with the whitepoint in xyY
+ * @return a KoColorimetryUtils::xyY with the whitepoint in xyY
*/
- virtual QVector <qreal> getWhitePointxyY() const = 0;
+ virtual KoColorimetryUtils::xyY getWhitePointxyY() const = 0;
/**
* @return estimated gamma for RGB and Grayscale profiles
diff --git a/libs/pigment/KoColorProfileStorage.cpp b/libs/pigment/KoColorProfileStorage.cpp
index 9d1194231e..afb1df9ae3 100644
--- a/libs/pigment/KoColorProfileStorage.cpp
+++ b/libs/pigment/KoColorProfileStorage.cpp
@@ -197,14 +197,14 @@ QList<const KoColorProfile *> KoColorProfileStorage::profilesFor(const QVector<d
}
if (!colorants.isEmpty() && colorantType == PRIMARIES_UNSPECIFIED) {
- QVector<qreal> wp = profile->getWhitePointxyY();
+ KoColorimetryUtils::xyY wp = profile->getWhitePointxyY();
if (profile->hasColorants() && colorants.size() == 8) {
- QVector<qreal> col = profile->getColorantsxyY();
- if (col.size() < 8 || wp.size() < 2) {
+ QVector<KoColorimetryUtils::xyY> col = profile->getColorantsxyY();
+ if (col.size() < 3) {
// too few colorants, skip.
continue;
}
- QVector<double> compare = {wp[0], wp[1], col[0], col[1], col[3], col[4], col[6], col[7]};
+ QVector<double> compare = {wp.x, wp.y, col[0].x, col[0].y, col[1].x, col[1].y, col[2].x, col[2].y};
for (int i = 0; i < compare.size(); i++) {
colorantMatch = std::fabs(compare[i] - colorants[i]) < error;
@@ -213,11 +213,11 @@ QList<const KoColorProfile *> KoColorProfileStorage::profilesFor(const QVector<d
}
}
} else {
- if (wp.size() < 2 || colorants.size() < 2) {
+ if (colorants.size() < 2) {
// too few colorants, skip.
continue;
}
- if (std::fabs(wp[0] - colorants[0]) < error && std::fabs(wp[1] - colorants[1]) < error) {
+ if (std::fabs(wp.x - colorants[0]) < error && std::fabs(wp.y - colorants[1]) < error) {
colorantMatch = true;
}
}
diff --git a/libs/pigment/KoColorSpace.cpp b/libs/pigment/KoColorSpace.cpp
index d3f80df061..abeca6f128 100644
--- a/libs/pigment/KoColorSpace.cpp
+++ b/libs/pigment/KoColorSpace.cpp
@@ -55,7 +55,7 @@ KoColorSpace::KoColorSpace(const QString &id, const QString &name, KoMixColorsOp
d->transfoFromLABA16 = 0;
d->gamutXYY = QPolygonF();
d->TRCXYY = QPolygonF();
- d->colorants = QVector <qreal> (0);
+ d->colorants = QVector <KoColorimetryUtils::xyY> (0);
d->lumaCoefficients = QVector <qreal> (0);
d->iccEngine = 0;
d->deletability = NotOwnedByRegistry;
@@ -202,7 +202,7 @@ QPolygonF KoColorSpace::estimatedTRCXYY() const
// This is fixed to 5 since the maximum number of channels are 5 for CMYKA
QVector <float> channelValuesF(5);//for getting the coordinates.
- d->colorants.resize(3*colorChannelCount());
+ d->colorants = QVector<KoColorimetryUtils::xyY>(colorChannelCount());
const int segments = 10;
for (quint32 i=0; i<colorChannelCount(); i++) {
@@ -219,9 +219,9 @@ QPolygonF KoColorSpace::estimatedTRCXYY() const
}
if (j==0) {
colorantY = channelValuesF[1];
- d->colorants[3*i] = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
- d->colorants[3*i+1] = channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
- d->colorants[3*i+2] = channelValuesF[1];
+ d->colorants[i].x = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
+ d->colorants[i].y = channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
+ d->colorants[i].Y = channelValuesF[1];
}
d->TRCXYY << QPointF(channelValuesF[1]/colorantY, ((1.0/segments)*(segments-j)));
}
@@ -238,9 +238,9 @@ QPolygonF KoColorSpace::estimatedTRCXYY() const
if (j==0) {
colorantY = channelValuesF[1];
- d->colorants[3*i] = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
- d->colorants[3*i+1] = channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
- d->colorants[3*i+2] = channelValuesF[1];
+ d->colorants[i].x = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
+ d->colorants[i].y = channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
+ d->colorants[i].Y = channelValuesF[1];
}
d->TRCXYY << QPointF(channelValuesF[1]/colorantY, ((1.0/segments)*(j)));
}
@@ -266,7 +266,6 @@ QVector <qreal> KoColorSpace::lumaCoefficients() const
} else {
if (d->colorants.size() <= 0) {
if (profile() && profile()->hasColorants()) {
- d->colorants.resize(3 * colorChannelCount());
d->colorants = profile()->getColorantsxyY();
}
else {
@@ -274,16 +273,16 @@ QVector <qreal> KoColorSpace::lumaCoefficients() const
Q_UNUSED(p);
}
}
- if (d->colorants[2]<0 || d->colorants[5]<0 || d->colorants[8]<0) {
+ if (d->colorants.size() < 3 || d->colorants[0].Y<0 || d->colorants[1].Y<0 || d->colorants[2].Y<0) {
d->lumaCoefficients[0]=0.2126;
d->lumaCoefficients[1]=0.7152;
d->lumaCoefficients[2]=0.0722;
} else {
// luma coefficients need to add up to 1.0
- qreal sum = d->colorants[2] + d->colorants[5] + d->colorants[8];
- d->lumaCoefficients[0] = d->colorants[2] / sum;
- d->lumaCoefficients[1] = d->colorants[5] / sum;
- d->lumaCoefficients[2] = d->colorants[8] / sum;
+ qreal sum = d->colorants[0].Y + d->colorants[1].Y + d->colorants[2].Y;
+ d->lumaCoefficients[0] = d->colorants[0].Y / sum;
+ d->lumaCoefficients[1] = d->colorants[1].Y / sum;
+ d->lumaCoefficients[2] = d->colorants[2].Y / sum;
}
}
return d->lumaCoefficients;
diff --git a/libs/pigment/KoColorSpace_p.h b/libs/pigment/KoColorSpace_p.h
index 15fa9fdbc3..df5d85f555 100644
--- a/libs/pigment/KoColorSpace_p.h
+++ b/libs/pigment/KoColorSpace_p.h
@@ -8,6 +8,7 @@
#ifndef _KOCOLORSPACE_P_H_
#define _KOCOLORSPACE_P_H_
+#include "KoColorimetryUtils.h"
#include "KoColorSpace.h"
#include "KoColorSpaceEngine.h"
#include "KoColorConversionTransformation.h"
@@ -57,7 +58,7 @@ struct Q_DECL_HIDDEN KoColorSpace::Private {
QPolygonF gamutXYY;
QPolygonF TRCXYY;
- QVector <qreal> colorants;
+ QVector <KoColorimetryUtils::xyY> colorants;
QVector <qreal> lumaCoefficients;
KoColorSpaceEngine *iccEngine;
diff --git a/libs/surfacecolormanagementapi/KisColorimetryUtils.cpp b/libs/pigment/KoColorimetryUtils.cpp
similarity index 99%
rename from libs/surfacecolormanagementapi/KisColorimetryUtils.cpp
rename to libs/pigment/KoColorimetryUtils.cpp
index 86b648b261..f5e54992e0 100644
--- a/libs/surfacecolormanagementapi/KisColorimetryUtils.cpp
+++ b/libs/pigment/KoColorimetryUtils.cpp
@@ -5,11 +5,11 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#include "KisColorimetryUtils.h"
+#include "KoColorimetryUtils.h"
#include <QDebug>
-namespace KisColorimetryUtils
+namespace KoColorimetryUtils
{
QMatrix4x4 matrixFromColumns(const QVector3D &first, const QVector3D &second, const QVector3D &third)
@@ -452,4 +452,4 @@ QDebug operator<<(QDebug debug, const Colorimetry &value) {
return debug;
}
-} // namespace KisColorimetryUtils
\ No newline at end of file
+} // namespace KisColorimetryUtils
diff --git a/libs/surfacecolormanagementapi/KisColorimetryUtils.h b/libs/pigment/KoColorimetryUtils.h
similarity index 85%
rename from libs/surfacecolormanagementapi/KisColorimetryUtils.h
rename to libs/pigment/KoColorimetryUtils.h
index 9469719ea8..88e5d60771 100644
--- a/libs/surfacecolormanagementapi/KisColorimetryUtils.h
+++ b/libs/pigment/KoColorimetryUtils.h
@@ -13,9 +13,9 @@
#include <boost/operators.hpp>
#include <QDebug>
-#include <kritasurfacecolormanagementapi_export.h>
+#include <kritapigment_export.h>
-namespace KisColorimetryUtils
+namespace KoColorimetryUtils
{
// these functions were taken from KWin's colorimetry code
@@ -28,7 +28,7 @@ struct XYZ;
/**
* xyY, with Y unspecified
*/
-struct KRITASURFACECOLORMANAGEMENTAPI_EXPORT xy {
+struct KRITAPIGMENT_EXPORT xy {
double x;
double y;
@@ -37,7 +37,7 @@ struct KRITASURFACECOLORMANAGEMENTAPI_EXPORT xy {
bool operator==(const xy &other) const;
};
-struct KRITASURFACECOLORMANAGEMENTAPI_EXPORT xyY {
+struct KRITAPIGMENT_EXPORT xyY {
double x;
double y;
double Y;
@@ -46,7 +46,7 @@ struct KRITASURFACECOLORMANAGEMENTAPI_EXPORT xyY {
bool operator==(const xyY &other) const;
};
-struct KRITASURFACECOLORMANAGEMENTAPI_EXPORT XYZ {
+struct KRITAPIGMENT_EXPORT XYZ {
double X;
double Y;
double Z;
@@ -67,7 +67,7 @@ struct KRITASURFACECOLORMANAGEMENTAPI_EXPORT XYZ {
* Red, green and blue define the chromaticities ("absolute colors") of the red, green and blue LEDs on a display in xy coordinates
* White defines the the chromaticity of the reference white in xy coordinates
*/
-class KRITASURFACECOLORMANAGEMENTAPI_EXPORT Colorimetry
+class KRITAPIGMENT_EXPORT Colorimetry
{
public:
static const Colorimetry BT709;
@@ -144,11 +144,11 @@ private:
QMatrix4x4 m_fromXYZ;
};
-KRITASURFACECOLORMANAGEMENTAPI_EXPORT QDebug operator<<(QDebug debug, const xy &value);
-KRITASURFACECOLORMANAGEMENTAPI_EXPORT QDebug operator<<(QDebug debug, const xyY &value);
-KRITASURFACECOLORMANAGEMENTAPI_EXPORT QDebug operator<<(QDebug debug, const XYZ &value);
-KRITASURFACECOLORMANAGEMENTAPI_EXPORT QDebug operator<<(QDebug debug, const Colorimetry &value);
+KRITAPIGMENT_EXPORT QDebug operator<<(QDebug debug, const xy &value);
+KRITAPIGMENT_EXPORT QDebug operator<<(QDebug debug, const xyY &value);
+KRITAPIGMENT_EXPORT QDebug operator<<(QDebug debug, const XYZ &value);
+KRITAPIGMENT_EXPORT QDebug operator<<(QDebug debug, const Colorimetry &value);
} // namespace KisColorimetryUtils
-#endif /* KISCOLORIMETRYUTILS_H */
\ No newline at end of file
+#endif /* KISCOLORIMETRYUTILS_H */
diff --git a/libs/pigment/colorprofiles/KoDummyColorProfile.cpp b/libs/pigment/colorprofiles/KoDummyColorProfile.cpp
index 357a2b29f5..ed80fbf7f9 100644
--- a/libs/pigment/colorprofiles/KoDummyColorProfile.cpp
+++ b/libs/pigment/colorprofiles/KoDummyColorProfile.cpp
@@ -78,19 +78,20 @@ bool KoDummyColorProfile::isLinear() const
{
return true;
}
-QVector<double> KoDummyColorProfile::getColorantsXYZ() const
+QVector<KoColorimetryUtils::XYZ> KoDummyColorProfile::getColorantsXYZ() const
{
- QVector<double> sRGBStandardAdaptedColorants = {
- 0.43603516, 0.22248840, 0.01391602,
- 0.38511658, 0.71690369, 0.09706116,
- 0.14305115, 0.06060791, 0.71392822
+ QVector<KoColorimetryUtils::XYZ> sRGBStandardAdaptedColorants = {
+ KoColorimetryUtils::XYZ{0.43603516, 0.22248840, 0.01391602},
+ KoColorimetryUtils::XYZ{0.38511658, 0.71690369, 0.09706116},
+ KoColorimetryUtils::XYZ{0.14305115, 0.06060791, 0.71392822}
};
return sRGBStandardAdaptedColorants;
}
-QVector<double> KoDummyColorProfile::getColorantsxyY() const
+QVector<KoColorimetryUtils::xyY> KoDummyColorProfile::getColorantsxyY() const
{
- QVector<double> result(9);
+ QVector<KoColorimetryUtils::xyY> result;
+ /*
auto srgb = getColorantsXYZ();
result[0] = srgb[0] / (srgb[0] + srgb[1] + srgb[2]);
result[1] = srgb[1] / (srgb[0] + srgb[1] + srgb[2]);
@@ -103,22 +104,19 @@ QVector<double> KoDummyColorProfile::getColorantsxyY() const
result[6] = srgb[6] / (srgb[6] + srgb[7] + srgb[8]);
result[7] = srgb[7] / (srgb[6] + srgb[7] + srgb[8]);
result[8] = srgb[7];
+*/
return result;
}
-QVector<double> KoDummyColorProfile::getWhitePointXYZ() const
+KoColorimetryUtils::XYZ KoDummyColorProfile::getWhitePointXYZ() const
{
- QVector<double> d50Dummy;
- d50Dummy<<0.9642<<1.0000<<0.8249;
- return d50Dummy;
+ return KoColorimetryUtils::XYZ{0.9642, 1.0000, 0.8249};
}
-QVector<double> KoDummyColorProfile::getWhitePointxyY() const
+KoColorimetryUtils::xyY KoDummyColorProfile::getWhitePointxyY() const
{
- QVector<double> d50Dummy;
- d50Dummy<<0.34773<<0.35952<<1.0;
- return d50Dummy;
+ return KoColorimetryUtils::xyY{0.34773, 0.35952, 1.0};
}
QVector <double> KoDummyColorProfile::getEstimatedTRC() const
diff --git a/libs/pigment/colorprofiles/KoDummyColorProfile.h b/libs/pigment/colorprofiles/KoDummyColorProfile.h
index fe6e1b36d1..cfb3b49c41 100644
--- a/libs/pigment/colorprofiles/KoDummyColorProfile.h
+++ b/libs/pigment/colorprofiles/KoDummyColorProfile.h
@@ -29,10 +29,10 @@ public:
bool hasColorants() const override;
bool hasTRC() const override;
bool isLinear() const override;
- QVector <double> getColorantsXYZ() const override;
- QVector <double> getColorantsxyY() const override;
- QVector <double> getWhitePointXYZ() const override;
- QVector <double> getWhitePointxyY() const override;
+ QVector <KoColorimetryUtils::XYZ> getColorantsXYZ() const override;
+ QVector <KoColorimetryUtils::xyY> getColorantsxyY() const override;
+ KoColorimetryUtils::XYZ getWhitePointXYZ() const override;
+ KoColorimetryUtils::xyY getWhitePointxyY() const override;
QVector <double> getEstimatedTRC() const override;
bool compareTRC(TransferCharacteristics characteristics, float error) const override;
void linearizeFloatValue(QVector <double> & Value) const override;
diff --git a/libs/surfacecolormanagementapi/CMakeLists.txt b/libs/surfacecolormanagementapi/CMakeLists.txt
index 70260aba86..b3e35b4973 100644
--- a/libs/surfacecolormanagementapi/CMakeLists.txt
+++ b/libs/surfacecolormanagementapi/CMakeLists.txt
@@ -1,5 +1,4 @@
set(kritasurfacecolormanagementapi_LIB_SRCS
- KisColorimetryUtils.cpp
surfacecolormanagement/KisOutputColorInfoInterface.cpp
surfacecolormanagement/KisSurfaceColorimetry.cpp
surfacecolormanagement/KisSurfaceColorimetryIccUtils.cpp
diff --git a/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetry.h b/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetry.h
index 108d11d5b4..f8d5dd8311 100644
--- a/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetry.h
+++ b/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetry.h
@@ -7,12 +7,13 @@
#define KISSURFACECOLORIMETRY_H
#include <boost/operators.hpp>
-#include <KisColorimetryUtils.h>
+#include <KoColorimetryUtils.h>
+#include <kritasurfacecolormanagementapi_export.h>
namespace KisSurfaceColorimetry
{
- using namespace KisColorimetryUtils;
+ using namespace KoColorimetryUtils;
enum class NamedPrimaries {
primaries_unknown = 0,
@@ -144,4 +145,4 @@ namespace KisSurfaceColorimetry
KRITASURFACECOLORMANAGEMENTAPI_EXPORT QDebug operator<<(QDebug debug, const RenderIntent &value);
}
-#endif /* KISSURFACECOLORIMETRY_H */
\ No newline at end of file
+#endif /* KISSURFACECOLORIMETRY_H */
diff --git a/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetryIccUtils.h b/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetryIccUtils.h
index d0215c2e75..38233b4fe3 100644
--- a/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetryIccUtils.h
+++ b/libs/surfacecolormanagementapi/surfacecolormanagement/KisSurfaceColorimetryIccUtils.h
@@ -11,7 +11,7 @@
namespace KisSurfaceColorimetry
{
- using namespace KisColorimetryUtils;
+ using namespace KoColorimetryUtils;
KRITASURFACECOLORMANAGEMENTAPI_EXPORT
ColorPrimaries namedPrimariesToPigmentPrimaries(NamedPrimaries primaries);
diff --git a/libs/ui/KisCanvasSurfaceColorSpaceManager.cpp b/libs/ui/KisCanvasSurfaceColorSpaceManager.cpp
index d96ba6d88f..6f6d59ae0f 100644
--- a/libs/ui/KisCanvasSurfaceColorSpaceManager.cpp
+++ b/libs/ui/KisCanvasSurfaceColorSpaceManager.cpp
@@ -121,10 +121,10 @@ QString KisCanvasSurfaceColorSpaceManager::colorManagementReport() const
{
auto colVec = profile->getColorantsxyY();
- KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(colVec.size() == 9, report);
- KisColorimetryUtils::xyY colR{colVec[0], colVec[1], colVec[2]};
- KisColorimetryUtils::xyY colG{colVec[3], colVec[4], colVec[5]};
- KisColorimetryUtils::xyY colB{colVec[6], colVec[7], colVec[8]};
+ KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(colVec.size() == 3, report);
+ KoColorimetryUtils::xyY colR = colVec[0];
+ KoColorimetryUtils::xyY colG = colVec[1];
+ KoColorimetryUtils::xyY colB = colVec[2];
str << " red: " << colR << Qt::endl;
str << " green:" << colG << Qt::endl;
@@ -132,9 +132,7 @@ QString KisCanvasSurfaceColorSpaceManager::colorManagementReport() const
}
{
- auto whiteVec = profile->getWhitePointxyY();
- KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(whiteVec.size() == 3, report);
- KisColorimetryUtils::xyY white{whiteVec[0], whiteVec[1], whiteVec[2]};
+ KoColorimetryUtils::xyY white = profile->getWhitePointxyY();
str << " white: " << white << Qt::endl;
str << Qt::endl;
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index 79e841f1af..cd7c6d18da 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -93,8 +93,9 @@
#ifdef Q_OS_LINUX
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <surfacecolormanagement/KisSurfaceColorimetry.h>
-#include <KisColorimetryUtils.h>
+
#endif
+#include <KoColorimetryUtils.h>
#endif
#include "slider_and_spin_box_sync.h"
@@ -1646,8 +1647,8 @@ void ColorSettingsTab::updatePreferredSpaceGraphic()
if (!m_preferredSpaceGraphic) return;
if (!KisPlatformPluginInterfaceFactory::instance()->surfaceColorManagedByOS()) return;
KisMainWindow *mainWindow = KisPart::instance()->currentMainwindow();
- QVector<double> colorants;
- QVector <double> whitePoint;
+ QVector<KoColorimetryUtils::xyY> colorants;
+ KoColorimetryUtils::xyY whitePoint;
#ifdef Q_OS_LINUX
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -1657,34 +1658,30 @@ void ColorSettingsTab::updatePreferredSpaceGraphic()
if (currentDescription) {
if (std::holds_alternative<KisSurfaceColorimetry::Colorimetry>(currentDescription->colorSpace.primaries)) {
auto col = std::get<KisSurfaceColorimetry::Colorimetry>(currentDescription->colorSpace.primaries);
- colorants << col.red().toxy().x << col.red().toxy().y << col.red().toxyY().Y
- << col.green().toxy().x << col.green().toxy().y << col.green().toxyY().Y
- << col.blue().toxy().x << col.blue().toxy().y << col.blue().toxyY().Y;
- whitePoint << col.white().toxy().x << col.white().toxy().y << col.white().toxyY().Y;
+ colorants << col.red().toxyY() << col.green().toxyY() << col.blue().toxyY();
+ whitePoint = col.white().toxyY();
m_preferredSpaceGraphic->setRGBData(whitePoint, colorants);
} else {
bool enable = true;
auto named = std::get<KisSurfaceColorimetry::NamedPrimaries>(currentDescription->colorSpace.primaries);
- KisSurfaceColorimetry::Colorimetry col = KisColorimetryUtils::Colorimetry::BT709;
+ KisSurfaceColorimetry::Colorimetry col = KoColorimetryUtils::Colorimetry::BT709;
if (named == KisSurfaceColorimetry::NamedPrimaries::primaries_srgb) {
- col = KisColorimetryUtils::Colorimetry::BT709;
+ col = KoColorimetryUtils::Colorimetry::BT709;
} else if (named == KisSurfaceColorimetry::NamedPrimaries::primaries_adobe_rgb) {
- col = KisColorimetryUtils::Colorimetry::AdobeRGB;
+ col = KoColorimetryUtils::Colorimetry::AdobeRGB;
} else if (named == KisSurfaceColorimetry::NamedPrimaries::primaries_bt2020) {
- col = KisColorimetryUtils::Colorimetry::BT2020;
+ col = KoColorimetryUtils::Colorimetry::BT2020;
} else if (named == KisSurfaceColorimetry::NamedPrimaries::primaries_dci_p3) {
- col = KisColorimetryUtils::Colorimetry::DCIP3;
+ col = KoColorimetryUtils::Colorimetry::DCIP3;
} else if (named == KisSurfaceColorimetry::NamedPrimaries::primaries_display_p3) {
- col = KisColorimetryUtils::Colorimetry::DisplayP3;
+ col = KoColorimetryUtils::Colorimetry::DisplayP3;
} else {
enable = false;
}
if (enable) {
- colorants << col.red().toxy().x << col.red().toxy().y << col.red().toxyY().Y
- << col.green().toxy().x << col.green().toxy().y << col.green().toxyY().Y
- << col.blue().toxy().x << col.blue().toxy().y << col.blue().toxyY().Y;
- whitePoint << col.white().toxy().x << col.white().toxy().y << col.white().toxyY().Y;
+ colorants << col.red().toxyY() << col.green().toxyY() << col.blue().toxyY();
+ whitePoint = col.white().toxyY();
m_preferredSpaceGraphic->setRGBData(whitePoint, colorants);
} else {
m_preferredSpaceGraphic->setProfileDataAvailable(false);
@@ -1697,10 +1694,8 @@ void ColorSettingsTab::updatePreferredSpaceGraphic()
} else if(m_preferredSpaceGraphicMode.checkedId() == MasteringSpace) {
if (currentDescription && currentDescription->masteringInfo) {
auto col = currentDescription->masteringInfo->primaries;
- colorants << col.red().toxy().x << col.red().toxy().y << col.red().toxyY().Y
- << col.green().toxy().x << col.green().toxy().y << col.green().toxyY().Y
- << col.blue().toxy().x << col.blue().toxy().y << col.blue().toxyY().Y;
- whitePoint << col.white().toxy().x << col.white().toxy().y << col.white().toxyY().Y;
+ colorants << col.red().toxyY() << col.green().toxyY() << col.blue().toxyY();
+ whitePoint = col.white().toxyY();
m_preferredSpaceGraphic->setRGBData(whitePoint, colorants);
} else {
diff --git a/libs/ui/widgets/kis_advanced_color_space_selector.cc b/libs/ui/widgets/kis_advanced_color_space_selector.cc
index 79eb47d044..2d767cf68a 100644
--- a/libs/ui/widgets/kis_advanced_color_space_selector.cc
+++ b/libs/ui/widgets/kis_advanced_color_space_selector.cc
@@ -163,19 +163,19 @@ void KisAdvancedColorSpaceSelector::fillDescription()
if (!profileList.isEmpty()) {
profileName = currentColorSpace()->profile()->name();
if (currentColorSpace()->profile()->hasColorants()){
- QVector <double> colorants = currentColorSpace()->profile()->getColorantsxyY();
- QVector <double> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ QVector <KoColorimetryUtils::xyY> colorants = currentColorSpace()->profile()->getColorantsxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
//QString text = currentColorSpace()->profile()->info() + " =" +
d->colorSpaceSelector->lblXYZ_W->setText(nameWhitePoint(whitepoint));
- d->colorSpaceSelector->lblXYZ_W->setToolTip(QString::number(whitepoint[0], 'f', 4) + ", " + QString::number(whitepoint[1], 'f', 4) + ", " + QString::number(whitepoint[2], 'f', 4));
+ d->colorSpaceSelector->lblXYZ_W->setToolTip(QString::number(whitepoint.x, 'f', 4) + ", " + QString::number(whitepoint.y, 'f', 4) + ", " + QString::number(whitepoint.Y, 'f', 4));
d->colorSpaceSelector->TongueWidget->setToolTip("<html><head/><body><table><tr><th colspan='4'>"+i18nc("@info:tooltip","This profile has the following xyY colorants:")+"</th></tr><tr><td>"+
- i18n("Red:") +"</td><td>"+QString::number(colorants[0], 'f', 4) + "</td><td>" + QString::number(colorants[1], 'f', 4) + "</td><td>" + QString::number(colorants[2], 'f', 4)+"</td></tr><tr><td>"+
- i18n("Green:")+"</td><td>"+QString::number(colorants[3], 'f', 4) + "</td><td>" + QString::number(colorants[4], 'f', 4) + "</td><td>" + QString::number(colorants[5], 'f', 4)+"</th></tr><tr><td>"+
- i18n("Blue:") +"</td><td>"+QString::number(colorants[6], 'f', 4) + "</td><td>" + QString::number(colorants[7], 'f', 4) + "</td><td>" + QString::number(colorants[8], 'f', 4)+"</th></tr></table></body></html>");
+ i18n("Red:") +"</td><td>"+QString::number(colorants[0].x, 'f', 4) + "</td><td>" + QString::number(colorants[0].y, 'f', 4) + "</td><td>" + QString::number(colorants[0].Y, 'f', 4)+"</td></tr><tr><td>"+
+ i18n("Green:")+"</td><td>"+QString::number(colorants[1].x, 'f', 4) + "</td><td>" + QString::number(colorants[1].y, 'f', 4) + "</td><td>" + QString::number(colorants[1].Y, 'f', 4)+"</th></tr><tr><td>"+
+ i18n("Blue:") +"</td><td>"+QString::number(colorants[2].x, 'f', 4) + "</td><td>" + QString::number(colorants[2].y, 'f', 4) + "</td><td>" + QString::number(colorants[2].Y, 'f', 4)+"</th></tr></table></body></html>");
} else {
- QVector <double> whitepoint2 = currentColorSpace()->profile()->getWhitePointxyY();
+ KoColorimetryUtils::xyY whitepoint2 = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->lblXYZ_W->setText(nameWhitePoint(whitepoint2));
- d->colorSpaceSelector->lblXYZ_W->setToolTip(QString::number(whitepoint2[0], 'f', 4) + ", " + QString::number(whitepoint2[1], 'f', 4) + ", " + QString::number(whitepoint2[2], 'f', 4));
+ d->colorSpaceSelector->lblXYZ_W->setToolTip(QString::number(whitepoint2.x, 'f', 4) + ", " + QString::number(whitepoint2.y, 'f', 4) + ", " + QString::number(whitepoint2.Y, 'f', 4));
d->colorSpaceSelector->TongueWidget->setToolTip(notApplicableTooltip);
}
} else {
@@ -196,14 +196,9 @@ void KisAdvancedColorSpaceSelector::fillDescription()
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
else if (currentModelStr == "RGBA") {
- QVector <qreal> colorants = currentColorSpace()->profile()->getColorantsxyY();
- QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
- if (currentColorSpace()->profile()->hasColorants()){
- d->colorSpaceSelector->TongueWidget->setRGBData(whitepoint, colorants);
- } else {
- colorants.fill(0.0);
- d->colorSpaceSelector->TongueWidget->setRGBData(whitepoint, colorants);
- }
+ QVector <KoColorimetryUtils::xyY> colorants = currentColorSpace()->profile()->getColorantsxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ d->colorSpaceSelector->TongueWidget->setRGBData(whitepoint, colorants);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
TransferCharacteristics detCharacteristics = currentColorSpace()->profile()->getTransferCharacteristics();
QString detCharacteristicsStr =
@@ -249,7 +244,7 @@ void KisAdvancedColorSpaceSelector::fillDescription()
}
}
else if (currentModelStr == "GRAYA") {
- QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setGrayData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
TransferCharacteristics detCharacteristics = currentColorSpace()->profile()->getTransferCharacteristics();
@@ -281,7 +276,7 @@ void KisAdvancedColorSpaceSelector::fillDescription()
}
}
else if (currentModelStr == "CMYKA") {
- QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setCMYKData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
QString estimatedCurve = " Estimated curve: ";
@@ -329,7 +324,7 @@ void KisAdvancedColorSpaceSelector::fillDescription()
} else {
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
- QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setXYZData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+estimatedGamma + QString::number(estimatedTRC[0])+"< br />"+estimatedCurve+"</body></html>");
@@ -351,13 +346,13 @@ void KisAdvancedColorSpaceSelector::fillDescription()
} else {
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
- QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setLABData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+i18nc("@info:tooltip","This is assumed to be the L * TRC. ")+"<br />"+estimatedCurve+"</body></html>");
}
else if (currentModelStr == "YCbCrA") {
- QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
+ KoColorimetryUtils::xyY whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setYCbCrData(whitepoint);
QString estimatedCurve = " Estimated curve: ";
QPolygonF tonecurve;
@@ -683,50 +678,50 @@ void KisAdvancedColorSpaceSelector::fillDescription()
}
-QString KisAdvancedColorSpaceSelector::nameWhitePoint(QVector <double> whitePoint) {
- QString name=(QString::number(whitePoint[0]) + ", " + QString::number(whitePoint[1], 'f', 4));
+QString KisAdvancedColorSpaceSelector::nameWhitePoint(KoColorimetryUtils::xyY whitePoint) {
+ QString name=(QString::number(whitePoint.x) + ", " + QString::number(whitePoint.y, 'f', 4));
//A (0.451170, 0.40594) (2856K)(tungsten)
- if ((whitePoint[0]>0.451170-0.005 && whitePoint[0]<0.451170 + 0.005) &&
- (whitePoint[1]>0.40594-0.005 && whitePoint[1]<0.40594 + 0.005)){
+ if ((whitePoint.x>0.451170-0.005 && whitePoint.x<0.451170 + 0.005) &&
+ (whitePoint.y>0.40594-0.005 && whitePoint.y<0.40594 + 0.005)){
name="A";
return name;
}
//B (0.34980, 0.35270) (4874K) (Direct Sunlight at noon)(obsolete)
//C (0.31039, 0.31905) (6774K) (average/north sky daylight)(obsolete)
//D50 (0.34773, 0.35952) (5003K) (Horizon Light, default color of white paper, ICC profile standard illuminant)
- if ((whitePoint[0]>0.34773-0.005 && whitePoint[0]<0.34773 + 0.005) &&
- (whitePoint[1]>0.35952-0.005 && whitePoint[1]<0.35952 + 0.005)){
+ if ((whitePoint.x>0.34773-0.005 && whitePoint.x<0.34773 + 0.005) &&
+ (whitePoint.y>0.35952-0.005 && whitePoint.y<0.35952 + 0.005)){
name="D50";
return name;
}
//D55 (0.33411, 0.34877) (5503K) (Mid-morning / Mid-afternoon Daylight)
- if ((whitePoint[0]>0.33411-0.001 && whitePoint[0]<0.33411 + 0.001) &&
- (whitePoint[1]>0.34877-0.005 && whitePoint[1]<0.34877 + 0.005)){
+ if ((whitePoint.x>0.33411-0.001 && whitePoint.x<0.33411 + 0.001) &&
+ (whitePoint.y>0.34877-0.005 && whitePoint.y<0.34877 + 0.005)){
name="D55";
return name;
}
//D60 (0.3217, 0.3378) (~6000K) (ACES colorspace default)
- if ((whitePoint[0]>0.3217-0.001 && whitePoint[0]<0.3217 + 0.001) &&
- (whitePoint[1]>0.3378-0.005 && whitePoint[1]<0.3378 + 0.005)){
+ if ((whitePoint.x>0.3217-0.001 && whitePoint.x<0.3217 + 0.001) &&
+ (whitePoint.y>0.3378-0.005 && whitePoint.y<0.3378 + 0.005)){
name="D60";
return name;
}
//D65 (0.31382, 0.33100) (6504K) (Noon Daylight, default for computer and tv screens, sRGB default)
//Elle's are old school with 0.3127 and 0.3289
- if ((whitePoint[0]>0.31382-0.002 && whitePoint[0]<0.31382 + 0.002) &&
- (whitePoint[1]>0.33100-0.005 && whitePoint[1]<0.33100 + 0.002)){
+ if ((whitePoint.x>0.31382-0.002 && whitePoint.x<0.31382 + 0.002) &&
+ (whitePoint.y>0.33100-0.005 && whitePoint.y<0.33100 + 0.002)){
name="D65";
return name;
}
//D75 (0.29968, 0.31740) (7504K) (North sky Daylight)
- if ((whitePoint[0]>0.29968-0.001 && whitePoint[0]<0.29968 + 0.001) &&
- (whitePoint[1]>0.31740-0.005 && whitePoint[1]<0.31740 + 0.005)){
+ if ((whitePoint.x>0.29968-0.001 && whitePoint.x<0.29968 + 0.001) &&
+ (whitePoint.y>0.31740-0.005 && whitePoint.y<0.31740 + 0.005)){
name="D75";
return name;
}
//E (1/3, 1/3) (5454K) (Equal Energy. CIERGB default)
- if ((whitePoint[0]>(1.0/3.0)-0.001 && whitePoint[0]<(1.0/3.0) + 0.001) &&
- (whitePoint[1]>(1.0/3.0)-0.001 && whitePoint[1]<(1.0/3.0) + 0.001)){
+ if ((whitePoint.x>(1.0/3.0)-0.001 && whitePoint.x<(1.0/3.0) + 0.001) &&
+ (whitePoint.y>(1.0/3.0)-0.001 && whitePoint.y<(1.0/3.0) + 0.001)){
name="E";
return name;
}
diff --git a/libs/ui/widgets/kis_advanced_color_space_selector.h b/libs/ui/widgets/kis_advanced_color_space_selector.h
index eb1f6c774e..d0ad62b0ae 100644
--- a/libs/ui/widgets/kis_advanced_color_space_selector.h
+++ b/libs/ui/widgets/kis_advanced_color_space_selector.h
@@ -39,7 +39,7 @@ private Q_SLOTS:
void fillCmbDepths(const KoID& idd);
void fillLstProfiles();
void fillDescription();
- QString nameWhitePoint(QVector <double> whitePoint);
+ QString nameWhitePoint(KoColorimetryUtils::xyY whitePoint);
void colorSpaceChanged();
void installProfile();
private:
diff --git a/libs/ui/widgets/kis_cie_tongue_widget.cpp b/libs/ui/widgets/kis_cie_tongue_widget.cpp
index f6900d4098..50529a677c 100644
--- a/libs/ui/widgets/kis_cie_tongue_widget.cpp
+++ b/libs/ui/widgets/kis_cie_tongue_widget.cpp
@@ -147,8 +147,8 @@ public:
QPixmap cietongue;
QPixmap gamutMap;
- QVector <double> Primaries {9};
- QVector <double> whitePoint {3};
+ QVector <KoColorimetryUtils::xyY> Primaries;
+ KoColorimetryUtils::xyY whitePoint;
QPolygonF gamut;
model colorModel {model::RGBA};
};
@@ -156,10 +156,7 @@ public:
KisCIETongueWidget::KisCIETongueWidget(QWidget *parent) :
QWidget(parent), d(new Private)
{
- d->Primaries.resize(9);
- d->Primaries.fill(0.0);
- d->whitePoint.resize(3);
- d->whitePoint<<0.34773<<0.35952<<1.0;
+ d->whitePoint = {0.34773, 0.35952, 1.0};
d->gamut = QPolygonF();
}
@@ -173,11 +170,11 @@ int KisCIETongueWidget::grids(double val) const
return (int) floor(val * d->gridside + 0.5);
}
-void KisCIETongueWidget::setProfileData(QVector <double> p, QVector <double> w, bool profileData)
+void KisCIETongueWidget::setProfileData(QVector <KoColorimetryUtils::xyY> p, KoColorimetryUtils::xyY w, bool profileData)
{
d->profileDataAvailable = profileData;
if (profileData){
- d->Primaries= p;
+ d->Primaries = p;
d->whitePoint = w;
d->needUpdatePixmap = true;
@@ -189,9 +186,9 @@ void KisCIETongueWidget::setGamut(QPolygonF gamut)
{
d->gamut=gamut;
}
-void KisCIETongueWidget::setRGBData(QVector <double> whitepoint, QVector <double> colorants)
+void KisCIETongueWidget::setRGBData(KoColorimetryUtils::xyY whitepoint, QVector <KoColorimetryUtils::xyY> colorants)
{
- if (colorants.size()==9){
+ if (colorants.size()==3){
d->Primaries= colorants;
d->whitePoint = whitepoint;
@@ -202,62 +199,42 @@ void KisCIETongueWidget::setRGBData(QVector <double> whitepoint, QVector <double
return;
}
}
-void KisCIETongueWidget::setCMYKData(QVector <double> whitepoint)
+void KisCIETongueWidget::setCMYKData(KoColorimetryUtils::xyY whitepoint)
{
- if (whitepoint.size()==3){
- //d->Primaries= colorants;
-
- d->whitePoint = whitepoint;
- d->needUpdatePixmap = true;
- d->colorModel = KisCIETongueWidget::CMYKA;
- d->profileDataAvailable = true;
- } else {
- return;
- }
+ //d->Primaries= colorants;
+
+ d->whitePoint = whitepoint;
+ d->needUpdatePixmap = true;
+ d->colorModel = KisCIETongueWidget::CMYKA;
+ d->profileDataAvailable = true;
}
-void KisCIETongueWidget::setXYZData(QVector <double> whitepoint)
+void KisCIETongueWidget::setXYZData(KoColorimetryUtils::xyY whitepoint)
{
- if (whitepoint.size()==3){
- d->whitePoint = whitepoint;
- d->needUpdatePixmap = true;
- d->colorModel = KisCIETongueWidget::XYZA;
- d->profileDataAvailable = true;
- } else {
- return;
- }
+ d->whitePoint = whitepoint;
+ d->needUpdatePixmap = true;
+ d->colorModel = KisCIETongueWidget::XYZA;
+ d->profileDataAvailable = true;
}
-void KisCIETongueWidget::setGrayData(QVector <double> whitepoint)
+void KisCIETongueWidget::setGrayData(KoColorimetryUtils::xyY whitepoint)
{
- if (whitepoint.size()==3){
- d->whitePoint = whitepoint;
- d->needUpdatePixmap = true;
- d->colorModel = KisCIETongueWidget::GRAYA;
- d->profileDataAvailable = true;
- } else {
- return;
- }
+ d->whitePoint = whitepoint;
+ d->needUpdatePixmap = true;
+ d->colorModel = KisCIETongueWidget::GRAYA;
+ d->profileDataAvailable = true;
}
-void KisCIETongueWidget::setLABData(QVector <double> whitepoint)
+void KisCIETongueWidget::setLABData(KoColorimetryUtils::xyY whitepoint)
{
- if (whitepoint.size()==3){
- d->whitePoint = whitepoint;
- d->needUpdatePixmap = true;
- d->colorModel = KisCIETongueWidget::LABA;
- d->profileDataAvailable = true;
- } else {
- return;
- }
+ d->whitePoint = whitepoint;
+ d->needUpdatePixmap = true;
+ d->colorModel = KisCIETongueWidget::LABA;
+ d->profileDataAvailable = true;
}
-void KisCIETongueWidget::setYCbCrData(QVector <double> whitepoint)
+void KisCIETongueWidget::setYCbCrData(KoColorimetryUtils::xyY whitepoint)
{
- if (whitepoint.size()==3){
- d->whitePoint = whitepoint;
- d->needUpdatePixmap = true;
- d->colorModel = KisCIETongueWidget::YCbCrA;
- d->profileDataAvailable = true;
- } else {
- return;
- }
+ d->whitePoint = whitepoint;
+ d->needUpdatePixmap = true;
+ d->colorModel = KisCIETongueWidget::YCbCrA;
+ d->profileDataAvailable = true;
}
void KisCIETongueWidget::setProfileDataAvailable(bool dataAvailable)
@@ -475,22 +452,26 @@ void KisCIETongueWidget::drawSmallEllipse(QPointF xy, int r, int g, int b, int s
d->painter.drawEllipse(icx + d->xBias- sz2/2, icy-sz2/2, sz2, sz2);
d->painter.restore();
}
+
+QPointF xyYToQPointF(KoColorimetryUtils::xyY xy) {
+ return QPointF(xy.x, xy.y);
+}
void KisCIETongueWidget::drawColorantTriangle()
{
d->painter.save();
d->painter.setPen(qRgb(80, 80, 80));
d->painter.setRenderHint(QPainter::Antialiasing);
- if (d->colorModel ==KisCIETongueWidget::RGBA) {
- drawSmallEllipse((QPointF(d->Primaries[0],d->Primaries[1])), 255, 128, 128, 6);
- drawSmallEllipse((QPointF(d->Primaries[3],d->Primaries[4])), 128, 255, 128, 6);
- drawSmallEllipse((QPointF(d->Primaries[6],d->Primaries[7])), 128, 128, 255, 6);
+ if (d->colorModel ==KisCIETongueWidget::RGBA && d->Primaries.size() == 3) {
+ drawSmallEllipse(xyYToQPointF(d->Primaries[0]), 255, 128, 128, 6);
+ drawSmallEllipse(xyYToQPointF(d->Primaries[1]), 128, 255, 128, 6);
+ drawSmallEllipse(xyYToQPointF(d->Primaries[2]), 128, 128, 255, 6);
int x1, y1, x2, y2, x3, y3;
- mapPoint(x1, y1, (QPointF(d->Primaries[0],d->Primaries[1])) );
- mapPoint(x2, y2, (QPointF(d->Primaries[3],d->Primaries[4])) );
- mapPoint(x3, y3, (QPointF(d->Primaries[6],d->Primaries[7])) );
+ mapPoint(x1, y1, xyYToQPointF(d->Primaries[0]));
+ mapPoint(x2, y2, xyYToQPointF(d->Primaries[1]));
+ mapPoint(x3, y3, xyYToQPointF(d->Primaries[2]));
biasedLine(x1, y1, x2, y2);
biasedLine(x2, y2, x3, y3);
@@ -511,7 +492,7 @@ void KisCIETongueWidget::drawColorantTriangle()
void KisCIETongueWidget::drawWhitePoint()
{
- drawSmallEllipse(QPointF (d->whitePoint[0],d->whitePoint[1]), 255, 255, 255, 8);
+ drawSmallEllipse(xyYToQPointF(d->whitePoint), 255, 255, 255, 8);
}
void KisCIETongueWidget::drawGamut()
@@ -531,13 +512,13 @@ void KisCIETongueWidget::drawGamut()
if (d->colorModel == KisCIETongueWidget::RGBA) {
gamutPaint.save();
gamutPaint.setOpacity(0.5);
- mapPoint(x, y, (QPointF(d->Primaries[0],d->Primaries[1])) );
+ mapPoint(x, y, xyYToQPointF(d->Primaries[0]) );
path.moveTo(QPointF(x + d->xBias,y));
- mapPoint(x, y, (QPointF(d->Primaries[3],d->Primaries[4])) );
+ mapPoint(x, y, xyYToQPointF(d->Primaries[1]) );
path.lineTo(QPointF(x + d->xBias,y));
- mapPoint(x, y, (QPointF(d->Primaries[6],d->Primaries[7])) );
+ mapPoint(x, y, xyYToQPointF(d->Primaries[2]) );
path.lineTo(QPointF(x + d->xBias,y));
- mapPoint(x, y, (QPointF(d->Primaries[0],d->Primaries[1])) );
+ mapPoint(x, y, xyYToQPointF(d->Primaries[0]) );
path.lineTo(QPointF(x + d->xBias,y));
gamutPaint.drawPath(path);
gamutPaint.restore();
@@ -606,12 +587,12 @@ void KisCIETongueWidget::updatePixmap()
d->painter.begin(&d->pixmap);
//draw whitepoint and colorants
- if (d->whitePoint[2] > 0.0)
+ if (d->whitePoint.Y > 0.0)
{
drawWhitePoint();
}
- if (d->Primaries[2] != 0.0)
+ if (!d->Primaries.isEmpty())
{
drawColorantTriangle();
}
diff --git a/libs/ui/widgets/kis_cie_tongue_widget.h b/libs/ui/widgets/kis_cie_tongue_widget.h
index 3a152db44e..d1ff74a537 100644
--- a/libs/ui/widgets/kis_cie_tongue_widget.h
+++ b/libs/ui/widgets/kis_cie_tongue_widget.h
@@ -14,7 +14,8 @@
#define KIS_CIETONGUEWIDGET_H
// Qt includes
-
+
+#include "KoColorimetryUtils.h"
#include <QWidget>
#include <QColor>
#include <QPaintEvent>
@@ -25,7 +26,7 @@
#include <KoColorSpace.h>
#include <kritaui_export.h>
-
+
class KRITAUI_EXPORT KisCIETongueWidget : public QWidget
{
Q_OBJECT
@@ -36,14 +37,14 @@ public:
~KisCIETongueWidget() override;
//this expects a qvector <double> (9), qvector <double> (3) and whether or not there's profile data?;
- void setProfileData(QVector <double> p, QVector <double> w, bool profileData = false);
+ void setProfileData(QVector<KoColorimetryUtils::xyY> p, KoColorimetryUtils::xyY w, bool profileData = false);
void setGamut(QPolygonF gamut);
- void setRGBData(QVector <double> whitepoint, QVector <double> colorants);
- void setCMYKData(QVector <double> whitepoint);
- void setXYZData(QVector <double> whitepoint);
- void setGrayData(QVector <double> whitepoint);
- void setLABData(QVector <double> whitepoint);
- void setYCbCrData(QVector <double> whitepoint);
+ void setRGBData(KoColorimetryUtils::xyY whitepoint, QVector<KoColorimetryUtils::xyY> colorants);
+ void setCMYKData(KoColorimetryUtils::xyY whitepoint);
+ void setXYZData(KoColorimetryUtils::xyY whitepoint);
+ void setGrayData(KoColorimetryUtils::xyY whitepoint);
+ void setLABData(KoColorimetryUtils::xyY whitepoint);
+ void setYCbCrData(KoColorimetryUtils::xyY whitepoint);
void setProfileDataAvailable(bool dataAvailable);
void loadingStarted();
diff --git a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
index 6dc12229b9..3d1bbd8f5c 100644
--- a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
+++ b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
@@ -378,37 +378,34 @@ bool IccColorProfile::isLinear() const
return d->shared->lcmsProfile->isLinear();
return false;
}
-QVector <qreal> IccColorProfile::getColorantsXYZ() const
+QVector <KoColorimetryUtils::XYZ> IccColorProfile::getColorantsXYZ() const
{
if (d->shared->lcmsProfile) {
return d->shared->lcmsProfile->getColorantsXYZ();
}
- return QVector<qreal>(9);
+ return QVector<KoColorimetryUtils::XYZ>();
}
-QVector <qreal> IccColorProfile::getColorantsxyY() const
+QVector<KoColorimetryUtils::xyY> IccColorProfile::getColorantsxyY() const
{
if (d->shared->lcmsProfile) {
return d->shared->lcmsProfile->getColorantsxyY();
}
- return QVector<qreal>(9);
+ return QVector<KoColorimetryUtils::xyY>();
}
-QVector <qreal> IccColorProfile::getWhitePointXYZ() const
+KoColorimetryUtils::XYZ IccColorProfile::getWhitePointXYZ() const
{
- QVector <qreal> d50Dummy(3);
- d50Dummy << 0.9642 << 1.0000 << 0.8249;
+ KoColorimetryUtils::XYZ d50Dummy {0.9642, 1.0000, 0.8249};
if (d->shared->lcmsProfile) {
- return d->shared->lcmsProfile->getWhitePointXYZ();
+ return d->shared->lcmsProfile->getWhitePointXYZ();
}
return d50Dummy;
}
-QVector <qreal> IccColorProfile::getWhitePointxyY() const
+KoColorimetryUtils::xyY IccColorProfile::getWhitePointxyY() const
{
- QVector <qreal> d50Dummy(3);
- d50Dummy << 0.34773 << 0.35952 << 1.0;
if (d->shared->lcmsProfile) {
return d->shared->lcmsProfile->getWhitePointxyY();
}
- return d50Dummy;
+ return KoColorimetryUtils::xyY{0.34773, 0.35952, 1.0};
}
QVector <qreal> IccColorProfile::getEstimatedTRC() const
{
diff --git a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h
index 29a2047448..37d64f2cda 100644
--- a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h
+++ b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h
@@ -61,10 +61,10 @@ public:
virtual bool isSuitableForPrinting() const = 0;
virtual bool isSuitableForDisplay() const = 0;
virtual bool hasColorants() const = 0;
- virtual QVector <double> getColorantsXYZ() const = 0;
- virtual QVector <double> getColorantsxyY() const = 0;
- virtual QVector <double> getWhitePointXYZ() const = 0;
- virtual QVector <double> getWhitePointxyY() const = 0;
+ virtual QVector <KoColorimetryUtils::XYZ> getColorantsXYZ() const = 0;
+ virtual QVector <KoColorimetryUtils::xyY> getColorantsxyY() const = 0;
+ virtual KoColorimetryUtils::XYZ getWhitePointXYZ() const = 0;
+ virtual KoColorimetryUtils::xyY getWhitePointxyY() const = 0;
virtual QVector <double> getEstimatedTRC() const = 0;
virtual bool compareTRC(TransferCharacteristics characteristics, float error) const = 0;
virtual QByteArray getProfileUniqueId() const = 0;
@@ -106,10 +106,10 @@ public:
bool hasColorants() const override;
bool hasTRC() const override;
bool isLinear() const override;
- QVector <qreal> getColorantsXYZ() const override;
- QVector <qreal> getColorantsxyY() const override;
- QVector <qreal> getWhitePointXYZ() const override;
- QVector <qreal> getWhitePointxyY() const override;
+ QVector <KoColorimetryUtils::XYZ> getColorantsXYZ() const override;
+ QVector <KoColorimetryUtils::xyY> getColorantsxyY() const override;
+ KoColorimetryUtils::XYZ getWhitePointXYZ() const override;
+ KoColorimetryUtils::xyY getWhitePointxyY() const override;
QVector <qreal> getEstimatedTRC() const override;
bool compareTRC(TransferCharacteristics characteristics, float error) const override;
void linearizeFloatValue(QVector <qreal> & Value) const override;
diff --git a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp
index 3a2d8eb28f..6a7dd6c991 100644
--- a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp
+++ b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp
@@ -424,72 +424,60 @@ bool LcmsColorProfileContainer::isLinear() const
{
return *d->isLinear;
}
-QVector <double> LcmsColorProfileContainer::getColorantsXYZ() const
-{
- QVector <double> colorants(9);
- colorants[0] = d->colorants.Red.X;
- colorants[1] = d->colorants.Red.Y;
- colorants[2] = d->colorants.Red.Z;
- colorants[3] = d->colorants.Green.X;
- colorants[4] = d->colorants.Green.Y;
- colorants[5] = d->colorants.Green.Z;
- colorants[6] = d->colorants.Blue.X;
- colorants[7] = d->colorants.Blue.Y;
- colorants[8] = d->colorants.Blue.Z;
+
+KoColorimetryUtils::XYZ fromCieXYZ(const cmsCIEXYZ &xyz) {
+ return KoColorimetryUtils::XYZ{xyz.X, xyz.Y, xyz.Z};
+}
+
+KoColorimetryUtils::xyY fromCIExyY(const cmsCIExyY &xyY) {
+ return KoColorimetryUtils::xyY{xyY.x, xyY.y, xyY.Y};
+}
+
+QVector <KoColorimetryUtils::XYZ> LcmsColorProfileContainer::getColorantsXYZ() const
+{
+ QVector <KoColorimetryUtils::XYZ> colorants(9);
+
+ colorants.append(fromCieXYZ(d->colorants.Red));
+ colorants.append(fromCieXYZ(d->colorants.Green));
+ colorants.append(fromCieXYZ(d->colorants.Blue));
return colorants;
}
-QVector <double> LcmsColorProfileContainer::getColorantsxyY() const
+QVector<KoColorimetryUtils::xyY> LcmsColorProfileContainer::getColorantsxyY() const
{
cmsCIEXYZ temp1;
cmsCIExyY temp2;
- QVector <double> colorants(9);
+ QVector<KoColorimetryUtils::xyY> colorants;
temp1.X = d->colorants.Red.X;
temp1.Y = d->colorants.Red.Y;
temp1.Z = d->colorants.Red.Z;
cmsXYZ2xyY(&temp2, &temp1);
- colorants[0] = temp2.x;
- colorants[1] = temp2.y;
- colorants[2] = temp2.Y;
+ colorants.append(fromCIExyY(temp2));
temp1.X = d->colorants.Green.X;
temp1.Y = d->colorants.Green.Y;
temp1.Z = d->colorants.Green.Z;
cmsXYZ2xyY(&temp2, &temp1);
- colorants[3] = temp2.x;
- colorants[4] = temp2.y;
- colorants[5] = temp2.Y;
+ colorants.append(fromCIExyY(temp2));
temp1.X = d->colorants.Blue.X;
temp1.Y = d->colorants.Blue.Y;
temp1.Z = d->colorants.Blue.Z;
cmsXYZ2xyY(&temp2, &temp1);
- colorants[6] = temp2.x;
- colorants[7] = temp2.y;
- colorants[8] = temp2.Y;
+ colorants.append(fromCIExyY(temp2));
return colorants;
}
-QVector <double> LcmsColorProfileContainer::getWhitePointXYZ() const
+KoColorimetryUtils::XYZ LcmsColorProfileContainer::getWhitePointXYZ() const
{
- QVector <double> tempWhitePoint(3);
-
- tempWhitePoint[0] = d->mediaWhitePoint.X;
- tempWhitePoint[1] = d->mediaWhitePoint.Y;
- tempWhitePoint[2] = d->mediaWhitePoint.Z;
-
- return tempWhitePoint;
+ return fromCieXYZ(d->mediaWhitePoint);
}
-QVector <double> LcmsColorProfileContainer::getWhitePointxyY() const
+KoColorimetryUtils::xyY LcmsColorProfileContainer::getWhitePointxyY() const
{
- QVector <double> tempWhitePoint(3);
- tempWhitePoint[0] = d->whitePoint.x;
- tempWhitePoint[1] = d->whitePoint.y;
- tempWhitePoint[2] = d->whitePoint.Y;
- return tempWhitePoint;
+ return fromCIExyY(d->whitePoint);
}
QVector <double> LcmsColorProfileContainer::getEstimatedTRC() const
diff --git a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h
index d2adacd4d0..1f00bfbc8f 100644
--- a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h
+++ b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h
@@ -83,10 +83,10 @@ public:
bool hasColorants() const override;
virtual bool hasTRC() const;
bool isLinear() const;
- QVector <double> getColorantsXYZ() const override;
- QVector <double> getColorantsxyY() const override;
- QVector <double> getWhitePointXYZ() const override;
- QVector <double> getWhitePointxyY() const override;
+ QVector<KoColorimetryUtils::XYZ> getColorantsXYZ() const override;
+ QVector <KoColorimetryUtils::xyY> getColorantsxyY() const override;
+ KoColorimetryUtils::XYZ getWhitePointXYZ() const override;
+ KoColorimetryUtils::xyY getWhitePointxyY() const override;
QVector <double> getEstimatedTRC() const override;
virtual void LinearizeFloatValue(QVector <double> & Value) const;
virtual void DelinearizeFloatValue(QVector <double> & Value) const;
diff --git a/plugins/color/lcms2engine/tests/TestIccFromColorimetryConversion.cpp b/plugins/color/lcms2engine/tests/TestIccFromColorimetryConversion.cpp
index 09d1e8e69c..bb7e47bcb7 100644
--- a/plugins/color/lcms2engine/tests/TestIccFromColorimetryConversion.cpp
+++ b/plugins/color/lcms2engine/tests/TestIccFromColorimetryConversion.cpp
@@ -118,7 +118,7 @@ void TestIccFromColorimetryConversion::testRequestConstruction()
void TestIccFromColorimetryConversion::testRequestConstructionCustomPrimaries()
{
- using KisColorimetryUtils::Colorimetry;
+ using KoColorimetryUtils::Colorimetry;
using KisSurfaceColorimetry::ColorSpace;
using KisSurfaceColorimetry::NamedTransferFunction;
@@ -177,7 +177,7 @@ void TestIccFromColorimetryConversion::testRequestConstructionCustomGamma()
QFETCH(bool, isValid);
QFETCH(TransferCharacteristics, expectedTransferFunction);
- using KisColorimetryUtils::Colorimetry;
+ using KoColorimetryUtils::Colorimetry;
using KisSurfaceColorimetry::ColorSpace;
using KisSurfaceColorimetry::NamedTransferFunction;
using KisSurfaceColorimetry::NamedPrimaries;
@@ -227,7 +227,7 @@ void TestIccFromColorimetryConversion::testProfileConstruction()
void TestIccFromColorimetryConversion::testProfileConstructionCustomPrimaries()
{
- using KisColorimetryUtils::Colorimetry;
+ using KoColorimetryUtils::Colorimetry;
using KisSurfaceColorimetry::ColorSpace;
using KisSurfaceColorimetry::NamedTransferFunction;
diff --git a/plugins/impex/jxl/JPEGXLExport.cpp b/plugins/impex/jxl/JPEGXLExport.cpp
index 6f87381922..94c4240ea1 100644
--- a/plugins/impex/jxl/JPEGXLExport.cpp
+++ b/plugins/impex/jxl/JPEGXLExport.cpp
@@ -406,22 +406,22 @@ KisImportExportErrorCode JPEGXLExport::convert(KisDocument *document, QIODevice
break;
default:
warnFile << "Writing possibly non-roundtrip primaries!";
- const QVector<qreal> colorants = cs->profile()->getColorantsxyY();
+ const QVector<KoColorimetryUtils::xyY> colorants = cs->profile()->getColorantsxyY();
cicpDescription.primaries = JXL_PRIMARIES_CUSTOM;
- cicpDescription.primaries_red_xy[0] = colorants[0];
- cicpDescription.primaries_red_xy[1] = colorants[1];
- cicpDescription.primaries_green_xy[0] = colorants[3];
- cicpDescription.primaries_green_xy[1] = colorants[4];
- cicpDescription.primaries_blue_xy[0] = colorants[6];
- cicpDescription.primaries_blue_xy[1] = colorants[7];
+ cicpDescription.primaries_red_xy[0] = colorants[0].x;
+ cicpDescription.primaries_red_xy[1] = colorants[0].y;
+ cicpDescription.primaries_green_xy[0] = colorants[1].x;
+ cicpDescription.primaries_green_xy[1] = colorants[1].y;
+ cicpDescription.primaries_blue_xy[0] = colorants[2].x;
+ cicpDescription.primaries_blue_xy[1] = colorants[2].y;
break;
}
// Unfortunately, Wolthera never wrote an enum for white points...
- const QVector<qreal> whitePoint = image->colorSpace()->profile()->getWhitePointxyY();
+ const KoColorimetryUtils::xyY whitePoint = image->colorSpace()->profile()->getWhitePointxyY();
cicpDescription.white_point = JXL_WHITE_POINT_CUSTOM;
- cicpDescription.white_point_xy[0] = whitePoint[0];
- cicpDescription.white_point_xy[1] = whitePoint[1];
+ cicpDescription.white_point_xy[0] = whitePoint.x;
+ cicpDescription.white_point_xy[1] = whitePoint.y;
}
if (JXL_ENC_SUCCESS != JxlEncoderSetColorEncoding(enc.get(), &cicpDescription)) {
diff --git a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp
index 8a09f3e72f..5536433af7 100644
--- a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp
+++ b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp
@@ -143,7 +143,7 @@ bool KisWaylandSurfaceColorManager::isReady() const
bool KisWaylandSurfaceColorManager::supportsSurfaceDescription(const KisSurfaceColorimetry::SurfaceDescription &desc)
{
using feature = QtWayland::wp_color_manager_v1::feature;
- using namespace KisColorimetryUtils;
+ using namespace KoColorimetryUtils;
if (!m_waylandManager->isFeatureSupported(feature::feature_parametric)) {
qWarning() << "KisWaylandSurfaceColorManager: feature_parametric is not supported";
diff --git a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.cpp b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.cpp
index 7c13aa0518..e11341862e 100644
--- a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.cpp
+++ b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.cpp
@@ -115,34 +115,34 @@ SurfaceDescription WaylandSurfaceDescription::toSurfaceDescription() const
} else if (this->namedContainer) {
switch (*this->namedContainer) {
case QtWayland::wp_color_manager_v1::primaries_srgb:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::BT709;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::BT709;
break;
case QtWayland::wp_color_manager_v1::primaries_pal_m:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::PAL_M;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::PAL_M;
break;
case QtWayland::wp_color_manager_v1::primaries_pal:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::PAL;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::PAL;
break;
case QtWayland::wp_color_manager_v1::primaries_ntsc:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::NTSC;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::NTSC;
break;
case QtWayland::wp_color_manager_v1::primaries_generic_film:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::GenericFilm;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::GenericFilm;
break;
case QtWayland::wp_color_manager_v1::primaries_bt2020:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::BT2020;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::BT2020;
break;
case QtWayland::wp_color_manager_v1::primaries_cie1931_xyz:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::CIEXYZ;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::CIEXYZ;
break;
case QtWayland::wp_color_manager_v1::primaries_dci_p3:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::DCIP3;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::DCIP3;
break;
case QtWayland::wp_color_manager_v1::primaries_display_p3:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::DisplayP3;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::DisplayP3;
break;
case QtWayland::wp_color_manager_v1::primaries_adobe_rgb:
- masteringInfo.primaries = KisColorimetryUtils::Colorimetry::AdobeRGB;
+ masteringInfo.primaries = KoColorimetryUtils::Colorimetry::AdobeRGB;
break;
}
}
@@ -174,7 +174,7 @@ WaylandSurfaceDescription WaylandSurfaceDescription::fromSurfaceDescription(cons
{
WaylandSurfaceDescription desc;
- using namespace KisColorimetryUtils;
+ using namespace KoColorimetryUtils;
using namespace KisSurfaceColorimetry;
if (std::holds_alternative<NamedPrimaries>(rhs.colorSpace.primaries)) {
diff --git a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.h b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.h
index 9425c43ba7..c17262438c 100644
--- a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.h
+++ b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorimetry.h
@@ -13,8 +13,8 @@ namespace KisSurfaceColorimetry
{
struct WaylandPrimaries : boost::equality_comparable<WaylandPrimaries> {
- using xy = KisColorimetryUtils::xy;
- using Colorimetry = KisColorimetryUtils::Colorimetry;
+ using xy = KoColorimetryUtils::xy;
+ using Colorimetry = KoColorimetryUtils::Colorimetry;
xy red;
xy green;
@@ -45,11 +45,11 @@ struct WaylandPrimaries : boost::equality_comparable<WaylandPrimaries> {
};
-inline KisColorimetryUtils::xy xyFromWaylandXy(int32_t x, int32_t y) {
+inline KoColorimetryUtils::xy xyFromWaylandXy(int32_t x, int32_t y) {
return {x / 1'000'000.0, y / 1'000'000.0};
}
-inline std::pair<int32_t, int32_t> waylandXyFromXy(KisColorimetryUtils::xy value) {
+inline std::pair<int32_t, int32_t> waylandXyFromXy(KoColorimetryUtils::xy value) {
return {std::rint(value.x * 1'000'000.0), std::rint(value.y * 1'000'000.0)};
}