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 piecewise filmic tone mapping.

Wolthera van Hövell tot Westerflier972152a26bc2
diff --git a/libs/pigment/KoGamutMappingUtils.cpp b/libs/pigment/KoGamutMappingUtils.cpp
index abd20c2e5f..b6d209fa50 100644
--- a/libs/pigment/KoGamutMappingUtils.cpp
+++ b/libs/pigment/KoGamutMappingUtils.cpp
@@ -115,3 +115,138 @@ float KoGamutMappingUtils::reinhardToneMapping(const float linearY, const float
const float num = linearY * (1.0f + (linearY/(maxY*maxY)));
return num / (linearY + 1.0f);
}
+
+//---------- Piecewise Filmic Curve -----------//
+
+static void SolveAB(float & lnA, float & B, float x0, float y0, float m)
+{
+ B = (m*x0)/y0;
+ lnA = logf(y0) - B*logf(x0);
+}
+
+static void AsSlopeIntercept(float & m, float & b, float x0, float x1, float y0, float y1)
+{
+ float dy = (y1-y0);
+ float dx = (x1-x0);
+ if (dx == 0)
+ m = 1.0f;
+ else
+ m = dy/dx;
+
+ b = y0 - x0*m;
+}
+
+static float EvalDerivativeLinearGamma(float m, float b, float g, float x)
+{
+ float ret = g*m*powf(m*x+b,g-1.0f);
+ return ret;
+}
+
+KoGamutMappingUtils::PiecewiseFilmicCurve::PiecewiseFilmicCurve(float maxWhite, QPointF point0, QPointF point1, QPointF overshootPoint)
+{
+ segments = QVector<Segment>(3);
+
+ p0 = point0;
+ p1 = point1;
+ QPointF overshoot = overshootPoint;
+
+ inverseMaxWhite = 1.0/maxWhite;
+ // normalize
+
+
+
+ p0.setX(p0.x()/maxWhite);
+ p1.setX(p1.x()/maxWhite);
+
+ overshoot.setX(overshootPoint.x()/maxWhite);
+
+ Segment linear;
+ float m, b;
+ AsSlopeIntercept(m, b, p0.x(), p1.x(), p0.y(), p1.y());
+ const float g = 1.0;
+
+ linear.offsetX = -(b / m);
+ linear.lnA = g * logf(m);
+ linear.b = g;
+
+ segments[1] = linear;
+
+ const float toeM = EvalDerivativeLinearGamma(m, b, g, p0.x());
+ const float shoulderM = EvalDerivativeLinearGamma(m, b, g, p1.x());
+
+ Segment toe;
+ SolveAB(toe.lnA, toe.b, toe.offsetX, toe.offsetY, toeM);
+ segments[0] = toe;
+
+ Segment shoulder;
+ const float x0 = (1.0f + overshoot.x()) - p1.x();
+ const float y0 = (1.0f + overshoot.y()) - p1.y();
+ SolveAB(shoulder.lnA, shoulder.b, x0, y0, shoulderM);
+
+ shoulder.offsetX = (1.0f + overshoot.x());
+ shoulder.offsetY = (1.0f + overshoot.y());
+ shoulder.scaleX = -1.0;
+ shoulder.scaleY = -1.0;
+
+ segments[2] = shoulder;
+
+ {
+ const float scale = shoulder.evalSegment(1.0f);
+ const float invScale = 1.0f / scale;
+
+ segments[0].offsetY *= invScale;
+ segments[0].scaleY *= invScale;
+
+ segments[1].offsetY *= invScale;
+ segments[1].scaleY *= invScale;
+
+ segments[2].offsetY *= invScale;
+ segments[2].scaleY *= invScale;
+ }
+}
+
+float KoGamutMappingUtils::PiecewiseFilmicCurve::evalCurve(const float x)
+{
+ int index = (x < p0.x()) ? 0 : ((x < p1.x()) ? 1 : 2);
+ Segment s = segments.at(index);
+ return s.evalSegment(x*inverseMaxWhite);
+}
+
+float KoGamutMappingUtils::PiecewiseFilmicCurve::Segment::evalSegment(const float x)
+{
+ float x0 = (x - offsetX) * scaleX;
+ float y0 = x0 > 0? expf(lnA + b * logf(x0)): 0.0;
+ return y0 * scaleY + offsetY;
+}
+
+KoGamutMappingUtils::PiecewiseFilmicCurve KoGamutMappingUtils::PiecewiseFilmicCurve::fromUserParams(float toeStrength, float toeLength, float shoulderStrength, float shoulderLength, float shoulderAngle)
+{
+ const float uiGamma = 2.2f;
+
+ const float normalizedToeLength = powf(qBound(0.0, toeLength, 1.0), uiGamma);
+ const float normalizedToeStrength = qBound(0.0, toeStrength, 1.0);
+ const float normalizedShoulderAngle = qBound(0.0, shoulderAngle, 1.0);
+
+ const float x0 = normalizedToeLength * .5f;
+ const float y0 = (1.0f - normalizedToeStrength) * x0;
+
+ const float remainingY = 1.0f - y0;
+ const float initialW = x0 + remainingY;
+
+ const float y1_offset = (1.0f - shoulderLength) * remainingY;
+ const float x1 = x0 + y1_offset;
+ const float y1 = y0 + y1_offset;
+
+ const float extraW = exp2f(shoulderStrength)-1.0f;
+ const float W = initialW + extraW;
+
+ QPointF point0(powf(x0, uiGamma), powf(y0, uiGamma));
+ QPointF point1(powf(x1, uiGamma), powf(y1, uiGamma));
+ float maxWhite = W;
+
+ QPointF overshoot;
+ overshoot.setX((W * 2.0f) * normalizedShoulderAngle * shoulderStrength);
+ overshoot.setY(0.5f * normalizedShoulderAngle * shoulderStrength);
+
+ return PiecewiseFilmicCurve(maxWhite, point0, point1, overshoot);
+}
diff --git a/libs/pigment/KoGamutMappingUtils.h b/libs/pigment/KoGamutMappingUtils.h
index 02d7007a71..d302c463db 100644
--- a/libs/pigment/KoGamutMappingUtils.h
+++ b/libs/pigment/KoGamutMappingUtils.h
@@ -6,7 +6,9 @@
#ifndef KOGAMUTMAPPINGUTILS_H
#define KOGAMUTMAPPINGUTILS_H
+#include <QPointF>
#include <QVector>
+
#include "kritapigment_export.h"
namespace KRITAPIGMENT_EXPORT KoGamutMappingUtils {
@@ -38,6 +40,11 @@ enum MappingModel {
OkLAB
};
+enum CurveType {
+ Reinhard,
+ PiecewiseFilmic
+};
+
/**
* @brief reinhardToneMapping
* Implements 'extended' reinhard tonemapping.
@@ -47,6 +54,41 @@ enum MappingModel {
*/
float reinhardToneMapping(const float linearY, const float maxY);
+/**
+ * @brief The piecewiseFilmicCurve class
+ * Implement's Hable's piecewise filmic curve.
+ * https://filmicworlds.com/blog/filmic-tonemapping-with-piecewise-power-curves/
+ * License: CC-0
+ */
+struct PiecewiseFilmicCurve {
+
+ QPointF p0;
+ QPointF p1;
+
+ float inverseMaxWhite {1.0};
+
+ struct Segment {
+ float lnA{0.0f};
+ float b{0.0f};
+
+ float offsetX{0.0f};
+ float offsetY{0.0f};
+ float scaleX{1.0f};
+ float scaleY{1.0f};
+
+ float evalSegment(const float x);
+ };
+
+ QVector<Segment> segments;
+
+ PiecewiseFilmicCurve(float maxWhite, QPointF point0, QPointF point1, QPointF overshootPoint);
+ static PiecewiseFilmicCurve fromUserParams(float toeStrength = 0.5, float toeLength = 0.5, float shoulderStrength = 2.0, float shoulderLength = 0.5, float shoulderAngle = 1.0);
+
+ float evalCurve(const float x);
+};
+
+
+
};
#endif // KOGAMUTMAPPINGUTILS_H
diff --git a/libs/ui/widgets/kis_tone_curve_widget.cpp b/libs/ui/widgets/kis_tone_curve_widget.cpp
index 3f8758d65c..650ceb47c4 100644
--- a/libs/ui/widgets/kis_tone_curve_widget.cpp
+++ b/libs/ui/widgets/kis_tone_curve_widget.cpp
@@ -135,10 +135,11 @@ void KisToneCurveWidget::drawGrid()
QTextStream(&s) << y;
biasedLine(xstart, d->pxrows - grids(1), xstart, d->pxrows - grids(4));
biasedText(xstart - grids(11), d->pxrows + grids(15), s);
-
- QTextStream(&s) << 10 - y;
+
+ QString s2;
+ QTextStream(&s2) << (10 - y);
biasedLine(0, ystart, grids(3), ystart);
- biasedText(grids(-25), ystart + grids(5), s);
+ biasedText(grids(-25), ystart + grids(5), s2);
}
d->painter.setPen(qRgb(128, 128, 128));
diff --git a/plugins/color/colorspaceextensions/kis_tonemap_adjustment.cpp b/plugins/color/colorspaceextensions/kis_tonemap_adjustment.cpp
index 9c4ac74738..e9ba1da4e4 100644
--- a/plugins/color/colorspaceextensions/kis_tonemap_adjustment.cpp
+++ b/plugins/color/colorspaceextensions/kis_tonemap_adjustment.cpp
@@ -114,6 +114,101 @@ private:
};
+template <class LuminanceModel>
+class KisPiecewiseFilmicToneMapAdjustment: public KoColorTransformation
+{
+public:
+ KisPiecewiseFilmicToneMapAdjustment(const KoColorSpace *sourceSpace): m_sourceSpace(sourceSpace) {}
+
+ void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const override
+ {
+ if (!m_sourceSpace) {
+ qWarning() << "no source space!";
+ return;
+ }
+
+ KoGamutMappingUtils::PiecewiseFilmicCurve curve =
+ KoGamutMappingUtils::PiecewiseFilmicCurve::fromUserParams(m_toeStrength, m_toeLength, m_shoulderStrength, m_shoulderLength, m_shoulderAngle);
+
+ while (nPixels > 0) {
+ QVector<float> originalChannels(m_sourceSpace->channelCount());
+ quint8* tmpOriginal = new quint8(m_sourceSpace->pixelSize());
+ m_sourceSpace->normalisedChannelsValue(srcU8, originalChannels);
+
+ float Y = LuminanceModel::luminance(originalChannels);
+ Y = curve.evalCurve(Y);
+ originalChannels = LuminanceModel::setLuminance(originalChannels, Y);
+
+ m_sourceSpace->fromNormalisedChannelsValue(tmpOriginal, originalChannels);
+ memcpy(dstU8, tmpOriginal, m_sourceSpace->pixelSize());
+
+ --nPixels;
+ srcU8 += m_sourceSpace->pixelSize();
+ dstU8 += m_sourceSpace->pixelSize();
+ }
+ }
+
+ QList<QString> parameters() const override
+ {
+ QList<QString> list;
+ list << "toeStrength";
+ list << "toeLength";
+ list << "shoulderStrength";
+ list << "shoulderLength";
+ list << "shoulderAngle";
+ return list;
+ }
+
+ int parameterId(const QString& name) const override
+ {
+ if (name == "toeStrength") {
+ return 0;
+ } else if (name == "toeLength") {
+ return 1;
+ } else if (name == "shoulderStrength") {
+ return 2;
+ } else if (name == "shoulderLength") {
+ return 3;
+ } else if (name == "shoulderAngle") {
+ return 4;
+ }
+ return -1;
+ }
+
+ void setParameter(int id, const QVariant& parameter) override
+ {
+ switch(id)
+ {
+ case 0:
+ m_toeStrength = parameter.toFloat();
+ break;
+ case 1:
+ m_toeLength = parameter.toFloat();
+ break;
+ case 2:
+ m_shoulderStrength = parameter.toFloat();
+ break;
+ case 3:
+ m_shoulderLength = parameter.toFloat();
+ break;
+ case 4:
+ m_shoulderAngle = parameter.toFloat();
+ break;
+ default:
+ ;
+ }
+ }
+
+private:
+ const KoColorSpace *m_sourceSpace;
+ float m_toeStrength{0.5};
+ float m_toeLength{0.5};
+ float m_shoulderStrength{2.0};
+ float m_shoulderLength{0.5};
+ float m_shoulderAngle{1.0};
+
+};
+
KisToneMapAdjustmentFactory::KisToneMapAdjustmentFactory()
: KoColorTransformationFactory("tonemap_adjustment")
{
@@ -134,9 +229,17 @@ KoColorTransformation *KisToneMapAdjustmentFactory::createTransformation(const K
KoColorTransformation * adj;
if (colorSpace->colorModelId() == XYZAColorModelID) {
- adj = new KisReinhardToneMapAdjustment<XYZLuminanceModel>(colorSpace);
+ if (parameters["CurveType"].toInt() == KoGamutMappingUtils::Reinhard) {
+ adj = new KisReinhardToneMapAdjustment<XYZLuminanceModel>(colorSpace);
+ } else {
+ adj = new KisPiecewiseFilmicToneMapAdjustment<XYZLuminanceModel>(colorSpace);
+ }
} else if (colorSpace->colorModelId() == LABAColorModelID) {
- adj = new KisReinhardToneMapAdjustment<LABLuminanceModel>(colorSpace);
+ if (parameters["CurveType"].toInt() == KoGamutMappingUtils::Reinhard) {
+ adj = new KisReinhardToneMapAdjustment<LABLuminanceModel>(colorSpace);
+ } else {
+ adj = new KisPiecewiseFilmicToneMapAdjustment<LABLuminanceModel>(colorSpace);
+ }
} else {
dbgKrita << "Unsupported color space " << colorSpace->id() << " in KisGamutMapClipAdjustmentFactory::createTransformation";
return nullptr;
diff --git a/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp b/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp
index 2eb4edf01d..b544018798 100644
--- a/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp
+++ b/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp
@@ -22,14 +22,23 @@
#include <klocalizedstring.h>
#include <KoGamutMappingUtils.h>
+
#include "ui_kistonegamutmapwidget.h"
const QString MAPPING_MODEL = "mapping_model"; ///< Enum, model in which the gamut or tone mapping is done.
const QString TONE_MAP_ENABLED = "toneMap/Enabled"; ///< bool, whether to do tone mapping.
-const QString TONE_MAP_MAX_WHITE = "toneMap/MaxWhite"; ///< double, the maximum white that needs to be tonemapped.
+const QString TONE_MAP_MAX_WHITE = "toneMap/reinhard/MaxWhite"; ///< double, the maximum white that needs to be tonemapped.
const QString GAMUT_MAP_ENABLED = "gamutMap/Enabled"; ///< bool, whether to do gamt mapping.
const QString GAMUT_MAP_TARGET_PROFILE = "gamutMap/TargetProfile"; ///< QString, name of the color profile that is the target gamut.
+const QString TONE_MAP_TYPE = "toneMap/CurveType";
+
+const QString TONE_PIECE_WISE_TOE_STRENGTH = "toneMap/pieceWiseFilmic/toeStrength";
+const QString TONE_PIECE_WISE_TOE_LENGTH = "toneMap/pieceWiseFilmic/toeLength";
+const QString TONE_PIECE_WISE_SHOULDER_STRENGTH = "toneMap/pieceWiseFilmic/shoulderStrength";
+const QString TONE_PIECE_WISE_SHOULDER_LENGTH = "toneMap/pieceWiseFilmic/shoulderLength";
+const QString TONE_PIECE_WISE_SHOULDER_ANGLE = "toneMap/pieceWiseFilmic/shoulderAngle";
+
K_PLUGIN_FACTORY_WITH_JSON(KisToneGamutMapFilterFactory, "kritatonegamutmapfilter.json", registerPlugin<KisToneGamutMapFilterPlugin>();)
KisToneGamutMapFilterPlugin::KisToneGamutMapFilterPlugin(QObject *parent, const QVariantList &): QObject(parent)
@@ -68,7 +77,15 @@ KoColorTransformation *KisToneGamutMapFilter::createTransformation(const KoColor
if (config->getProperty(TONE_MAP_ENABLED).toBool()) {
QHash<QString, QVariant> params;
+ params["CurveType"] = config->getProperty(TONE_MAP_TYPE);
+
params["maxWhite"] = config->getProperty(TONE_MAP_MAX_WHITE);
+
+ params["toeStrength"] = config->getProperty(TONE_PIECE_WISE_TOE_STRENGTH);
+ params["toeLength"] = config->getProperty(TONE_PIECE_WISE_TOE_LENGTH);
+ params["shoulderStrength"] = config->getProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH);
+ params["shoulderLength"] = config->getProperty(TONE_PIECE_WISE_SHOULDER_LENGTH);
+ params["shoulderAngle"] = config->getProperty(TONE_PIECE_WISE_SHOULDER_ANGLE);
KoColorTransformation *toneMap = mappingCs->createColorTransformation("tonemap_adjustment", params);
allTransforms << toneMap;
}
@@ -81,6 +98,8 @@ KoColorTransformation *KisToneGamutMapFilter::createTransformation(const KoColor
allTransforms << gamutMap;
}
+ if (allTransforms.isEmpty()) return nullptr;
+
return new KoFallBackColorTransformation(cs, mappingCs, KoCompositeColorTransformation::createOptimizedCompositeTransform(allTransforms));
}
@@ -89,6 +108,13 @@ KisFilterConfigurationSP KisToneGamutMapFilter::defaultConfiguration(KisResource
KisFilterConfigurationSP config = factoryConfiguration(resourcesInterface);
config->setProperty(TONE_MAP_ENABLED, true);
config->setProperty(TONE_MAP_MAX_WHITE, 1.0);
+
+ config->setProperty(TONE_PIECE_WISE_TOE_STRENGTH, 0.5);
+ config->setProperty(TONE_PIECE_WISE_TOE_LENGTH, 0.5);
+ config->setProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH, 2.0);
+ config->setProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, 0.5);
+ config->setProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, 1.0);
+
config->setProperty(GAMUT_MAP_ENABLED, true);
config->setProperty(GAMUT_MAP_TARGET_PROFILE, "sRGB-elle-V2-srgbtrc.icc");
return config;
@@ -115,11 +141,23 @@ KisToneGamutMapWidget::KisToneGamutMapWidget(QWidget *parent, KisPaintDeviceSP d
ui->cmbMappingModel->addItem(i18n("XYZ (ICtCp)"), KoGamutMappingUtils::ICtCp);
ui->cmbMappingModel->addItem(i18n("XYZ (OkLAB)"), KoGamutMappingUtils::OkLAB);
+ ui->cmbToneCurveType->addItem(i18n("Reinhard"), KoGamutMappingUtils::Reinhard);
+ ui->cmbToneCurveType->addItem(i18n("Piecewise Filmic"), KoGamutMappingUtils::PiecewiseFilmic);
+
connect(ui->cmbMappingModel, SIGNAL(activated(int)), SIGNAL(sigConfigurationItemChanged()));
+ connect(ui->cmbToneCurveType, SIGNAL(activated(int)), ui->stkToneMap, SLOT(setCurrentIndex(int)));
+ connect(ui->cmbToneCurveType, SIGNAL(activated(int)), SIGNAL(sigConfigurationItemChanged()));
connect(ui->chkToneMap, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
+
connect(ui->spnMaxWhite, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
+ connect(ui->spnToeStrength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
+ connect(ui->spnToeLength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
+ connect(ui->spnShoulderStrength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
+ connect(ui->spnShoulderLength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
+ connect(ui->spnShoulderAngle, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
+
connect(ui->chkGamutMap, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
connect(ui->targetGamut, SIGNAL(colorSpaceChanged(const KoColorSpace*)), SIGNAL(sigConfigurationItemChanged()));
}
@@ -136,6 +174,10 @@ void KisToneGamutMapWidget::setConfiguration(const KisPropertiesConfigurationSP
if (config->getProperty(MAPPING_MODEL, value)) {
ui->cmbMappingModel->setCurrentIndex(ui->cmbMappingModel->findData(value));
}
+ if (config->getProperty(TONE_MAP_TYPE, value)) {
+ ui->cmbToneCurveType->setCurrentIndex(ui->cmbToneCurveType->findData(value));
+ ui->stkToneMap->setCurrentIndex(ui->cmbToneCurveType->currentIndex());
+ }
if (config->getProperty(TONE_MAP_ENABLED, value)) {
ui->chkToneMap->setChecked(value.toBool());
@@ -143,6 +185,23 @@ void KisToneGamutMapWidget::setConfiguration(const KisPropertiesConfigurationSP
if (config->getProperty(TONE_MAP_MAX_WHITE, value)) {
ui->spnMaxWhite->setValue(value.toDouble());
}
+ if (config->getProperty(TONE_PIECE_WISE_TOE_STRENGTH, value)) {
+ ui->spnToeStrength->setValue(value.toDouble());
+ }
+ if (config->getProperty(TONE_PIECE_WISE_TOE_LENGTH, value)) {
+ ui->spnToeLength->setValue(value.toDouble());
+ }
+ if (config->getProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH, value)) {
+ ui->spnShoulderStrength->setValue(value.toDouble());
+ }
+ if (config->getProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, value)) {
+ ui->spnShoulderLength->setValue(value.toDouble());
+ }
+ if (config->getProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, value)) {
+ ui->spnShoulderAngle->setValue(value.toDouble());
+ }
+
+
if (config->getProperty(GAMUT_MAP_ENABLED, value)) {
ui->chkGamutMap->setChecked(value.toBool());
}
@@ -166,6 +225,30 @@ KisPropertiesConfigurationSP KisToneGamutMapWidget::configuration() const
config->setProperty(TONE_MAP_ENABLED, ui->chkToneMap->isChecked());
config->setProperty(TONE_MAP_MAX_WHITE, ui->spnMaxWhite->value());
+ config->setProperty(TONE_MAP_TYPE, ui->cmbToneCurveType->currentData());
+
+ config->setProperty(TONE_PIECE_WISE_TOE_STRENGTH, ui->spnToeStrength->value());
+ config->setProperty(TONE_PIECE_WISE_TOE_LENGTH, ui->spnToeLength->value());
+ config->setProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH, ui->spnShoulderStrength->value());
+ config->setProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, ui->spnShoulderLength->value());
+ config->setProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, ui->spnShoulderAngle->value());
+
+ {
+ KoGamutMappingUtils::PiecewiseFilmicCurve curve
+ = KoGamutMappingUtils::PiecewiseFilmicCurve::fromUserParams(ui->spnToeStrength->value(), ui->spnToeLength->value(), ui->spnShoulderStrength->value(), ui->spnShoulderLength->value(), ui->spnShoulderAngle->value());
+ QPolygonF poly;
+ const float white = 1.0/curve.inverseMaxWhite;
+ for (int x = 0; x < 20; x++) {
+ const float val = (float(x)/20.0)*white;
+ const float y = curve.evalCurve(val);
+ poly.append(QPointF(val/white, y));
+ }
+ ui->toneCurvePreview->setGreyscaleCurve(poly);
+ ui->toneCurvePreview->setProfileDataAvailable(true);
+ ui->toneCurvePreview->setToolTip(i18n("Current Maximum White: %1", QString::number(white)));
+ ui->toneCurvePreview->update();
+ }
+
config->setProperty(GAMUT_MAP_ENABLED, ui->chkGamutMap->isChecked());
if (ui->targetGamut->currentColorSpace()) {
config->setProperty(GAMUT_MAP_TARGET_PROFILE, ui->targetGamut->currentColorSpace()->profile()->name());
diff --git a/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui b/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui
index e5eb551d8a..55e1bc1d86 100644
--- a/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui
+++ b/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
- <height>300</height>
+ <height>359</height>
</rect>
</property>
<property name="windowTitle">
@@ -43,22 +43,144 @@
<property name="checkable">
<bool>true</bool>
</property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Max White:</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QComboBox" name="cmbToneCurveType"/>
</item>
- <item row="0" column="1">
- <widget class="QDoubleSpinBox" name="spnMaxWhite">
- <property name="minimum">
- <double>1.000000000000000</double>
- </property>
- <property name="maximum">
- <double>65536.000000000000000</double>
+ <item>
+ <widget class="QStackedWidget" name="stkToneMap">
+ <property name="currentIndex">
+ <number>0</number>
</property>
+ <widget class="QWidget" name="page">
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Max White:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="spnMaxWhite">
+ <property name="minimum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>65536.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QFormLayout" name="formLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Toe Strength:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="spnToeStrength">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.001000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Toe Length:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="spnToeLength">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.001000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Shoulder Strength:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="spnShoulderStrength">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="maximum">
+ <double>99.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Shoulder Length:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="spnShoulderLength">
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Shoulder Angle:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QDoubleSpinBox" name="spnShoulderAngle">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="maximum">
+ <double>1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.010000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="KisToneCurveWidget" name="toneCurvePreview" native="true"/>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
@@ -108,6 +230,12 @@
<header>kis_color_space_selector.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>KisToneCurveWidget</class>
+ <extends>QWidget</extends>
+ <header>kis_tone_curve_widget.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>