diff --git a/rtdata/languages/default b/rtdata/languages/default
index ce41aa858..b24c9a557 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -394,7 +394,6 @@ HISTORY_MSG_142;ES - Iterations
HISTORY_MSG_143;ES - Quantity
HISTORY_MSG_144;Microcontrast - Quantity
HISTORY_MSG_145;Microcontrast - Uniformity
-HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold
HISTORY_MSG_146;Edge sharpening
HISTORY_MSG_147;ES - Luminance only
HISTORY_MSG_148;Microcontrast
@@ -735,8 +734,11 @@ HISTORY_MSG_LOCALCONTRAST_ENABLED;Local Contrast
HISTORY_MSG_LOCALCONTRAST_LIGHTNESS;Local Contrast - Lightness
HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius
HISTORY_MSG_METADATA_MODE;Metadata copy mode
+HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold
HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction
HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter
+HISTORY_MSG_PRSHARPEN_CONTRAST;PRS - Contrast threshold
+HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold
HISTORY_MSG_TM_FATTAL_ANCHOR;HDR TM - Anchor
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s
diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h
index cdfdb7b74..135ab26ee 100644
--- a/rtengine/improcfun.h
+++ b/rtengine/improcfun.h
@@ -58,10 +58,6 @@ class ImProcFunctions
void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap);
void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap);
- void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, int W, int H, const SharpeningParams &sharpenParam);
- void sharpenHaloCtrl (LabImage* lab, float** blurmap, float** base, int W, int H, SharpeningParams &sharpenParam);
- void sharpenHaloCtrlcam (CieImage* ncie, float** blurmap, float** base, int W, int H);
-
bool needsCA ();
bool needsDistortion ();
bool needsRotation ();
diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc
index 26d5e608c..a3ae53747 100644
--- a/rtengine/ipsharpen.cc
+++ b/rtengine/ipsharpen.cc
@@ -100,6 +100,69 @@ void buildBlendMask(float** luminance, rtengine::JaggedArray &blend, int
}
}
+void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, float** blend, int W, int H, const SharpeningParams &sharpenParam)
+{
+
+ float scale = (100.f - sharpenParam.halocontrol_amount) * 0.01f;
+ float sharpFac = sharpenParam.amount * 0.01f;
+ float** nL = base;
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+
+ for (int i = 2; i < H - 2; i++) {
+ float max1 = 0, max2 = 0, min1 = 0, min2 = 0;
+
+ for (int j = 2; j < W - 2; j++) {
+ // compute 3 iterations, only forward
+ float np1 = 2.f * (nL[i - 2][j] + nL[i - 2][j + 1] + nL[i - 2][j + 2] + nL[i - 1][j] + nL[i - 1][j + 1] + nL[i - 1][j + 2] + nL[i] [j] + nL[i] [j + 1] + nL[i] [j + 2]) / 27.f + nL[i - 1][j + 1] / 3.f;
+ float np2 = 2.f * (nL[i - 1][j] + nL[i - 1][j + 1] + nL[i - 1][j + 2] + nL[i] [j] + nL[i] [j + 1] + nL[i] [j + 2] + nL[i + 1][j] + nL[i + 1][j + 1] + nL[i + 1][j + 2]) / 27.f + nL[i] [j + 1] / 3.f;
+ float np3 = 2.f * (nL[i] [j] + nL[i] [j + 1] + nL[i] [j + 2] + nL[i + 1][j] + nL[i + 1][j + 1] + nL[i + 1][j + 2] + nL[i + 2][j] + nL[i + 2][j + 1] + nL[i + 2][j + 2]) / 27.f + nL[i + 1][j + 1] / 3.f;
+
+ // Max/Min of all these deltas and the last two max/min
+ float maxn = rtengine::max(np1, np2, np3);
+ float minn = rtengine::min(np1, np2, np3);
+ float max_ = rtengine::max(max1, max2, maxn);
+ float min_ = rtengine::min(min1, min2, minn);
+
+ // Shift the queue
+ max1 = max2;
+ max2 = maxn;
+ min1 = min2;
+ min2 = minn;
+ float labL = luminance[i][j];
+
+ if (max_ < labL) {
+ max_ = labL;
+ }
+
+ if (min_ > labL) {
+ min_ = labL;
+ }
+
+ // deviation from the environment as measurement
+ float diff = nL[i][j] - blurmap[i][j];
+
+ constexpr float upperBound = 2000.f; // WARNING: Duplicated value, it's baaaaaad !
+ float delta = sharpenParam.threshold.multiply(
+ rtengine::min(fabsf(diff), upperBound), // X axis value = absolute value of the difference
+ sharpFac * diff // Y axis max value = sharpening.amount * signed difference
+ );
+ float newL = labL + delta;
+
+ // applying halo control
+ if (newL > max_) {
+ newL = max_ + (newL - max_) * scale;
+ } else if (newL < min_) {
+ newL = min_ - (min_ - newL) * scale;
+ }
+
+ luminance[i][j] = intp(blend[i][j], newL, luminance[i][j]);
+ }
+ }
+}
+
void dcdamping (float** aI, float** aO, float damping, int W, int H)
{
@@ -160,10 +223,6 @@ void dcdamping (float** aI, float** aO, float damping, int W, int H)
namespace rtengine
{
-#undef ABS
-
-#define ABS(a) ((a)<0?-(a):(a))
-
extern const Settings* settings;
void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, int W, int H, const SharpeningParams &sharpenParam)
@@ -286,10 +345,10 @@ void ImProcFunctions::sharpening (LabImage* lab, float** b2, SharpeningParams &s
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++) {
- const float upperBound = 2000.f; // WARNING: Duplicated value, it's baaaaaad !
+ constexpr float upperBound = 2000.f; // WARNING: Duplicated value, it's baaaaaad !
float diff = base[i][j] - b2[i][j];
float delta = sharpenParam.threshold.multiply(
- min(ABS(diff), upperBound), // X axis value = absolute value of the difference, truncated to the max value of this field
+ min(fabsf(diff), upperBound), // X axis value = absolute value of the difference, truncated to the max value of this field
sharpenParam.amount * diff * 0.01f // Y axis max value
);
lab->L[i][j] = intp(blend[i][j], lab->L[i][j] + delta, lab->L[i][j]);
@@ -308,9 +367,9 @@ void ImProcFunctions::sharpening (LabImage* lab, float** b2, SharpeningParams &s
labCopy[i][j] = lab->L[i][j];
}
- sharpenHaloCtrl (lab->L, b2, labCopy, W, H, sharpenParam);
+ sharpenHaloCtrl (lab->L, b2, labCopy, blend, W, H, sharpenParam);
} else {
- sharpenHaloCtrl (lab->L, b2, base, W, H, sharpenParam);
+ sharpenHaloCtrl (lab->L, b2, base, blend, W, H, sharpenParam);
}
}
@@ -324,69 +383,6 @@ void ImProcFunctions::sharpening (LabImage* lab, float** b2, SharpeningParams &s
}
}
-void ImProcFunctions::sharpenHaloCtrl (float** luminance, float** blurmap, float** base, int W, int H, const SharpeningParams &sharpenParam)
-{
-
- float scale = (100.f - sharpenParam.halocontrol_amount) * 0.01f;
- float sharpFac = sharpenParam.amount * 0.01f;
- float** nL = base;
-
-#ifdef _OPENMP
- #pragma omp parallel for
-#endif
-
- for (int i = 2; i < H - 2; i++) {
- float max1 = 0, max2 = 0, min1 = 0, min2 = 0;
-
- for (int j = 2; j < W - 2; j++) {
- // compute 3 iterations, only forward
- float np1 = 2.f * (nL[i - 2][j] + nL[i - 2][j + 1] + nL[i - 2][j + 2] + nL[i - 1][j] + nL[i - 1][j + 1] + nL[i - 1][j + 2] + nL[i] [j] + nL[i] [j + 1] + nL[i] [j + 2]) / 27.f + nL[i - 1][j + 1] / 3.f;
- float np2 = 2.f * (nL[i - 1][j] + nL[i - 1][j + 1] + nL[i - 1][j + 2] + nL[i] [j] + nL[i] [j + 1] + nL[i] [j + 2] + nL[i + 1][j] + nL[i + 1][j + 1] + nL[i + 1][j + 2]) / 27.f + nL[i] [j + 1] / 3.f;
- float np3 = 2.f * (nL[i] [j] + nL[i] [j + 1] + nL[i] [j + 2] + nL[i + 1][j] + nL[i + 1][j + 1] + nL[i + 1][j + 2] + nL[i + 2][j] + nL[i + 2][j + 1] + nL[i + 2][j + 2]) / 27.f + nL[i + 1][j + 1] / 3.f;
-
- // Max/Min of all these deltas and the last two max/min
- float maxn = max(np1, np2, np3);
- float minn = min(np1, np2, np3);
- float max_ = max(max1, max2, maxn);
- float min_ = min(min1, min2, minn);
-
- // Shift the queue
- max1 = max2;
- max2 = maxn;
- min1 = min2;
- min2 = minn;
- float labL = luminance[i][j];
-
- if (max_ < labL) {
- max_ = labL;
- }
-
- if (min_ > labL) {
- min_ = labL;
- }
-
- // deviation from the environment as measurement
- float diff = nL[i][j] - blurmap[i][j];
-
- const float upperBound = 2000.f; // WARNING: Duplicated value, it's baaaaaad !
- float delta = sharpenParam.threshold.multiply(
- min(ABS(diff), upperBound), // X axis value = absolute value of the difference
- sharpFac * diff // Y axis max value = sharpening.amount * signed difference
- );
- float newL = labL + delta;
-
- // applying halo control
- if (newL > max_) {
- newL = max_ + (newL - max_) * scale;
- } else if (newL < min_) {
- newL = min_ - (min_ - newL) * scale;
- }
-
- luminance[i][j] = newL;
- }
- }
-}
-
// To the extent possible under law, Manuel Llorens
// has waived all copyright and related or neighboring rights to this work.
// This work is published from: Spain.
@@ -906,6 +902,10 @@ void ImProcFunctions::sharpeningcam (CieImage* ncie, float** b2)
}
}
+ // calculate contrast based blend factors to reduce sharpening in regions with low contrast
+ JaggedArray blend(W, H);
+ buildBlendMask(ncie->sh_p, blend, W, H, params->sharpening.contrast / 100.f);
+
#ifdef _OPENMP
#pragma omp parallel
#endif
@@ -932,15 +932,15 @@ void ImProcFunctions::sharpeningcam (CieImage* ncie, float** b2)
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++) {
- const float upperBound = 2000.f; // WARNING: Duplicated value, it's baaaaaad !
+ constexpr float upperBound = 2000.f; // WARNING: Duplicated value, it's baaaaaad !
float diff = base[i][j] - b2[i][j];
float delta = params->sharpening.threshold.multiply(
- min(ABS(diff), upperBound), // X axis value = absolute value of the difference, truncated to the max value of this field
+ min(fabsf(diff), upperBound), // X axis value = absolute value of the difference, truncated to the max value of this field
params->sharpening.amount * diff * 0.01f // Y axis max value
);
if(ncie->J_p[i][j] > 8.0f && ncie->J_p[i][j] < 92.0f) {
- ncie->sh_p[i][j] = ncie->sh_p[i][j] + delta;
+ ncie->sh_p[i][j] = intp(blend[i][j], ncie->sh_p[i][j] + delta, ncie->sh_p[i][j]);
}
}
} else {
@@ -966,7 +966,7 @@ void ImProcFunctions::sharpeningcam (CieImage* ncie, float** b2)
base = ncieCopy;
}
- sharpenHaloCtrl (ncie->sh_p, b2, base, W, H, params->sharpening);
+ sharpenHaloCtrl (ncie->sh_p, b2, base, blend, W, H, params->sharpening);
if(ncieCopy) {
for( int i = 0; i < H; i++ ) {
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index c14dcf886..ff783369b 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -2600,6 +2600,7 @@ void ProcParams::setDefaults ()
sharpening = SharpeningParams();
prsharpening = SharpeningParams();
+ prsharpening.contrast = 0.0;
prsharpening.method = "rld";
prsharpening.deconvamount = 100;
prsharpening.deconvradius = 0.45;
@@ -3095,6 +3096,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
// Post resize sharpening
saveToKeyfile(!pedited || pedited->prsharpening.enabled, "PostResizeSharpening", "Enabled", prsharpening.enabled, keyFile);
+ saveToKeyfile(!pedited || pedited->prsharpening.contrast, "PostResizeSharpening", "Contrast", prsharpening.contrast, keyFile);
saveToKeyfile(!pedited || pedited->prsharpening.method, "PostResizeSharpening", "Method", prsharpening.method, keyFile);
saveToKeyfile(!pedited || pedited->prsharpening.radius, "PostResizeSharpening", "Radius", prsharpening.radius, keyFile);
saveToKeyfile(!pedited || pedited->prsharpening.amount, "PostResizeSharpening", "Amount", prsharpening.amount, keyFile);
@@ -4081,6 +4083,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
if (keyFile.has_group ("PostResizeSharpening")) {
assignFromKeyfile(keyFile, "PostResizeSharpening", "Enabled", pedited, prsharpening.enabled, pedited->prsharpening.enabled);
+ assignFromKeyfile(keyFile, "PostResizeSharpening", "Contrast", pedited, prsharpening.contrast, pedited->prsharpening.contrast);
assignFromKeyfile(keyFile, "PostResizeSharpening", "Radius", pedited, prsharpening.radius, pedited->prsharpening.radius);
assignFromKeyfile(keyFile, "PostResizeSharpening", "Amount", pedited, prsharpening.amount, pedited->prsharpening.amount);
diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc
index ede983324..856f3a112 100644
--- a/rtgui/batchtoolpanelcoord.cc
+++ b/rtgui/batchtoolpanelcoord.cc
@@ -147,7 +147,7 @@ void BatchToolPanelCoordinator::initSession ()
pcvignette->setAdjusterBehavior (false, false, false);
cacorrection->setAdjusterBehavior (false);
sharpening->setAdjusterBehavior (false, false, false, false, false, false, false);
- prsharpening->setAdjusterBehavior (false, false, false, false, false, false);
+ prsharpening->setAdjusterBehavior (false, false, false, false, false, false, false);
sharpenEdge->setAdjusterBehavior (false, false);
sharpenMicro->setAdjusterBehavior (false, false, false);
icm->setAdjusterBehavior (false, false);
@@ -190,7 +190,7 @@ void BatchToolPanelCoordinator::initSession ()
pcvignette->setAdjusterBehavior (options.baBehav[ADDSET_PCVIGNETTE_STRENGTH], options.baBehav[ADDSET_PCVIGNETTE_FEATHER], options.baBehav[ADDSET_PCVIGNETTE_ROUNDNESS]);
cacorrection->setAdjusterBehavior (options.baBehav[ADDSET_CA]);
sharpening->setAdjusterBehavior (options.baBehav[ADDSET_SHARP_CONTRAST], options.baBehav[ADDSET_SHARP_RADIUS], options.baBehav[ADDSET_SHARP_AMOUNT], options.baBehav[ADDSET_SHARP_DAMPING], options.baBehav[ADDSET_SHARP_ITER], options.baBehav[ADDSET_SHARP_EDGETOL], options.baBehav[ADDSET_SHARP_HALOCTRL]);
- prsharpening->setAdjusterBehavior (options.baBehav[ADDSET_SHARP_RADIUS], options.baBehav[ADDSET_SHARP_AMOUNT], options.baBehav[ADDSET_SHARP_DAMPING], options.baBehav[ADDSET_SHARP_ITER], options.baBehav[ADDSET_SHARP_EDGETOL], options.baBehav[ADDSET_SHARP_HALOCTRL]);
+ prsharpening->setAdjusterBehavior (options.baBehav[ADDSET_SHARP_CONTRAST], options.baBehav[ADDSET_SHARP_RADIUS], options.baBehav[ADDSET_SHARP_AMOUNT], options.baBehav[ADDSET_SHARP_DAMPING], options.baBehav[ADDSET_SHARP_ITER], options.baBehav[ADDSET_SHARP_EDGETOL], options.baBehav[ADDSET_SHARP_HALOCTRL]);
epd->setAdjusterBehavior (options.baBehav[ADDSET_EPD_STRENGTH], options.baBehav[ADDSET_EPD_GAMMA], options.baBehav[ADDSET_EPD_EDGESTOPPING], options.baBehav[ADDSET_EPD_SCALE], options.baBehav[ADDSET_EPD_REWEIGHTINGITERATES]);
fattal->setAdjusterBehavior (options.baBehav[ADDSET_FATTAL_AMOUNT], options.baBehav[ADDSET_FATTAL_THRESHOLD], options.baBehav[ADDSET_FATTAL_ANCHOR]);
localContrast->setAdjusterBehavior(options.baBehav[ADDSET_LOCALCONTRAST_RADIUS], options.baBehav[ADDSET_LOCALCONTRAST_AMOUNT], options.baBehav[ADDSET_LOCALCONTRAST_DARKNESS], options.baBehav[ADDSET_LOCALCONTRAST_LIGHTNESS]);
diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc
index db2deada7..79cc6fd4c 100644
--- a/rtgui/preferences.cc
+++ b/rtgui/preferences.cc
@@ -225,6 +225,7 @@ Gtk::Widget* Preferences::getBatchProcPanel ()
mi = behModel->append (); // Used for both Resize and Post-Resize sharpening
mi->set_value (behavColumns.label, M ("TP_SHARPENING_LABEL"));
+ appendBehavList (mi, M ("TP_SHARPENING_CONTRAST"), ADDSET_SHARP_CONTRAST, false);
appendBehavList (mi, M ("TP_SHARPENING_RADIUS"), ADDSET_SHARP_RADIUS, false);
appendBehavList (mi, M ("TP_SHARPENING_AMOUNT"), ADDSET_SHARP_AMOUNT, false);
appendBehavList (mi, M ("TP_SHARPENING_RLD_DAMPING"), ADDSET_SHARP_DAMPING, false);
diff --git a/rtgui/prsharpening.cc b/rtgui/prsharpening.cc
index 94034b471..bafc8446d 100644
--- a/rtgui/prsharpening.cc
+++ b/rtgui/prsharpening.cc
@@ -16,8 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see .
*/
-#include "prsharpening.h"
#include
+#include "eventmapper.h"
+#include "prsharpening.h"
using namespace rtengine;
using namespace rtengine::procparams;
@@ -25,6 +26,9 @@ using namespace rtengine::procparams;
PrSharpening::PrSharpening () : FoldableToolPanel(this, "prsharpening", M("TP_PRSHARPENING_LABEL"), false, true)
{
+ auto m = ProcEventMapper::getInstance();
+ EvPrShrContrast = m->newEvent(RESIZE, "HISTORY_MSG_PRSHARPEN_CONTRAST");
+
std::vector milestones;
milestones.push_back( GradientMilestone(0.0, 0.0, 0.0, 0.0) );
milestones.push_back( GradientMilestone(1.0, 1.0, 1.0, 1.0) );
@@ -33,6 +37,11 @@ PrSharpening::PrSharpening () : FoldableToolPanel(this, "prsharpening", M("TP_PR
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
hb->show ();
+ contrast = Gtk::manage(new Adjuster (M("TP_SHARPENING_CONTRAST"), 0, 100, 1, 0));
+ contrast->setAdjusterListener (this);
+ pack_start(*contrast);
+ contrast->show();
+
Gtk::Label* ml = Gtk::manage (new Gtk::Label (M("TP_SHARPENING_METHOD") + ":"));
ml->show ();
method = Gtk::manage (new MyComboBoxText ());
@@ -150,6 +159,7 @@ void PrSharpening::read (const ProcParams* pp, const ParamsEdited* pedited)
disableListener ();
if (pedited) {
+ contrast->setEditedState (pedited->prsharpening.contrast ? Edited : UnEdited);
amount->setEditedState (pedited->prsharpening.amount ? Edited : UnEdited);
radius->setEditedState (pedited->prsharpening.radius ? Edited : UnEdited);
threshold->setEditedState (pedited->prsharpening.threshold ? Edited : UnEdited);
@@ -178,6 +188,7 @@ void PrSharpening::read (const ProcParams* pp, const ParamsEdited* pedited)
hcConn.block (false);
lastHaloControl = pp->prsharpening.halocontrol;
+ contrast->setValue (pp->prsharpening.contrast);
amount->setValue (pp->prsharpening.amount);
radius->setValue (pp->prsharpening.radius);
threshold->setValue(pp->prsharpening.threshold);
@@ -219,6 +230,7 @@ void PrSharpening::read (const ProcParams* pp, const ParamsEdited* pedited)
void PrSharpening::write (ProcParams* pp, ParamsEdited* pedited)
{
+ pp->prsharpening.contrast = contrast->getValue ();
pp->prsharpening.amount = (int)amount->getValue();
pp->prsharpening.enabled = getEnabled ();
pp->prsharpening.radius = radius->getValue ();
@@ -240,6 +252,7 @@ void PrSharpening::write (ProcParams* pp, ParamsEdited* pedited)
}
if (pedited) {
+ pedited->prsharpening.contrast = contrast->getEditedState ();
pedited->prsharpening.amount = amount->getEditedState ();
pedited->prsharpening.radius = radius->getEditedState ();
pedited->prsharpening.threshold = threshold->getEditedState ();
@@ -260,6 +273,7 @@ void PrSharpening::write (ProcParams* pp, ParamsEdited* pedited)
void PrSharpening::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited)
{
+ contrast->setDefault (defParams->prsharpening.contrast);
amount->setDefault (defParams->prsharpening.amount);
radius->setDefault (defParams->prsharpening.radius);
threshold->setDefault (defParams->prsharpening.threshold);
@@ -272,6 +286,7 @@ void PrSharpening::setDefaults (const ProcParams* defParams, const ParamsEdited*
ddamping->setDefault (defParams->prsharpening.deconvdamping);
if (pedited) {
+ contrast->setDefaultEditedState (pedited->prsharpening.contrast ? Edited : UnEdited);
amount->setDefaultEditedState (pedited->prsharpening.amount ? Edited : UnEdited);
radius->setDefaultEditedState (pedited->prsharpening.radius ? Edited : UnEdited);
threshold->setDefaultEditedState (pedited->prsharpening.threshold ? Edited : UnEdited);
@@ -283,6 +298,7 @@ void PrSharpening::setDefaults (const ProcParams* defParams, const ParamsEdited*
diter->setDefaultEditedState (pedited->prsharpening.deconviter ? Edited : UnEdited);
ddamping->setDefaultEditedState (pedited->prsharpening.deconvdamping ? Edited : UnEdited);
} else {
+ contrast->setDefaultEditedState (Irrelevant);
amount->setDefaultEditedState (Irrelevant);
radius->setDefaultEditedState (Irrelevant);
threshold->setDefaultEditedState (Irrelevant);
@@ -311,7 +327,9 @@ void PrSharpening::adjusterChanged (Adjuster* a, double newval)
costr = Glib::ustring::format ((int)a->getValue());
}
- if (a == amount) {
+ if (a == contrast) {
+ listener->panelChanged (EvPrShrContrast, costr);
+ } else if (a == amount) {
listener->panelChanged (EvPrShrAmount, costr);
} else if (a == radius) {
listener->panelChanged (EvPrShrRadius, costr);
@@ -457,6 +475,7 @@ void PrSharpening::setBatchMode (bool batchMode)
edgebin->pack_start (*edgebox);
pack_start (*rld);
+ contrast->showEditedCB ();
radius->showEditedCB ();
amount->showEditedCB ();
threshold->showEditedCB ();
@@ -470,9 +489,10 @@ void PrSharpening::setBatchMode (bool batchMode)
method->append (M("GENERAL_UNCHANGED"));
}
-void PrSharpening::setAdjusterBehavior (bool radiusadd, bool amountadd, bool dampingadd, bool iteradd, bool edgetoladd, bool haloctrladd)
+void PrSharpening::setAdjusterBehavior (bool contrastadd, bool radiusadd, bool amountadd, bool dampingadd, bool iteradd, bool edgetoladd, bool haloctrladd)
{
+ contrast->setAddMode(contrastadd);
radius->setAddMode(radiusadd);
dradius->setAddMode(radiusadd);
amount->setAddMode(amountadd);
@@ -487,6 +507,7 @@ void PrSharpening::setAdjusterBehavior (bool radiusadd, bool amountadd, bool dam
void PrSharpening::trimValues (rtengine::procparams::ProcParams* pp)
{
+ contrast->trimValue(pp->prsharpening.contrast);
radius->trimValue(pp->prsharpening.radius);
dradius->trimValue(pp->prsharpening.deconvradius);
amount->trimValue(pp->prsharpening.amount);
diff --git a/rtgui/prsharpening.h b/rtgui/prsharpening.h
index 50dc91258..bac0b9240 100644
--- a/rtgui/prsharpening.h
+++ b/rtgui/prsharpening.h
@@ -28,6 +28,7 @@ class PrSharpening : public ToolParamBlock, public ThresholdAdjusterListener, pu
{
protected:
+ Adjuster* contrast;
MyComboBoxText* method;
Adjuster* dradius;
Adjuster* damount;
@@ -52,7 +53,7 @@ protected:
Gtk::CheckButton* halocontrol;
bool lastHaloControl;
sigc::connection hcConn;
-
+ rtengine::ProcEvent EvPrShrContrast;
public:
PrSharpening ();
@@ -70,7 +71,7 @@ public:
void method_changed ();
void adjusterChanged (ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR);
- void setAdjusterBehavior (bool radiusadd, bool amountadd, bool dampingadd, bool iteradd, bool edgetoladd, bool haloctrladd);
+ void setAdjusterBehavior (bool contrastadd, bool radiusadd, bool amountadd, bool dampingadd, bool iteradd, bool edgetoladd, bool haloctrladd);
void trimValues (rtengine::procparams::ProcParams* pp);
};
diff --git a/rtgui/sharpening.cc b/rtgui/sharpening.cc
index 005d2dd8f..dac7bb5bb 100644
--- a/rtgui/sharpening.cc
+++ b/rtgui/sharpening.cc
@@ -26,11 +26,11 @@ using namespace rtengine::procparams;
Sharpening::Sharpening () : FoldableToolPanel(this, "sharpening", M("TP_SHARPENING_LABEL"), true, true)
{
auto m = ProcEventMapper::getInstance();
- EvSharpenContrast = m->newEvent(SHARPENING, "HISTORY_MSG_MICROCONTRAST_CONTRAST");
+ EvSharpenContrast = m->newEvent(SHARPENING, "HISTORY_MSG_SHARPENING_CONTRAST");
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
hb->show ();
- contrast = Gtk::manage(new Adjuster (M("TP_SHARPENMICRO_CONTRAST"), 0, 100, 1, 0));
+ contrast = Gtk::manage(new Adjuster (M("TP_SHARPENING_CONTRAST"), 0, 100, 1, 0));
contrast->setAdjusterListener (this);
pack_start(*contrast);
if (contrast->delay < options.adjusterMaxDelay) {