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++

Implement UI and data structures for HDR metadata in the image.

Wolthera van Hövell tot Westerflier01f17a3ed351
diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
index 57737c1fd5..70fa682c8b 100644
--- a/libs/image/CMakeLists.txt
+++ b/libs/image/CMakeLists.txt
@@ -131,6 +131,7 @@ set(kritaimage_LIB_SRCS
processing/kis_transform_processing_visitor.cpp
processing/kis_mirror_processing_visitor.cpp
processing/KisSelectionBasedProcessingHelper.cpp
+ processing/KisContentLightLevelProcessingVistor.cpp
filter/kis_filter.cc
filter/kis_filter_category_ids.cpp
filter/kis_filter_configuration.cc
diff --git a/libs/image/kis_hdr_metadata.h b/libs/image/kis_hdr_metadata.h
new file mode 100644
index 0000000000..7ca768369c
--- /dev/null
+++ b/libs/image/kis_hdr_metadata.h
@@ -0,0 +1,57 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Wolthera van Hövell tot Westerflier <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef KIS_HDR_METADATA_H
+#define KIS_HDR_METADATA_H
+
+#include <QPointF>
+#include <boost/operators.hpp>
+/**
+ * KisContentLightLevelInformation is a struct that represents
+ * HDR10 metadata. It is similar to the same values in MasteringInfo in
+ * KisSurfaceColorimetry.h
+ */
+
+struct KisContentLightLevelInformation: public boost::equality_comparable<KisContentLightLevelInformation> {
+ /**
+ * MaxContentLightLevel or MaxCLL is the brightest pixel in the frame sequence.
+ */
+ double maxContentLightLevel = 0.0;
+
+ /**
+ * @brief maxFrameAverage
+ * MaxFrameAverageLightLevel or MaxFALL is the average of average pixel brightnesses in the frame sequence.
+ */
+ double maxFrameAverageLightLevel = 0.0;
+
+ bool operator==(const KisContentLightLevelInformation & other) const {
+ return qFuzzyCompare(maxContentLightLevel, other.maxContentLightLevel)
+ && qFuzzyCompare(maxFrameAverageLightLevel, other.maxFrameAverageLightLevel);
+ };
+};
+
+/**
+ * @brief The KisColorVolumeInformation class
+ * is a struct that represents the 'mastering' display. It's primary purpose
+ * is to provide extra information for gamutmapping.
+ */
+struct KisColorVolumeInformation: public boost::equality_comparable<KisColorVolumeInformation> {
+ QPointF white; ///< xyY location of the whitepoint.
+ QPointF red; ///< xyY location of the red colorant.
+ QPointF green; ///< xyY location of the green colorant.
+ QPointF blue; ///< xyY location of the blue colorant.
+
+ double maxLuminance = 0.0; ///< Maximum screen brightness in cd/m²
+ double minLuminance = 0.0; ///< Minimum screen brightness in cd/m²
+
+ bool operator==(const KisColorVolumeInformation & other) const {
+ return qFuzzyCompare(maxLuminance, other.maxLuminance)
+ && qFuzzyCompare(minLuminance, other.minLuminance)
+ && white == other.white && red == other.red
+ && green == other.green && blue == other.blue;
+ };
+};
+
+#endif // KIS_HDR_METADATA_H
diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
index 7d551f07e8..b88d12b558 100644
--- a/libs/image/kis_image.cc
+++ b/libs/image/kis_image.cc
@@ -20,6 +20,7 @@
#include <klocalizedstring.h>
+#include "KisContentLightLevelProcessingVistor.h"
#include "KoColorSpaceRegistry.h"
#include "KoColor.h"
#include "KoColorProfile.h"
@@ -100,6 +101,7 @@
#include "KisBusyWaitBroker.h"
#include <KisStaticInitializer.h>
#include "KisImageGlobalSelectionManagementInterface.h"
+#include "kis_hdr_metadata.h"
// #define SANITY_CHECKS
@@ -278,6 +280,10 @@ public:
KisCompositeProgressProxy compositeProgressProxy;
+ std::optional<KisContentLightLevelInformation> contentLightLevelInformation;
+ std::optional<KisColorVolumeInformation> colorVolumeInformation;
+ std::optional<double> diffuseWhiteLightLevel;
+
QPointF axesCenter;
bool allowMasksOnRootNode = false;
@@ -2079,6 +2085,58 @@ bool KisImage::startIsolatedMode(KisNodeSP node, bool isolateLayer, bool isolate
return true;
}
+std::optional<KisContentLightLevelInformation> KisImage::contentLightLevelInformation() const
+{
+ return m_d->contentLightLevelInformation;
+}
+
+void KisImage::calculateContentLightLevelInformation()
+{
+
+ KisImageSignalVector emitSignals;
+ KUndo2MagicString actionName;
+ KisProcessingApplicator::ProcessingFlags signalFlags = KisProcessingApplicator::NO_UI_UPDATES;
+ KisProcessingApplicator applicator(this, m_d->rootLayer,
+ KisProcessingApplicator::RECURSIVE | signalFlags,
+ emitSignals, actionName);
+
+ KisSharedPtr<KisContentLightLevelProcessingVistor> visitor = new KisContentLightLevelProcessingVistor();
+ applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::SEQUENTIAL);
+ applicator.end();
+
+ waitForDone();
+ m_d->contentLightLevelInformation = std::make_optional(visitor->contentLightLevelInformation());
+ emit sigContentLightLevelInformationChanged();
+}
+
+std::optional<KisColorVolumeInformation> KisImage::colorVolumeInformation() const
+{
+ return m_d->colorVolumeInformation;
+}
+
+void KisImage::setColorVolumeInformation(const std::optional<KisColorVolumeInformation> cvi)
+{
+ if (!m_d->colorVolumeInformation ||
+ !(*m_d->colorVolumeInformation == *cvi)) {
+ m_d->colorVolumeInformation = cvi;
+ emit sigColorVolumeInformationChanged();
+ }
+}
+
+std::optional<double> KisImage::diffuseWhiteLightLevel() const
+{
+ return m_d->diffuseWhiteLightLevel;
+}
+
+void KisImage::setDiffuseWhiteLightLevel(const std::optional<double> cdm2)
+{
+ if (!m_d->diffuseWhiteLightLevel ||
+ !qFuzzyCompare(*m_d->diffuseWhiteLightLevel, *cdm2)) {
+ m_d->diffuseWhiteLightLevel = cdm2;
+ emit sigDiffuseWhiteLightLevelChanged();
+ }
+}
+
void KisImage::stopIsolatedMode()
{
if (!m_d->isolationRootNode) return;
diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h
index 71a7abb361..0cc6e5512c 100644
--- a/libs/image/kis_image.h
+++ b/libs/image/kis_image.h
@@ -43,6 +43,9 @@ class KisProofingConfiguration;
class KisPaintDevice;
class KisImageGlobalSelectionManagementInterface;
+struct KisContentLightLevelInformation;
+struct KisColorVolumeInformation;
+
namespace KisMetaData
{
class MergeStrategy;
@@ -801,9 +804,43 @@ public:
bool startIsolatedMode(KisNodeSP node, bool isolateLayer, bool isolateGroup);
+ /**
+ * @brief contentLightLevelInformation
+ * This returns (optionally) a KisContentLightLevelInformation with the
+ * MaxCLL and MaxFALL of the image. Note that MaxCLL and MaxFALL will
+ * not be in cd/m², but rather in linear XYZ Y. To get the cd/m², multiply
+ * these values with diffuseWhiteLightLevel().
+ */
+ std::optional<KisContentLightLevelInformation> contentLightLevelInformation() const;
+
+ /**
+ * @brief colorVolumeInformation
+ * @return the KisColorVolumeInformation of the image.
+ * When this is missing, the image color space is assumed, with
+ * 0 as the minimum luminance and 10K as the max luminance.
+ */
+ std::optional<KisColorVolumeInformation> colorVolumeInformation() const;
+
+ /// Set the color volume information.
+ void setColorVolumeInformation(const std::optional<KisColorVolumeInformation> cvi);
+
+ /**
+ * @brief diffuseWhiteLightLevel
+ * @return the cd/m² value of diffuseWhite.
+ * When this is missing, 80cd/m² is assumed.
+ */
+ std::optional<double> diffuseWhiteLightLevel() const;
+
+ /// Set the diffuse white light level, in cd/m²
+ void setDiffuseWhiteLightLevel(const std::optional<double> cdm2);
+
public Q_SLOTS:
void stopIsolatedMode();
+ /// Calculates the content light level inside a stroke.
+ void calculateContentLightLevelInformation();
+
+
public:
KisNodeSP isolationRootNode() const;
bool isIsolatingLayer() const;
@@ -975,6 +1012,10 @@ Q_SIGNALS:
*/
void sigInternalStopIsolatedModeRequested();
+ void sigContentLightLevelInformationChanged();
+ void sigColorVolumeInformationChanged();
+ void sigDiffuseWhiteLightLevelChanged();
+
public:
KisCompositeProgressProxy* compositeProgressProxy();
diff --git a/libs/image/processing/KisContentLightLevelProcessingVistor.cpp b/libs/image/processing/KisContentLightLevelProcessingVistor.cpp
new file mode 100644
index 0000000000..27cd2bbc04
--- /dev/null
+++ b/libs/image/processing/KisContentLightLevelProcessingVistor.cpp
@@ -0,0 +1,84 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Wolthera van Hövell tot Westerflier <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include "KisContentLightLevelProcessingVistor.h"
+#include <kis_hdr_metadata.h>
+#include "kis_group_layer.h"
+#include "kis_iterator_ng.h"
+#include "kis_raster_keyframe_channel.h"
+
+
+struct KisContentLightLevelProcessingVistor::Private {
+ QList<KisContentLightLevelInformation> clli;
+};
+
+KisContentLightLevelProcessingVistor::KisContentLightLevelProcessingVistor()
+ : KisDoNothingProcessingVisitor(), d(new Private)
+{
+}
+
+KisContentLightLevelProcessingVistor::~KisContentLightLevelProcessingVistor()
+{
+
+}
+
+void KisContentLightLevelProcessingVistor::visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter)
+{
+ Q_UNUSED(undoAdapter)
+ if (layer->parent()) return;
+
+ KisPaintDeviceSP projection = layer->projection();
+ KisPaintDeviceSP dev = new KisPaintDevice(layer->colorSpace());
+ dev->makeCloneFrom(projection, projection->extent());
+ d->clli.append(calculateForDev(dev));
+}
+
+KisContentLightLevelInformation KisContentLightLevelProcessingVistor::contentLightLevelInformation() const
+{
+ KisContentLightLevelInformation clli;
+ double total = 0.0;
+ for(int i = 0; i < d->clli.size(); i++) {
+ KisContentLightLevelInformation c = d->clli.at(i);
+ clli.maxContentLightLevel = qMax(clli.maxContentLightLevel, c.maxContentLightLevel);
+ total += c.maxFrameAverageLightLevel;
+ }
+ clli.maxFrameAverageLightLevel = d->clli.isEmpty()? 0.0: total / d->clli.size();
+ return clli;
+}
+
+KisContentLightLevelInformation KisContentLightLevelProcessingVistor::calculateForDev(KisPaintDeviceSP dev)
+{
+ /**
+ * @brief xyzCS
+ * We need the luminance, so we could either do complex luminance calculations
+ * for each and every color space... Or we could convert to linear XYZ and only
+ * test the Y value.
+ */
+ const KoColorSpace *xyzCS = KoColorSpaceRegistry::instance()->colorSpace(XYZAColorModelID.id(), Float32BitsColorDepthID.id());
+ dev->convertTo(xyzCS, KoColorConversionTransformation::IntentRelativeColorimetric);
+
+ QRectF imageBounds = dev->extent();
+ KisHLineConstIteratorSP it = dev->createHLineConstIteratorNG(imageBounds.x(), imageBounds.y(), imageBounds.width());
+
+ KisContentLightLevelInformation clli;
+ double average = 0.0;
+ int divider = 0;
+
+ qDebug() << "preparing frame" << imageBounds;
+ for (int y = 0; y < imageBounds.height(); y++) {
+ for (int x = 0; x < imageBounds.width(); x++) {
+ const KoXyzF32Traits::Pixel* pixel = reinterpret_cast<const KoXyzF32Traits::Pixel*> (it->rawDataConst());
+ clli.maxContentLightLevel = qMax(clli.maxContentLightLevel, pixel->y);
+ average += pixel->y;
+ divider ++;
+ it->nextPixel();
+ }
+ it->nextRow();
+ }
+
+ clli.maxFrameAverageLightLevel = average / divider;
+ qDebug() << "handled frame" << clli.maxContentLightLevel << clli.maxFrameAverageLightLevel;
+ return clli;
+}
diff --git a/libs/image/processing/KisContentLightLevelProcessingVistor.h b/libs/image/processing/KisContentLightLevelProcessingVistor.h
new file mode 100644
index 0000000000..efcc370b87
--- /dev/null
+++ b/libs/image/processing/KisContentLightLevelProcessingVistor.h
@@ -0,0 +1,37 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Wolthera van Hövell tot Westerflier <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef KISCONTENTLIGHTLEVELPROCESSINGVISTOR_H
+#define KISCONTENTLIGHTLEVELPROCESSINGVISTOR_H
+
+#include "kis_types.h"
+#include <kis_do_nothing_processing_visitor.h>
+#include <QScopedPointer>
+
+struct KisContentLightLevelInformation;
+/**
+ * @brief The KisContentLightLevelProcessingVistor class
+ * This processing visitor checks the projection of the root level node,
+ * and calculates the Content Light Level Information for it.
+ */
+class KisContentLightLevelProcessingVistor : public KisDoNothingProcessingVisitor
+{
+
+public:
+ KisContentLightLevelProcessingVistor();
+ ~KisContentLightLevelProcessingVistor() override;
+
+ using KisDoNothingProcessingVisitor::visit;
+ void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter) override;
+
+ KisContentLightLevelInformation contentLightLevelInformation() const;
+
+private:
+ KisContentLightLevelInformation calculateForDev(KisPaintDeviceSP dev);
+ struct Private;
+ QScopedPointer<Private> d;
+};
+
+#endif // KISCONTENTLIGHTLEVELPROCESSINGVISTOR_H
diff --git a/libs/ui/dialogs/kis_dlg_image_properties.cc b/libs/ui/dialogs/kis_dlg_image_properties.cc
index dd4dc1bbf0..c846ce76e5 100644
--- a/libs/ui/dialogs/kis_dlg_image_properties.cc
+++ b/libs/ui/dialogs/kis_dlg_image_properties.cc
@@ -19,6 +19,7 @@
#include <kis_config.h>
#include <kis_signal_compressor.h>
#include <kis_image_config.h>
+#include "kis_hdr_metadata.h"
#include "kis_layer_utils.h"
#include <kis_display_color_converter.h>
#include <KisWidgetConnectionUtils.h>
@@ -29,6 +30,7 @@ struct KisDlgImageProperties::Private {
Private(KisDisplayColorConverter *colorConverter)
: compressor(KisSignalCompressor(500 /* ms */, KisSignalCompressor::POSTPONE))
, colorConverter(colorConverter)
+ , colorVolumeCompressor(KisSignalCompressor(500 /* ms */, KisSignalCompressor::POSTPONE))
{
}
KisImageWSP image;
@@ -37,6 +39,7 @@ struct KisDlgImageProperties::Private {
QLabel *colorWarningLabel {0};
KisSignalCompressor compressor ;
KisDisplayColorConverter *colorConverter;
+ KisSignalCompressor colorVolumeCompressor;
};
KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, KisDisplayColorConverter *colorConverter, QWidget *parent, const char *name)
@@ -109,6 +112,33 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, KisDisplayColorC
this,
&KisDlgImageProperties::setProofingConfigToImage);
+ updateHDRLightLevels();
+ updateHDRColorVolume();
+ connect(m_page->btnCalculateClli, &QPushButton::clicked, d->image, &KisImage::calculateContentLightLevelInformation);
+ connect(d->image, &KisImage::sigContentLightLevelInformationChanged, this, &KisDlgImageProperties::updateHDRLightLevels);
+ connect(d->image, &KisImage::sigDiffuseWhiteLightLevelChanged, this, &KisDlgImageProperties::updateHDRLightLevels);
+ connect(d->image, &KisImage::sigColorVolumeInformationChanged, this, &KisDlgImageProperties::updateHDRColorVolume);
+
+ connect(m_page->gbxDiffuseWhite, &QGroupBox::clicked, this, &KisDlgImageProperties::setHDRLightLevelsOnImage);
+ connect(m_page->spnDiffuseWhite, &QDoubleSpinBox::valueChanged, this, &KisDlgImageProperties::setHDRLightLevelsOnImage);
+
+ m_page->cmbColorVolumePresets->addItem(i18n("Rec. 2100 PQ"), "p2100-pq");
+ m_page->cmbColorVolumePresets->addItem(i18n("DCI-P3 D65"), "dci-p3-d65");
+
+ connect(m_page->cmbColorVolumePresets, &QComboBox::activated, this, &KisDlgImageProperties::changeColorVolumePreset);
+ connect(m_page->gbxColorVolume, &QGroupBox::clicked, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnWhiteX, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnWhiteY, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnRedX, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnRedY, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnGreenX, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnGreenY, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnBlueX, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnBlueX, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnMinLuminance, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(m_page->spnMaxLuminance, &QDoubleSpinBox::valueChanged, &d->colorVolumeCompressor, &KisSignalCompressor::start);
+ connect(&d->colorVolumeCompressor, &KisSignalCompressor::timeout, this, &KisDlgImageProperties::setHDRColorVolumeOnImage);
+
//annotations
vKisAnnotationSP_it beginIt = image->beginAnnotations();
vKisAnnotationSP_it endIt = image->endAnnotations();
@@ -197,6 +227,120 @@ void KisDlgImageProperties::updateDisplayConfigInfo()
m_page->wdgProofingOptions->setDisplayConfigOptions(d->colorConverter->conversionOptions());
}
+void KisDlgImageProperties::updateHDRLightLevels()
+{
+ if (d->image->diffuseWhiteLightLevel()) {
+ m_page->gbxDiffuseWhite->setChecked(true);
+ m_page->spnDiffuseWhite->setValue(*d->image->diffuseWhiteLightLevel());
+ } else {
+ m_page->gbxDiffuseWhite->setChecked(false);
+ m_page->spnDiffuseWhite->setValue(80);
+ }
+ if (d->image->contentLightLevelInformation()) {
+ double diffuseWhite = d->image->diffuseWhiteLightLevel()? *d->image->diffuseWhiteLightLevel(): 80.0;
+ KisContentLightLevelInformation clli = *d->image->contentLightLevelInformation();
+ m_page->lblMaxCll->setText(i18n("%1 cd/m²").arg(QString::number(diffuseWhite*clli.maxContentLightLevel)));
+ m_page->lblMaxFall->setText(i18n("%1 cd/m²").arg(QString::number(diffuseWhite*clli.maxFrameAverageLightLevel)));
+ } else {
+ m_page->lblMaxCll->setText(i18n("Unknown"));
+ m_page->lblMaxFall->setText(i18n("Unknown"));
+ }
+}
+
+void KisDlgImageProperties::updateHDRColorVolume()
+{
+ if (d->image->colorVolumeInformation()) {
+ m_page->gbxColorVolume->setChecked(true);
+ KisColorVolumeInformation cvi = *d->image->colorVolumeInformation();
+ m_page->spnWhiteX->setValue(cvi.white.x());
+ m_page->spnWhiteY->setValue(cvi.white.y());
+
+ m_page->spnRedX->setValue(cvi.red.x());
+ m_page->spnRedY->setValue(cvi.red.y());
+
+ m_page->spnGreenX->setValue(cvi.green.x());
+ m_page->spnGreenY->setValue(cvi.green.y());
+
+ m_page->spnBlueX->setValue(cvi.blue.x());
+ m_page->spnBlueY->setValue(cvi.blue.y());
+
+ m_page->spnMaxLuminance->setValue(cvi.maxLuminance);
+ m_page->spnMinLuminance->setValue(cvi.minLuminance);
+
+ } else {
+ m_page->gbxColorVolume->setChecked(false);
+ }
+}
+
+void KisDlgImageProperties::setHDRLightLevelsOnImage()
+{
+ if (m_page->gbxDiffuseWhite->isChecked()) {
+ d->image->setDiffuseWhiteLightLevel(std::make_optional(m_page->spnDiffuseWhite->value()));
+ } else {
+ d->image->setDiffuseWhiteLightLevel(std::nullopt);
+ }
+}
+
+void KisDlgImageProperties::setHDRColorVolumeOnImage()
+{
+ if (m_page->gbxColorVolume->isChecked()) {
+ KisColorVolumeInformation cvi;
+
+ cvi.white = QPointF(m_page->spnWhiteX->value(), m_page->spnWhiteY->value());
+
+ cvi.red = QPointF(m_page->spnRedX->value(), m_page->spnRedY->value());
+ cvi.green = QPointF(m_page->spnGreenX->value(), m_page->spnGreenY->value());
+ cvi.blue = QPointF(m_page->spnBlueX->value(), m_page->spnBlueY->value());
+
+ cvi.maxLuminance = m_page->spnMaxLuminance->value();
+ cvi.minLuminance = m_page->spnMinLuminance->value();
+
+ d->image->setColorVolumeInformation(std::make_optional(cvi));
+ } else {
+ d->image->setColorVolumeInformation(std::nullopt);
+ }
+}
+
+void KisDlgImageProperties::changeColorVolumePreset()
+{
+ const QString displayId = m_page->cmbColorVolumePresets->currentData().toString();
+
+ if (displayId == "p2100-pq") {
+ m_page->spnRedX->setValue(0.708);
+ m_page->spnRedY->setValue(0.292);
+
+ m_page->spnGreenX->setValue(0.170);
+ m_page->spnGreenY->setValue(0.797);
+
+ m_page->spnBlueX->setValue(0.131);
+ m_page->spnBlueY->setValue(0.046);
+
+ m_page->spnWhiteX->setValue(0.3127);
+ m_page->spnWhiteY->setValue(0.3290);
+
+ m_page->spnMinLuminance->setValue(0.005);
+ m_page->spnMaxLuminance->setValue(1000);
+
+ } else if (displayId == "dci-p3-d65") {
+
+ m_page->spnRedX->setValue(0.680);
+ m_page->spnRedY->setValue(0.320);
+
+ m_page->spnGreenX->setValue(0.265);
+ m_page->spnGreenY->setValue(0.690);
+
+ m_page->spnBlueX->setValue(0.150);
+ m_page->spnBlueY->setValue(0.060);
+
+ m_page->spnWhiteX->setValue(0.3127);
+ m_page->spnWhiteY->setValue(0.3290);
+
+ m_page->spnMinLuminance->setValue(0.005);
+ m_page->spnMaxLuminance->setValue(1000);
+
+ }
+}
+
void KisDlgImageProperties::slotColorSpaceChanged(const KoColorSpace *cs)
{
if (*d->image->profile() != *cs->profile() &&
diff --git a/libs/ui/dialogs/kis_dlg_image_properties.h b/libs/ui/dialogs/kis_dlg_image_properties.h
index 26aa1850d7..b081667c31 100644
--- a/libs/ui/dialogs/kis_dlg_image_properties.h
+++ b/libs/ui/dialogs/kis_dlg_image_properties.h
@@ -45,6 +45,14 @@ private Q_SLOTS:
void setProofingConfigToImage();
void updateDisplayConfigInfo();
+ void updateHDRLightLevels();
+ void updateHDRColorVolume();
+
+ void setHDRLightLevelsOnImage();
+ void setHDRColorVolumeOnImage();
+
+ void changeColorVolumePreset();
+
void slotColorSpaceChanged(const KoColorSpace*);
private:
diff --git a/libs/ui/forms/wdgimageproperties.ui b/libs/ui/forms/wdgimageproperties.ui
index 61230f6b1b..2ea4555fc1 100644
--- a/libs/ui/forms/wdgimageproperties.ui
+++ b/libs/ui/forms/wdgimageproperties.ui
@@ -11,7 +11,7 @@
<x>0</x>
<y>0</y>
<width>449</width>
- <height>431</height>
+ <height>504</height>
</rect>
</property>
<property name="windowTitle">
@@ -297,6 +297,294 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="grpHdrMeta">
+ <attribute name="title">
+ <string>HDR Metadata</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <widget class="QGroupBox" name="gbxDiffuseWhite">
+ <property name="title">
+ <string>Diffuse White</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <widget class="QDoubleSpinBox" name="spnDiffuseWhite">
+ <property name="suffix">
+ <string>cd/m²</string>
+ </property>
+ <property name="maximum">
+ <double>10000.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbxContentLightLevel">
+ <property name="title">
+ <string>Content Light Level Information</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QFormLayout" name="formLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Max Content Light Level:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Max Frame Avarage light Level:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="lblMaxCll">
+ <property name="text">
+ <string>Unknown</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="lblMaxFall">
+ <property name="text">
+ <string>Unknown</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="btnCalculateClli">
+ <property name="text">
+ <string>Calculate</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbxColorVolume">
+ <property name="title">
+ <string>Color Volume Information</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Preset:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="cmbColorVolumePresets"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="spnMaxLuminance">
+ <property name="suffix">
+ <string>cd/m²</string>
+ </property>
+ <property name="maximum">
+ <double>10000.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="spnMinLuminance">
+ <property name="suffix">
+ <string>cd/m²</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="spnGreenX">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QDoubleSpinBox" name="spnBlueY">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="spnWhiteX">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QDoubleSpinBox" name="spnWhiteY">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QDoubleSpinBox" name="spnRedY">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="spnRedX">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>x:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>y:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QDoubleSpinBox" name="spnBlueX">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QDoubleSpinBox" name="spnGreenY">
+ <property name="decimals">
+ <number>6</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>White:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Red:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Green:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Blue:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Maximum Luminance:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>Minimum Luminance:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Annotations</string>