From d11eb995de5f7ed05e0944abb02f7a3b9e16c056 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 11 Mar 2019 13:23:10 +0100 Subject: [PATCH] Add blur shape detection to Shadows Highlight --- rtdata/languages/default | 1 + rtengine/iplocallab.cc | 8 ++++++++ rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 ++++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 4 ++-- rtgui/locallab.cc | 18 ++++++++++++++++++ rtgui/locallab.h | 1 + rtgui/paramsedited.cc | 7 +++++++ rtgui/paramsedited.h | 1 + 10 files changed, 44 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 15d751080..38e70aab1 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -893,6 +893,7 @@ HISTORY_MSG_639;Local - SH Mask H HISTORY_MSG_640;Local - SH blend HISTORY_MSG_641;Local - Use SH mask HISTORY_MSG_642;Local - radius SH +HISTORY_MSG_643;Local - Blur SH HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index f74a13113..92a805590 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -152,6 +152,7 @@ struct local_params { float struexp; float blurexp; float blurcol; + float blurSH; float ligh; float lowA, lowB, highA, highB; int shamo, shdamp, shiter, senssha, sensv; @@ -486,6 +487,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float structexpo = (float) locallab.spots.at(sp).structexp; float blurexpo = (float) locallab.spots.at(sp).blurexpde; float blurcolor = (float) locallab.spots.at(sp).blurcolde; + float blurSH = (float) locallab.spots.at(sp).blurSHde; int local_transit = locallab.spots.at(sp).transit; double radius = locallab.spots.at(sp).radius; double sharradius = ((double) locallab.spots.at(sp).sharradius); @@ -540,6 +542,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.struexp = structexpo; lp.blurexp = blurexpo; lp.blurcol = blurcolor; + lp.blurSH = blurSH; lp.sens = local_sensi; lp.sensh = local_sensih; lp.dehaze = local_dehaze; @@ -3397,6 +3400,11 @@ void ImProcFunctions::transit_shapedetect(int senstype, LabImage * bufexporig, L radius = (2.f + 0.2f * lp.blurcol) / sk; } + if (senstype == 9) + { + radius = (2.f + 0.2f * lp.blurSH) / sk; + } + bool usemask = (lp.showmaskexpmet == 2 || lp.enaExpMask) && senstype == 1; bool usemaskcol = (lp.showmaskcolmet == 2 || lp.enaColorMask) && senstype == 0; bool usemaskSH = (lp.showmaskSHmet == 2 || lp.enaSHMask) && senstype == 9; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 9538b4ec2..bd30a0095 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -669,6 +669,7 @@ enum ProcEventCode { EvlocallabblendmaskSH = 639, EvLocallabEnaSHMask = 640, EvlocallabradmaskSH = 641, + EvlocallabblurSHde = 642, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 4e300ffde..7fb78c4ba 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2418,6 +2418,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : HHmaskSHcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35}, blendmaskSH(0), radmaskSH(10.0), + blurSHde(5), // Vibrance expvibrance(false), saturated(0), @@ -2583,6 +2584,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && HHmaskSHcurve == other.HHmaskSHcurve && blendmaskSH == other.blendmaskSH && radmaskSH == other.radmaskSH + && blurSHde == other.blurSHde // Vibrance && expvibrance == other.expvibrance && saturated == other.saturated @@ -3705,6 +3707,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskSHcurve, "Locallab", "HHmaskSHCurve_" + std::to_string(i), spot.HHmaskSHcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskSH, "Locallab", "BlendmaskSH_" + std::to_string(i), spot.blendmaskSH, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskSH, "Locallab", "RadmaskSH_" + std::to_string(i), spot.radmaskSH, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurSHde, "Locallab", "BlurSHde_" + std::to_string(i), spot.blurSHde, keyFile); // Vibrance saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expvibrance, "Locallab", "Expvibrance_" + std::to_string(i), spot.expvibrance, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).saturated, "Locallab", "Saturated_" + std::to_string(i), spot.saturated, keyFile); @@ -4955,6 +4958,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "HHmaskSHCurve_" + std::to_string(i), pedited, spot.HHmaskSHcurve, spotEdited.HHmaskSHcurve); assignFromKeyfile(keyFile, "Locallab", "BlendmaskSH_" + std::to_string(i), pedited, spot.blendmaskSH, spotEdited.blendmaskSH); assignFromKeyfile(keyFile, "Locallab", "RadmaskSH_" + std::to_string(i), pedited, spot.radmaskSH, spotEdited.radmaskSH); + assignFromKeyfile(keyFile, "Locallab", "BlurSHde_" + std::to_string(i), pedited, spot.blurSHde, spotEdited.blurSHde); // Vibrance assignFromKeyfile(keyFile, "Locallab", "Expvibrance_" + std::to_string(i), pedited, spot.expvibrance, spotEdited.expvibrance); assignFromKeyfile(keyFile, "Locallab", "Saturated_" + std::to_string(i), pedited, spot.saturated, spotEdited.saturated); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 758b7f6cb..900b46961 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1019,6 +1019,7 @@ struct LocallabParams { std::vector HHmaskSHcurve; int blendmaskSH; double radmaskSH; + int blurSHde; // Vibrance bool expvibrance; int saturated; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index e14cfdfb4..a40061b72 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -668,8 +668,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvlocallabHHmaskSHshape LUMINANCECURVE, //EvlocallabblendmaskSH LUMINANCECURVE, //EvLocallabEnaSHMask - LUMINANCECURVE //EvlocallabradmaskSH - + LUMINANCECURVE, //EvlocallabradmaskSH + LUMINANCECURVE //EvlocallabblurSHde }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 61a7d6d05..50faf7b02 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -108,6 +108,7 @@ Locallab::Locallab(): sensihs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))), blendmaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), radmaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 10.))), + blurSHde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), // Vibrance saturated(Gtk::manage(new Adjuster(M("TP_VIBRANCE_SATURATED"), -100., 100., 1., 0.))), pastels(Gtk::manage(new Adjuster(M("TP_VIBRANCE_PASTELS"), -100., 100., 1., 0.))), @@ -527,6 +528,7 @@ Locallab::Locallab(): sensihs->setAdjusterListener(this); blendmaskSH->setAdjusterListener(this); radmaskSH->setAdjusterListener(this); + blurSHde->setAdjusterListener(this); enaSHMaskConn = enaSHMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaSHMaskChanged)); @@ -570,6 +572,7 @@ Locallab::Locallab(): shadhighBox->pack_start(*s_tonalwidth); shadhighBox->pack_start(*sh_radius); shadhighBox->pack_start(*sensihs); + shadhighBox->pack_start(*blurSHde); maskSHFrame->set_label_align(0.025, 0.5); ToolParamBlock* const maskSHBox = Gtk::manage(new ToolParamBlock()); @@ -1705,6 +1708,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve = HHmaskSHshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).blendmaskSH = blendmaskSH->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).radmaskSH = radmaskSH->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).blurSHde = blurSHde->getIntValue(); // Vibrance pp->locallab.spots.at(pp->locallab.selspot).expvibrance = expvibrance->getEnabled(); @@ -1887,6 +1891,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve || !HHmaskSHshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).blendmaskSH = pe->locallab.spots.at(pp->locallab.selspot).blendmaskSH || blendmaskSH->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).radmaskSH = pe->locallab.spots.at(pp->locallab.selspot).radmaskSH || radmaskSH->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).blurSHde = pe->locallab.spots.at(pp->locallab.selspot).blurSHde || blurSHde->getEditedState(); // Vibrance pe->locallab.spots.at(pp->locallab.selspot).expvibrance = pe->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).saturated = pe->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); @@ -2054,6 +2059,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve || !HHmaskSHshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).blendmaskSH = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskSH || blendmaskSH->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).radmaskSH = pedited->locallab.spots.at(pp->locallab.selspot).radmaskSH || radmaskSH->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).blurSHde = pedited->locallab.spots.at(pp->locallab.selspot).blurSHde || blurSHde->getEditedState(); // Vibrance pedited->locallab.spots.at(pp->locallab.selspot).expvibrance = pedited->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).saturated = pedited->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); @@ -2883,6 +2889,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensihs->setDefault((double)defSpot->sensihs); blendmaskSH->setDefault((double)defSpot->blendmaskSH); radmaskSH->setDefault(defSpot->radmaskSH); + blurSHde->setDefault((double)defSpot->blurSHde); // Vibrance saturated->setDefault((double)defSpot->saturated); pastels->setDefault((double)defSpot->pastels); @@ -2979,6 +2986,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensihs->setDefaultEditedState(Irrelevant); blendmaskSH->setDefaultEditedState(Irrelevant); radmaskSH->setDefaultEditedState(Irrelevant); + blurSHde->setDefaultEditedState(Irrelevant); // Vibrance saturated->setDefaultEditedState(Irrelevant); pastels->setDefaultEditedState(Irrelevant); @@ -3079,6 +3087,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensihs->setDefaultEditedState(defSpotState->sensihs ? Edited : UnEdited); blendmaskSH->setDefaultEditedState(defSpotState->blendmaskSH ? Edited : UnEdited); radmaskSH->setDefaultEditedState(defSpotState->radmaskSH ? Edited : UnEdited); + blurSHde->setDefaultEditedState(defSpotState->blurSHde ? Edited : UnEdited); // Vibrance saturated->setDefaultEditedState(defSpotState->saturated ? Edited : UnEdited); pastels->setDefaultEditedState(defSpotState->pastels ? Edited : UnEdited); @@ -3374,6 +3383,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == blurSHde) { + if (listener) { + listener->panelChanged(EvlocallabblurSHde, blurSHde->getTextValue()); + } + } + } @@ -3776,6 +3791,7 @@ void Locallab::setBatchMode(bool batchMode) sensihs->showEditedCB(); blendmaskSH->showEditedCB(); radmaskSH->showEditedCB(); + blurSHde->showEditedCB(); // Vibrance saturated->showEditedCB(); pastels->showEditedCB(); @@ -4156,6 +4172,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con HHmaskSHshape->setCurve(pp->locallab.spots.at(index).HHmaskSHcurve); blendmaskSH->setValue(pp->locallab.spots.at(index).blendmaskSH); radmaskSH->setValue(pp->locallab.spots.at(index).radmaskSH); + blurSHde->setValue(pp->locallab.spots.at(index).blurSHde); // Vibrance expvibrance->setEnabled(pp->locallab.spots.at(index).expvibrance); saturated->setValue(pp->locallab.spots.at(index).saturated); @@ -4366,6 +4383,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con HHmaskSHshape->setUnChanged(!spotState->HHmaskSHcurve); blendmaskSH->setEditedState(spotState->blendmaskSH ? Edited : UnEdited); radmaskSH->setEditedState(spotState->radmaskSH ? Edited : UnEdited); + blurSHde->setEditedState(spotState->blurSHde ? Edited : UnEdited); // Vibrance expvibrance->set_inconsistent(!spotState->expvibrance); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index f6a9a3796..794d18ef3 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -126,6 +126,7 @@ private: Adjuster* const sensihs; Adjuster* const blendmaskSH; Adjuster* const radmaskSH; + Adjuster* const blurSHde; // Vibrance Adjuster* const saturated; Adjuster* const pastels; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 632b172df..99b3119eb 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1003,6 +1003,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).HHmaskSHcurve = locallab.spots.at(j).HHmaskSHcurve && pSpot.HHmaskSHcurve == otherSpot.HHmaskSHcurve; locallab.spots.at(j).blendmaskSH = locallab.spots.at(j).blendmaskSH && pSpot.blendmaskSH == otherSpot.blendmaskSH; locallab.spots.at(j).radmaskSH = locallab.spots.at(j).radmaskSH && pSpot.radmaskSH == otherSpot.radmaskSH; + locallab.spots.at(j).blurSHde = locallab.spots.at(j).blurSHde && pSpot.blurSHde == otherSpot.blurSHde; // Vibrance locallab.spots.at(j).expvibrance = locallab.spots.at(j).expvibrance && pSpot.expvibrance == otherSpot.expvibrance; locallab.spots.at(j).saturated = locallab.spots.at(j).saturated && pSpot.saturated == otherSpot.saturated; @@ -2817,6 +2818,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).radmaskSH = mods.locallab.spots.at(i).radmaskSH; } + if (locallab.spots.at(i).blurSHde) { + toEdit.locallab.spots.at(i).blurSHde = mods.locallab.spots.at(i).blurSHde; + } + // Vibrance if (locallab.spots.at(i).expvibrance) { toEdit.locallab.spots.at(i).expvibrance = mods.locallab.spots.at(i).expvibrance; @@ -4118,6 +4123,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : HHmaskSHcurve(v), blendmaskSH(v), radmaskSH(v), + blurSHde(v), // Vibrance expvibrance(v), saturated(v), @@ -4280,6 +4286,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) HHmaskSHcurve = v; blendmaskSH = v; radmaskSH = v; + blurSHde = v; // Vibrance expvibrance = v; saturated = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 73c826855..ac2387087 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -542,6 +542,7 @@ public: bool HHmaskSHcurve; bool blendmaskSH; bool radmaskSH; + bool blurSHde; // Vibrance bool expvibrance; bool saturated;