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++
Fix some bugs in piecewise filmic, improve ui with tool tips.
Wolthera van Hövell tot Westerflier49fa7615f71a
diff --git a/libs/pigment/KoGamutMappingUtils.cpp b/libs/pigment/KoGamutMappingUtils.cppindex cc90d8ea01..249ffb04a1 100644--- a/libs/pigment/KoGamutMappingUtils.cpp+++ b/libs/pigment/KoGamutMappingUtils.cpp@@ -175,7 +175,7 @@ KoGamutMappingUtils::PiecewiseFilmicCurve::PiecewiseFilmicCurve(float maxWhite,const float shoulderM = EvalDerivativeLinearGamma(m, b, g, p1.x());Segment toe;- SolveAB(toe.lnA, toe.b, toe.offsetX, toe.offsetY, toeM);+ SolveAB(toe.lnA, toe.b, p0.x(), p0.y(), toeM);segments[0] = toe;Segment shoulder;@@ -233,11 +233,11 @@ KoGamutMappingUtils::PiecewiseFilmicCurve KoGamutMappingUtils::PiecewiseFilmicCuconst float remainingY = 1.0f - y0;const float initialW = x0 + remainingY;- const float y1_offset = (1.0f - shoulderLength) * remainingY;+ const float y1_offset = (1.0f - shoulderStrength) * remainingY;const float x1 = x0 + y1_offset;const float y1 = y0 + y1_offset;- const float extraW = exp2f(shoulderStrength)-1.0f;+ const float extraW = exp2f(shoulderLength)-1.0f;const float W = initialW + extraW;QPointF point0(powf(x0, uiGamma), powf(y0, uiGamma));diff --git a/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp b/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cppindex b544018798..23827035bb 100644--- a/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp+++ b/plugins/filters/tonegamutmap/KisToneGamutMapFilter.cpp@@ -111,8 +111,8 @@ KisFilterConfigurationSP KisToneGamutMapFilter::defaultConfiguration(KisResourceconfig->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_STRENGTH, 0.5);+ config->setProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, 2.0);config->setProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, 1.0);config->setProperty(GAMUT_MAP_ENABLED, true);@@ -233,7 +233,7 @@ KisPropertiesConfigurationSP KisToneGamutMapWidget::configuration() constconfig->setProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, ui->spnShoulderLength->value());config->setProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, ui->spnShoulderAngle->value());- {+ if (ui->cmbToneCurveType->currentData() == KoGamutMappingUtils::PiecewiseFilmic) {KoGamutMappingUtils::PiecewiseFilmicCurve curve= KoGamutMappingUtils::PiecewiseFilmicCurve::fromUserParams(ui->spnToeStrength->value(), ui->spnToeLength->value(), ui->spnShoulderStrength->value(), ui->spnShoulderLength->value(), ui->spnShoulderAngle->value());QPolygonF poly;@@ -247,6 +247,18 @@ KisPropertiesConfigurationSP KisToneGamutMapWidget::configuration() constui->toneCurvePreview->setProfileDataAvailable(true);ui->toneCurvePreview->setToolTip(i18n("Current Maximum White: %1", QString::number(white)));ui->toneCurvePreview->update();+ } else {+ QPolygonF poly;+ const float white = ui->spnMaxWhite->value();+ for (int x = 0; x < 20; x++) {+ const float val = (float(x)/20.0)*white;+ const float y = KoGamutMappingUtils::reinhardToneMapping(val, white);+ 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());diff --git a/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui b/plugins/filters/tonegamutmap/kistonegamutmapwidget.uiindex 55e1bc1d86..1bf623ec2d 100644--- a/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui+++ b/plugins/filters/tonegamutmap/kistonegamutmapwidget.ui@@ -43,11 +43,8 @@<property name="checkable"><bool>true</bool></property>- <layout class="QVBoxLayout" name="verticalLayout_3">- <item>- <widget class="QComboBox" name="cmbToneCurveType"/>- </item>- <item>+ <layout class="QFormLayout" name="formLayout_3">+ <item row="1" column="0"><widget class="QStackedWidget" name="stkToneMap"><property name="currentIndex"><number>0</number>@@ -86,6 +83,9 @@</item><item row="0" column="1"><widget class="QDoubleSpinBox" name="spnToeStrength">+ <property name="toolTip">+ <string>The sharpness of the toe fall-off. 0.0 makes it linear, while 1.0 produces a sharp angle.</string>+ </property><property name="decimals"><number>4</number></property>@@ -93,7 +93,7 @@<double>1.000000000000000</double></property><property name="singleStep">- <double>0.001000000000000</double>+ <double>0.010000000000000</double></property></widget></item>@@ -106,6 +106,9 @@</item><item row="1" column="1"><widget class="QDoubleSpinBox" name="spnToeLength">+ <property name="toolTip">+ <string>How much of the dynamic range is in the toe. 0.0 means none, while 1.0 is half the curve.</string>+ </property><property name="decimals"><number>4</number></property>@@ -113,7 +116,7 @@<double>1.000000000000000</double></property><property name="singleStep">- <double>0.001000000000000</double>+ <double>0.010000000000000</double></property></widget></item>@@ -126,11 +129,14 @@</item><item row="2" column="1"><widget class="QDoubleSpinBox" name="spnShoulderStrength">+ <property name="toolTip">+ <string>Curvature of the shoulder. 1.0 is linear.</string>+ </property><property name="decimals"><number>4</number></property><property name="maximum">- <double>99.000000000000000</double>+ <double>1.000000000000000</double></property><property name="singleStep"><double>0.010000000000000</double>@@ -146,11 +152,17 @@</item><item row="3" column="1"><widget class="QDoubleSpinBox" name="spnShoulderLength">+ <property name="toolTip">+ <string>Determines the maximum white in stops.</string>+ </property>+ <property name="suffix">+ <string> stops</string>+ </property><property name="maximum">- <double>1.000000000000000</double>+ <double>999.000000000000000</double></property><property name="singleStep">- <double>0.010000000000000</double>+ <double>0.100000000000000</double></property></widget></item>@@ -163,6 +175,9 @@</item><item row="4" column="1"><widget class="QDoubleSpinBox" name="spnShoulderAngle">+ <property name="toolTip">+ <string>Angle of the shoulder, determines the smoothness of the shift to full white.</string>+ </property><property name="decimals"><number>4</number></property>@@ -176,13 +191,16 @@</item></layout></item>- <item>- <widget class="KisToneCurveWidget" name="toneCurvePreview" native="true"/>- </item></layout></widget></widget></item>+ <item row="1" column="1">+ <widget class="KisToneCurveWidget" name="toneCurvePreview" native="true"/>+ </item>+ <item row="0" column="0" colspan="2">+ <widget class="QComboBox" name="cmbToneCurveType"/>+ </item></layout></widget></item>