diff --git a/rtengine/curves.cc b/rtengine/curves.cc index c9b549896..aa54a307f 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1563,6 +1563,146 @@ void LocretigainCurverab::Set(const std::vector &curvePoints) } } +LocHHmaskcbCurve::LocHHmaskcbCurve() : sum(0.f) {}; + +void LocHHmaskcbCurve::Reset() +{ + lutLocHHmaskcbCurve.reset(); + sum = 0.f; +} + + +void LocHHmaskcbCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocHHmaskcbCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocHHmaskcbCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocHHmaskcbCurve[i] < 0.02f) { + lutLocHHmaskcbCurve[i] = 0.02f; + } + + sum += lutLocHHmaskcbCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + +void LocHHmaskcbCurve::Set(const std::vector &curvePoints, bool & lhmascbutili) +{ + // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + ttcurve.setIdentityValue(0.); + lhmascbutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + +LocLLmaskcbCurve::LocLLmaskcbCurve() : sum(0.f) {}; + +void LocLLmaskcbCurve::Reset() +{ + lutLocLLmaskcbCurve.reset(); + sum = 0.f; +} + +void LocLLmaskcbCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocLLmaskcbCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocLLmaskcbCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocLLmaskcbCurve[i] < 0.02f) { + lutLocLLmaskcbCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocLLmaskcbCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocLLmaskcbCurve::Set(const std::vector &curvePoints, bool & llmascbutili) +{ + // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + ttcurve.setIdentityValue(0.); + llmascbutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + +LocCCmaskcbCurve::LocCCmaskcbCurve() : sum(0.f) {}; + +void LocCCmaskcbCurve::Reset() +{ + lutLocCCmaskcbCurve.reset(); + sum = 0.f; +} + +void LocCCmaskcbCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocCCmaskcbCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocCCmaskcbCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocCCmaskcbCurve[i] < 0.02f) { + lutLocCCmaskcbCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocCCmaskcbCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocCCmaskcbCurve::Set(const std::vector &curvePoints, bool & lcmascbutili) +{ + // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + ttcurve.setIdentityValue(0.); + lcmascbutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + + + + LocHHmaskSHCurve::LocHHmaskSHCurve() : sum(0.f) {}; void LocHHmaskSHCurve::Reset() diff --git a/rtengine/curves.h b/rtengine/curves.h index a1f2321d1..fda8adcd6 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -647,6 +647,94 @@ public: } }; +class LocHHmaskcbCurve +{ +private: + LUTf lutLocHHmaskcbCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocHHmaskcbCurve() {}; + LocHHmaskcbCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & lhmascbutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocHHmaskcbCurve[index]; + } + operator bool (void) const + { + return lutLocHHmaskcbCurve; + } +}; + + +class LocCCmaskcbCurve +{ +private: + LUTf lutLocCCmaskcbCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocCCmaskcbCurve() {}; + LocCCmaskcbCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & lcmascbutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocCCmaskcbCurve[index]; + } + operator bool (void) const + { + return lutLocCCmaskcbCurve; + } +}; + +class LocLLmaskcbCurve +{ +private: + LUTf lutLocLLmaskcbCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocLLmaskcbCurve() {}; + LocLLmaskcbCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & llmascbutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocLLmaskcbCurve[index]; + } + operator bool (void) const + { + return lutLocLLmaskcbCurve; + } +}; + + + + class LocHHmaskexpCurve { private: diff --git a/rtengine/procevents.h b/rtengine/procevents.h index f1bc421fe..8c470e1d7 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -696,6 +696,11 @@ enum ProcEventCode { Evlocallabchromaskcb = 666, Evlocallabgammaskcb = 667, Evlocallabslomaskcb = 668, + EvlocallabCCmaskcbshape = 669, + EvlocallabLLmaskcbshape = 670, + EvlocallabHHmaskcbshape = 671, + EvLocallabEnacbMask = 672, + EvlocallabshowmaskcbMethod = 673, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3feb52a5e..8c411ce05 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2501,6 +2501,10 @@ LocallabParams::LocallabSpot::LocallabSpot() : contresid(0), blurcbdl(0), softradiuscb(0.0), + enacbMask(false), + CCmaskcbcurve{(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 }, + LLmaskcbcurve{(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}, + HHmaskcbcurve{(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}, blendmaskcb(0), radmaskcb(10.0), chromaskcb(0.0), @@ -2701,6 +2705,10 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && contresid == other.contresid && blurcbdl == other.blurcbdl && softradiuscb == other.softradiuscb + && enacbMask == other.enacbMask + && CCmaskcbcurve == other.CCmaskcbcurve + && LLmaskcbcurve == other.LLmaskcbcurve + && HHmaskcbcurve == other.HHmaskcbcurve && blendmaskcb == other.blendmaskcb && radmaskcb == other.radmaskcb && chromaskcb == other.chromaskcb @@ -3843,6 +3851,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).contresid, "Locallab", "Contresid_" + std::to_string(i), spot.contresid, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurcbdl, "Locallab", "Blurcbdl_" + std::to_string(i), spot.blurcbdl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiuscb, "Locallab", "Softradiuscb_" + std::to_string(i), spot.softradiuscb, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enacbMask, "Locallab", "EnacbMask_" + std::to_string(i), spot.enacbMask, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskcbcurve, "Locallab", "CCmaskcbCurve_" + std::to_string(i), spot.CCmaskcbcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskcbcurve, "Locallab", "LLmaskcbCurve_" + std::to_string(i), spot.LLmaskcbcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskcbcurve, "Locallab", "HHmaskcbCurve_" + std::to_string(i), spot.HHmaskcbcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskcb, "Locallab", "Blendmaskcb_" + std::to_string(i), spot.blendmaskcb, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskcb, "Locallab", "Radmaskcb_" + std::to_string(i), spot.radmaskcb, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chromaskcb, "Locallab", "Chromaskcb_" + std::to_string(i), spot.chromaskcb, keyFile); @@ -5132,6 +5144,10 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Blurcbdl_" + std::to_string(i), pedited, spot.blurcbdl, spotEdited.blurcbdl); assignFromKeyfile(keyFile, "Locallab", "Softradiuscb_" + std::to_string(i), pedited, spot.softradiuscb, spotEdited.softradiuscb); assignFromKeyfile(keyFile, "Locallab", "Blendmaskcb_" + std::to_string(i), pedited, spot.blendmaskcb, spotEdited.blendmaskcb); + assignFromKeyfile(keyFile, "Locallab", "EnacbMask_" + std::to_string(i), pedited, spot.enacbMask, spotEdited.enacbMask); + assignFromKeyfile(keyFile, "Locallab", "CCmaskcbCurve_" + std::to_string(i), pedited, spot.CCmaskcbcurve, spotEdited.CCmaskcbcurve); + assignFromKeyfile(keyFile, "Locallab", "LLmaskcbCurve_" + std::to_string(i), pedited, spot.LLmaskcbcurve, spotEdited.LLmaskcbcurve); + assignFromKeyfile(keyFile, "Locallab", "HHmaskcbCurve_" + std::to_string(i), pedited, spot.HHmaskcbcurve, spotEdited.HHmaskcbcurve); assignFromKeyfile(keyFile, "Locallab", "Radmaskcb_" + std::to_string(i), pedited, spot.radmaskcb, spotEdited.radmaskcb); assignFromKeyfile(keyFile, "Locallab", "Chromaskcb_" + std::to_string(i), pedited, spot.chromaskcb, spotEdited.chromaskcb); assignFromKeyfile(keyFile, "Locallab", "Gammaskcb_" + std::to_string(i), pedited, spot.gammaskcb, spotEdited.gammaskcb); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index d1d0b6074..604a1936e 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1102,6 +1102,10 @@ struct LocallabParams { int contresid; int blurcbdl; double softradiuscb; + bool enacbMask; + std::vector CCmaskcbcurve; + std::vector LLmaskcbcurve; + std::vector HHmaskcbcurve; int blendmaskcb; double radmaskcb; double chromaskcb; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 9f09b5382..085272c24 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -695,9 +695,12 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabradmaskcb LUMINANCECURVE, //Evlocallabchromaskcb LUMINANCECURVE, //Evlocallabgammaskcb - LUMINANCECURVE //Evlocallabslomaskcb - - + LUMINANCECURVE, //Evlocallabslomaskcb + LUMINANCECURVE, //EvlocallabCCmaskcbshape + LUMINANCECURVE, //EvlocallabLLmaskcbshape + LUMINANCECURVE, //EvlocallabHHmaskcbshape + LUMINANCECURVE, //EvLocallabEnacbMask + LUMINANCECURVE //EvlocallabshowmaskcbMethod }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 521bd4557..8e075890b 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -73,7 +73,9 @@ Locallab::Locallab(): curveEditorGG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL"))), // Retinex LocalcurveEditorgainT(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONGAIN"))), - + //CBDL + maskcbCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), + // Adjuster widgets // Color & Light lightness(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LIGHTNESS"), -100, 100, 1, 0))), @@ -207,7 +209,9 @@ Locallab::Locallab(): inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), // Sharpening inverssha(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), - + //CBDL + enacbMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), + // ComboBox widgets // Color & Light qualitycurveMethod(Gtk::manage(new MyComboBoxText())), @@ -221,6 +225,8 @@ Locallab::Locallab(): blurMethod(Gtk::manage(new MyComboBoxText())), // Retinex retinexMethod(Gtk::manage(new MyComboBoxText())), + //CBDL + showmaskcbMethod(Gtk::manage(new MyComboBoxText())), // ThresholdAdjuster widgets // Vibrance @@ -234,6 +240,7 @@ Locallab::Locallab(): maskcolFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), maskexpFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), maskSHFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), + maskcbFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), gridFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABGRID")))), residFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RESID")))), @@ -941,6 +948,44 @@ Locallab::Locallab(): gammaskcb->setAdjusterListener(this); slomaskcb->setAdjusterListener(this); + enacbMaskConn = enacbMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enacbMaskChanged)); + + showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMNONE")); + showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMODIF")); + showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); + showmaskcbMethod->append(M("TP_LOCALLAB_SHOWMASK")); + showmaskcbMethod->append(M("TP_LOCALLAB_PREVIEWSEL")); + + + showmaskcbMethod->set_active(0); + if(showtooltip) showmaskcbMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); + showmaskcbMethodConn = showmaskcbMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskcbMethodChanged)); + + maskcbCurveEditorG->setCurveListener(this); + + CCmaskcbshape = static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false)); + CCmaskcbshape->setIdentityValue(0.); + CCmaskcbshape->setResetCurve(FlatCurveType(defSpot.CCmaskcbcurve.at(0)), defSpot.CCmaskcbcurve); + if(showtooltip) CCmaskcbshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + CCmaskcbshape->setBottomBarColorProvider(this, 7); + + LLmaskcbshape = static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false)); + LLmaskcbshape->setIdentityValue(0.); + LLmaskcbshape->setResetCurve(FlatCurveType(defSpot.LLmaskcbcurve.at(0)), defSpot.LLmaskcbcurve); + if(showtooltip) LLmaskcbshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + LLmaskcbshape->setBottomBarBgGradient(mllshape); + + HHmaskcbshape = static_cast(maskcbCurveEditorG->addCurve(CT_Flat, "LC(H)", nullptr, false, true)); + HHmaskcbshape->setIdentityValue(0.); + HHmaskcbshape->setResetCurve(FlatCurveType(defSpot.HHmaskcbcurve.at(0)), defSpot.HHmaskcbcurve); + if(showtooltip) HHmaskcbshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + HHmaskcbshape->setCurveColorProvider(this, 6); + HHmaskcbshape->setBottomBarColorProvider(this, 6); + + maskcbCurveEditorG->curveListComplete(); + + + ToolParamBlock* const cbdlBox = Gtk::manage(new ToolParamBlock()); Gtk::HBox* buttonBox = Gtk::manage(new Gtk::HBox(true, 10)); buttonBox->pack_start(*lumacontrastMinusButton); @@ -955,6 +1000,18 @@ Locallab::Locallab(): cbdlBox->pack_start(*multiplier[i]); } + maskcbFrame->set_label_align(0.025, 0.5); + ToolParamBlock* const maskcbBox = Gtk::manage(new ToolParamBlock()); + maskcbBox->pack_start(*showmaskcbMethod, Gtk::PACK_SHRINK, 4); + maskcbBox->pack_start(*enacbMask, Gtk::PACK_SHRINK, 0); + maskcbBox->pack_start(*maskcbCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskcbBox->pack_start(*blendmaskcb, Gtk::PACK_SHRINK, 0); + maskcbBox->pack_start(*radmaskcb, Gtk::PACK_SHRINK, 0); + maskcbBox->pack_start(*chromaskcb, Gtk::PACK_SHRINK, 0); + maskcbBox->pack_start(*gammaskcb, Gtk::PACK_SHRINK, 0); + maskcbBox->pack_start(*slomaskcb, Gtk::PACK_SHRINK, 0); + maskcbFrame->add(*maskcbBox); + Gtk::HSeparator *separator = Gtk::manage(new Gtk::HSeparator()); cbdlBox->pack_start(*separator, Gtk::PACK_SHRINK, 2); cbdlBox->pack_start(*chromacbdl); @@ -968,11 +1025,7 @@ Locallab::Locallab(): cbdlBox->pack_start(*residFrame); cbdlBox->pack_start(*softradiuscb); cbdlBox->pack_start(*sensicb); - //cbdlBox->pack_start(*blendmaskcb); - //cbdlBox->pack_start(*radmaskcb); - //cbdlBox->pack_start(*chromaskcb); - //cbdlBox->pack_start(*gammaskcb); - //cbdlBox->pack_start(*slomaskcb); +// cbdlBox->pack_start(*maskcbFrame); expcbdl->add(*cbdlBox); expcbdl->setLevel(2); @@ -1200,6 +1253,11 @@ void Locallab::refChanged(double huer, double lumar, double chromar) LLmaskSHshape->updateLocallabBackground(normLumar); HHmaskSHshape->updateLocallabBackground(normHuer); + // Update CBDL mask background + CCmaskcbshape->updateLocallabBackground(normChromar); + LLmaskcbshape->updateLocallabBackground(normLumar); + HHmaskcbshape->updateLocallabBackground(normHuer); + return false; } ); @@ -1889,6 +1947,11 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).contresid = contresid->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).blurcbdl = blurcbdl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).softradiuscb = softradiuscb->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).enacbMask = enacbMask->get_active(); + + pp->locallab.spots.at(pp->locallab.selspot).LLmaskcbcurve = LLmaskcbshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).CCmaskcbcurve = CCmaskcbshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).HHmaskcbcurve = HHmaskcbshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).blendmaskcb = blendmaskcb->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).radmaskcb = radmaskcb->getValue(); @@ -2081,6 +2144,11 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).contresid = pe->locallab.spots.at(pp->locallab.selspot).contresid || contresid->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).blurcbdl = pe->locallab.spots.at(pp->locallab.selspot).blurcbdl || blurcbdl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).softradiuscb = pe->locallab.spots.at(pp->locallab.selspot).softradiuscb || softradiuscb->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).enacbMask = pe->locallab.spots.at(pp->locallab.selspot).enacbMask || !enacbMask->get_inconsistent(); + + pe->locallab.spots.at(pp->locallab.selspot).CCmaskcbcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskcbcurve || !CCmaskcbshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).LLmaskcbcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskcbcurve || !LLmaskcbshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).HHmaskcbcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskcbcurve || !HHmaskcbshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).blendmaskcb = pe->locallab.spots.at(pp->locallab.selspot).blendmaskcb || blendmaskcb->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).radmaskcb = pe->locallab.spots.at(pp->locallab.selspot).radmaskcb || radmaskcb->getEditedState(); @@ -2276,6 +2344,11 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).blurcbdl = pedited->locallab.spots.at(pp->locallab.selspot).blurcbdl || blurcbdl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).softradiuscb = pedited->locallab.spots.at(pp->locallab.selspot).softradiuscb || softradiuscb->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).enacbMask = pedited->locallab.spots.at(pp->locallab.selspot).enacbMask || !enacbMask->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).CCmaskcbcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskcbcurve || !CCmaskcbshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).LLmaskcbcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskcbcurve || !LLmaskcbshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).HHmaskcbcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskcbcurve || !HHmaskcbshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).blendmaskcb = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskcb || blendmaskcb->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).radmaskcb = pedited->locallab.spots.at(pp->locallab.selspot).radmaskcb || radmaskcb->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).chromaskcb = pedited->locallab.spots.at(pp->locallab.selspot).chromaskcb || chromaskcb->getEditedState(); @@ -2492,6 +2565,28 @@ void Locallab::curveChanged(CurveEditor* ce) } } + //CBDL + if (getEnabled() && expcbdl->getEnabled()) { + + if (ce == CCmaskcbshape) { + if (listener) { + listener->panelChanged(EvlocallabCCmaskcbshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == LLmaskcbshape) { + if (listener) { + listener->panelChanged(EvlocallabLLmaskcbshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == HHmaskcbshape) { + if (listener) { + listener->panelChanged(EvlocallabHHmaskcbshape, M("HISTORY_CUSTOMCURVE")); + } + } + } + // Vibrance if (getEnabled() && expvibrance->getEnabled()) { if (ce == skinTonesCurve) { @@ -2598,6 +2693,20 @@ void Locallab::showmaskSHMethodChanged() } } +void Locallab::showmaskcbMethodChanged() +{ + // printf("showmaskSHMethodChanged\n"); + + // When one mask state is changed, other masks are deactivated + disableListener(); + showmaskcbMethod->set_active(0); + enableListener(); + + if (listener) { + listener->panelChanged(EvlocallabshowmaskcbMethod, ""); + } +} + void Locallab::resetMaskVisibility() { // printf("resetMaskVisibility\n"); @@ -2606,6 +2715,7 @@ void Locallab::resetMaskVisibility() showmaskcolMethod->set_active(0); showmaskexpMethod->set_active(0); showmaskSHMethod->set_active(0); + showmaskcbMethod->set_active(0); enableListener(); } @@ -2615,6 +2725,7 @@ Locallab::llMaskVisibility* Locallab::getMaskVisibility() maskStruct->colorMask = showmaskcolMethod->get_active_row_number(); maskStruct->expMask = showmaskexpMethod->get_active_row_number(); maskStruct->SHMask = showmaskSHMethod->get_active_row_number(); + maskStruct->cbMask = showmaskcbMethod->get_active_row_number(); return maskStruct; } @@ -2690,6 +2801,30 @@ void Locallab::enaSHMaskChanged() } } +void Locallab::enacbMaskChanged() +{ + // printf("enacbMaskChanged\n"); + + if (multiImage) { + if (enacbMask->get_inconsistent()) { + enacbMask->set_inconsistent(false); + enacbMaskConn.block(true); + enacbMask->set_active(false); + enacbMaskConn.block(false); + } + } + + if (getEnabled() && expcbdl->getEnabled()) { + if (listener) { + if (enacbMask->get_active()) { + listener->panelChanged(EvLocallabEnacbMask, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvLocallabEnacbMask, M("GENERAL_DISABLED")); + } + } + } +} + void Locallab::inversChanged() { // printf("inversChanged\n"); @@ -4272,6 +4407,7 @@ void Locallab::setBatchMode(bool batchMode) showmaskcolMethod->hide(); showmaskexpMethod->hide(); showmaskSHMethod->hide(); + showmaskcbMethod->hide(); } std::vector Locallab::getCurvePoints(ThresholdSelector* tAdjuster) const @@ -4449,6 +4585,8 @@ void Locallab::enableListener() enablecontrastConn.block(false); // Contrast by detail levels enablecbdlConn.block(false); + enacbMaskConn.block(false); + showmaskcbMethodConn.block(false); // Denoise enabledenoiConn.block(false); } @@ -4500,6 +4638,8 @@ void Locallab::disableListener() enablecontrastConn.block(true); // Contrast by detail levels enablecbdlConn.block(true); + enacbMaskConn.block(true); + showmaskSHMethodConn.block(true); // Denoise enabledenoiConn.block(true); } @@ -4693,6 +4833,10 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con chromaskcb->setValue(pp->locallab.spots.at(index).chromaskcb); gammaskcb->setValue(pp->locallab.spots.at(index).gammaskcb); slomaskcb->setValue(pp->locallab.spots.at(index).slomaskcb); + enacbMask->set_active(pp->locallab.spots.at(index).enacbMask); + CCmaskcbshape->setCurve(pp->locallab.spots.at(index).CCmaskcbcurve); + LLmaskcbshape->setCurve(pp->locallab.spots.at(index).LLmaskcbcurve); + HHmaskcbshape->setCurve(pp->locallab.spots.at(index).HHmaskcbcurve); // Denoise expdenoi->setEnabled(pp->locallab.spots.at(index).expdenoi); @@ -4920,6 +5064,10 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con chromaskcb->setEditedState(spotState->chromaskcb ? Edited : UnEdited); gammaskcb->setEditedState(spotState->gammaskcb ? Edited : UnEdited); slomaskcb->setEditedState(spotState->slomaskcb ? Edited : UnEdited); + enacbMask->set_inconsistent(multiImage && !spotState->enacbMask); + CCmaskcbshape->setUnChanged(!spotState->CCmaskcbcurve); + LLmaskcbshape->setUnChanged(!spotState->LLmaskcbcurve); + HHmaskcbshape->setUnChanged(!spotState->HHmaskcbcurve); // Denoise expdenoi->set_inconsistent(!spotState->expdenoi); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index a2dc79281..32b2e8fc5 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -92,7 +92,12 @@ private: // Retinex CurveEditorGroup* const LocalcurveEditorgainT; FlatCurveEditor* cTgainshape; - + //Cbdl + CurveEditorGroup* const maskcbCurveEditorG; + FlatCurveEditor* CCmaskcbshape; + FlatCurveEditor* LLmaskcbshape; + FlatCurveEditor* HHmaskcbshape; + // Adjuster widgets // Color & Light Adjuster* const lightness; @@ -237,7 +242,10 @@ private: // Sharpening Gtk::CheckButton* const inverssha; sigc::connection inversshaConn; - + //CBDL + Gtk::CheckButton* const enacbMask; + sigc::connection enacbMaskConn; + // ComboBox widgets // Color & Light MyComboBoxText* const qualitycurveMethod; @@ -258,7 +266,9 @@ private: // Retinex MyComboBoxText* const retinexMethod; sigc::connection retinexMethodConn; - + //CBDL + MyComboBoxText* const showmaskcbMethod; + sigc::connection showmaskcbMethodConn; // ThresholdAdjuster widgets // Vibrance ThresholdAdjuster* const psThreshold; @@ -272,6 +282,7 @@ private: Gtk::Frame* maskcolFrame; Gtk::Frame* maskexpFrame; Gtk::Frame* maskSHFrame; + Gtk::Frame* maskcbFrame; Gtk::Frame* gridFrame; Gtk::Frame* residFrame; LabGrid *labgrid; @@ -317,7 +328,8 @@ private: void inversretChanged(); // Sharpening void inversshaChanged(); - + //CBDL + void enacbMaskChanged(); // ComboBox event functions // Color & Light void qualitycurveMethodChanged(); @@ -331,7 +343,8 @@ private: void blurMethodChanged(); // Retinex void retinexMethodChanged(); - + //CBDL + void showmaskcbMethodChanged(); // Other widgets event functions void lumacontrastMinusPressed(); void lumaneutralPressed(); @@ -366,6 +379,7 @@ public: int colorMask; int expMask; int SHMask; + int cbMask; }; void resetMaskVisibility(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index c3bde6e57..bcdf1bd91 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1100,6 +1100,10 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).gammaskcb = locallab.spots.at(j).gammaskcb && pSpot.gammaskcb == otherSpot.gammaskcb; locallab.spots.at(j).slomaskcb = locallab.spots.at(j).slomaskcb && pSpot.slomaskcb == otherSpot.slomaskcb; locallab.spots.at(j).softradiuscb = locallab.spots.at(j).softradiuscb && pSpot.softradiuscb == otherSpot.softradiuscb; + locallab.spots.at(j).enacbMask = locallab.spots.at(j).enacbMask && pSpot.enacbMask == otherSpot.enacbMask; + locallab.spots.at(j).CCmaskcbcurve = locallab.spots.at(j).CCmaskcbcurve && pSpot.CCmaskcbcurve == otherSpot.CCmaskcbcurve; + locallab.spots.at(j).LLmaskcbcurve = locallab.spots.at(j).LLmaskcbcurve && pSpot.LLmaskcbcurve == otherSpot.LLmaskcbcurve; + locallab.spots.at(j).HHmaskcbcurve = locallab.spots.at(j).HHmaskcbcurve && pSpot.HHmaskcbcurve == otherSpot.HHmaskcbcurve; // Denoise locallab.spots.at(j).expdenoi = locallab.spots.at(j).expdenoi && pSpot.expdenoi == otherSpot.expdenoi; locallab.spots.at(j).noiselumf = locallab.spots.at(j).noiselumf && pSpot.noiselumf == otherSpot.noiselumf; @@ -3177,6 +3181,22 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).slomaskcb = mods.locallab.spots.at(i).slomaskcb; } + if (locallab.spots.at(i).enacbMask) { + toEdit.locallab.spots.at(i).enacbMask = mods.locallab.spots.at(i).enacbMask; + } + + if (locallab.spots.at(i).CCmaskcbcurve) { + toEdit.locallab.spots.at(i).CCmaskcbcurve = mods.locallab.spots.at(i).CCmaskcbcurve; + } + + if (locallab.spots.at(i).LLmaskcbcurve) { + toEdit.locallab.spots.at(i).LLmaskcbcurve = mods.locallab.spots.at(i).LLmaskcbcurve; + } + + if (locallab.spots.at(i).HHmaskcbcurve) { + toEdit.locallab.spots.at(i).HHmaskcbcurve = mods.locallab.spots.at(i).HHmaskcbcurve; + } + if (locallab.spots.at(i).softradiuscb) { toEdit.locallab.spots.at(i).softradiuscb = mods.locallab.spots.at(i).softradiuscb; } @@ -4344,6 +4364,10 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : gammaskcb(v), slomaskcb(v), softradiuscb(v), + enacbMask(v), + CCmaskcbcurve(v), + LLmaskcbcurve(v), + HHmaskcbcurve(v), // Denoise expdenoi(v), noiselumf(v), @@ -4536,6 +4560,10 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) gammaskcb = v; slomaskcb = v; softradiuscb = v; + enacbMask = v; + CCmaskcbcurve = v; + LLmaskcbcurve = v; + HHmaskcbcurve = v; // Denoise expdenoi = v; noiselumf = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 3283cd400..a30b758f7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -523,6 +523,10 @@ public: bool gammaskcb; bool slomaskcb; bool softradiuscb; + bool enacbMask; + bool CCmaskcbcurve; + bool LLmaskcbcurve; + bool HHmaskcbcurve; // Denoise bool expdenoi;