diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 827035871..81c46bcac 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1641,6 +1641,148 @@ void LocretigainCurverab::Set(const std::vector &curvePoints) } } + + +LocHHmasktmCurve::LocHHmasktmCurve() : sum(0.f) {}; + +void LocHHmasktmCurve::Reset() +{ + lutLocHHmasktmCurve.reset(); + sum = 0.f; +} + + +void LocHHmasktmCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocHHmasktmCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocHHmasktmCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocHHmasktmCurve[i] < 0.02f) { + lutLocHHmasktmCurve[i] = 0.02f; + } + + sum += lutLocHHmasktmCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + +void LocHHmasktmCurve::Set(const std::vector &curvePoints, bool & lhmastmutili) +{ + // 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.); + lhmastmutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + +LocLLmasktmCurve::LocLLmasktmCurve() : sum(0.f) {}; + +void LocLLmasktmCurve::Reset() +{ + lutLocLLmasktmCurve.reset(); + sum = 0.f; +} + +void LocLLmasktmCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocLLmasktmCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocLLmasktmCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocLLmasktmCurve[i] < 0.02f) { + lutLocLLmasktmCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocLLmasktmCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocLLmasktmCurve::Set(const std::vector &curvePoints, bool & llmastmutili) +{ + // 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.); + llmastmutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + +LocCCmasktmCurve::LocCCmasktmCurve() : sum(0.f) {}; + +void LocCCmasktmCurve::Reset() +{ + lutLocCCmasktmCurve.reset(); + sum = 0.f; +} + +void LocCCmasktmCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocCCmasktmCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocCCmasktmCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocCCmasktmCurve[i] < 0.02f) { + lutLocCCmasktmCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocCCmasktmCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocCCmasktmCurve::Set(const std::vector &curvePoints, bool & lcmastmutili) +{ + // 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.); + lcmastmutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + + + + LocHHmaskretiCurve::LocHHmaskretiCurve() : sum(0.f) {}; void LocHHmaskretiCurve::Reset() diff --git a/rtengine/curves.h b/rtengine/curves.h index 904b7f1a5..a5ddcfc84 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -649,6 +649,93 @@ public: } }; +class LocHHmasktmCurve +{ +private: + LUTf lutLocHHmasktmCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocHHmasktmCurve() {}; + LocHHmasktmCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & lhmastmutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocHHmasktmCurve[index]; + } + operator bool (void) const + { + return lutLocHHmasktmCurve; + } +}; + + +class LocCCmasktmCurve +{ +private: + LUTf lutLocCCmasktmCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocCCmasktmCurve() {}; + LocCCmasktmCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & lcmastmutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocCCmasktmCurve[index]; + } + operator bool (void) const + { + return lutLocCCmasktmCurve; + } +}; + +class LocLLmasktmCurve +{ +private: + LUTf lutLocLLmasktmCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocLLmasktmCurve() {}; + LocLLmasktmCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & llmastmutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocLLmasktmCurve[index]; + } + operator bool (void) const + { + return lutLocLLmasktmCurve; + } +}; + + + class LocHHmaskretiCurve { private: diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index f17d67ac7..6e084c428 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -289,6 +289,7 @@ protected: int locallcbMask; int locallretiMask; int locallsoftMask; + int localltmMask; public: @@ -358,7 +359,7 @@ public: updaterThreadStart.unlock(); } - void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask) override + void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask) override { this->locallColorMask = locallColorMask; this->locallExpMask = locallExpMask; @@ -366,6 +367,7 @@ public: this->locallcbMask = locallcbMask; this->locallretiMask = locallretiMask; this->locallsoftMask = locallsoftMask; + this->localltmMask = localltmMask; } void setProgressListener (ProgressListener* pl) override diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 082610911..c93f11ce7 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -732,6 +732,16 @@ enum ProcEventCode { Evlocallablaplacexp = 702, Evlocallabbalanexp = 703, Evlocallablinear = 704, + EvlocallabCCmasktmshape = 705, + EvlocallabLLmasktmshape = 706, + EvlocallabHHmasktmshape = 707, + EvLocallabEnatmMask = 708, + Evlocallabblendmasktm = 709, + Evlocallabradmasktm = 710, + Evlocallabchromasktm = 711, + Evlocallabgammasktm = 712, + Evlocallabslomasktm = 713, + EvlocallabshowmasktmMethod = 714, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 44689d80d..49a153610 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2474,6 +2474,15 @@ LocallabParams::LocallabSpot::LocallabSpot() : softradiustm(0.0), amount(95.), equiltm(true), + CCmasktmcurve{(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 }, + LLmasktmcurve{(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}, + HHmasktmcurve{(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}, + enatmMask(false), + blendmasktm(0), + radmasktm(10.0), + chromasktm(0.0), + gammasktm(1.0), + slomasktm(0.0), // Retinex expreti(false), retinexMethod("high"), @@ -2698,6 +2707,15 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && softradiustm == other.softradiustm && amount == other.amount && equiltm == other.equiltm + && CCmasktmcurve == other.CCmasktmcurve + && LLmasktmcurve == other.LLmasktmcurve + && HHmasktmcurve == other.HHmasktmcurve + && enatmMask == other.enatmMask + && blendmasktm == other.blendmasktm + && radmasktm == other.radmasktm + && chromasktm == other.chromasktm + && gammasktm == other.gammasktm + && slomasktm == other.slomasktm // Retinex && expreti == other.expreti && retinexMethod == other.retinexMethod @@ -3902,10 +3920,16 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensitm, "Locallab", "Sensitm_" + std::to_string(i), spot.sensitm, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiustm, "Locallab", "Softradiustm_" + std::to_string(i), spot.softradiustm, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).amount, "Locallab", "Amount_" + std::to_string(i), spot.amount, keyFile); - saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskreticurve, "Locallab", "CCmaskretiCurve_" + std::to_string(i), spot.CCmaskreticurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskreticurve, "Locallab", "LLmaskretiCurve_" + std::to_string(i), spot.LLmaskreticurve, keyFile); - saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskreticurve, "Locallab", "HHmaskretiCurve_" + std::to_string(i), spot.HHmaskreticurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).equiltm, "Locallab", "Equiltm_" + std::to_string(i), spot.equiltm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmasktmcurve, "Locallab", "CCmasktmCurve_" + std::to_string(i), spot.CCmasktmcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmasktmcurve, "Locallab", "LLmasktmCurve_" + std::to_string(i), spot.LLmasktmcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmasktmcurve, "Locallab", "HHmasktmCurve_" + std::to_string(i), spot.HHmasktmcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enatmMask, "Locallab", "EnatmMask_" + std::to_string(i), spot.enatmMask, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmasktm, "Locallab", "Blendmasktm_" + std::to_string(i), spot.blendmasktm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmasktm, "Locallab", "Radmasktm_" + std::to_string(i), spot.radmasktm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chromasktm, "Locallab", "Chromasktm_" + std::to_string(i), spot.chromasktm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).gammasktm, "Locallab", "Gammasktm_" + std::to_string(i), spot.gammasktm, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).slomasktm, "Locallab", "Slomasktm_" + std::to_string(i), spot.slomasktm, keyFile); // Retinex saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expreti, "Locallab", "Expreti_" + std::to_string(i), spot.expreti, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).retinexMethod, "Locallab", "retinexMethod_" + std::to_string(i), spot.retinexMethod, keyFile); @@ -3919,6 +3943,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).equilret, "Locallab", "Equilret_" + std::to_string(i), spot.equilret, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiusret, "Locallab", "Softradiusret_" + std::to_string(i), spot.softradiusret, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskreticurve, "Locallab", "CCmaskretiCurve_" + std::to_string(i), spot.CCmaskreticurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskreticurve, "Locallab", "LLmaskretiCurve_" + std::to_string(i), spot.LLmaskreticurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskreticurve, "Locallab", "HHmaskretiCurve_" + std::to_string(i), spot.HHmaskreticurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enaretiMask, "Locallab", "EnaretiMask_" + std::to_string(i), spot.enaretiMask, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enaretiMasktmap, "Locallab", "EnaretiMasktmap_" + std::to_string(i), spot.enaretiMasktmap, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskreti, "Locallab", "Blendmaskreti_" + std::to_string(i), spot.blendmaskreti, keyFile); @@ -5230,6 +5257,15 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Softradiustm_" + std::to_string(i), pedited, spot.softradiustm, spotEdited.softradiustm); assignFromKeyfile(keyFile, "Locallab", "Amount_" + std::to_string(i), pedited, spot.amount, spotEdited.amount); assignFromKeyfile(keyFile, "Locallab", "Equiltm_" + std::to_string(i), pedited, spot.equiltm, spotEdited.equiltm); + assignFromKeyfile(keyFile, "Locallab", "CCmasktmCurve_" + std::to_string(i), pedited, spot.CCmasktmcurve, spotEdited.CCmasktmcurve); + assignFromKeyfile(keyFile, "Locallab", "LLmasktmCurve_" + std::to_string(i), pedited, spot.LLmasktmcurve, spotEdited.LLmasktmcurve); + assignFromKeyfile(keyFile, "Locallab", "HHmasktmCurve_" + std::to_string(i), pedited, spot.HHmasktmcurve, spotEdited.HHmasktmcurve); + assignFromKeyfile(keyFile, "Locallab", "EnatmMask_" + std::to_string(i), pedited, spot.enatmMask, spotEdited.enatmMask); + assignFromKeyfile(keyFile, "Locallab", "Blendmasktm_" + std::to_string(i), pedited, spot.blendmasktm, spotEdited.blendmasktm); + assignFromKeyfile(keyFile, "Locallab", "Radmasktm_" + std::to_string(i), pedited, spot.radmasktm, spotEdited.radmasktm); + assignFromKeyfile(keyFile, "Locallab", "Chromasktm_" + std::to_string(i), pedited, spot.chromasktm, spotEdited.chromasktm); + assignFromKeyfile(keyFile, "Locallab", "Gammasktm_" + std::to_string(i), pedited, spot.gammasktm, spotEdited.gammasktm); + assignFromKeyfile(keyFile, "Locallab", "Slomasktm_" + std::to_string(i), pedited, spot.slomasktm, spotEdited.slomasktm); // Retinex assignFromKeyfile(keyFile, "Locallab", "Expreti_" + std::to_string(i), pedited, spot.expreti, spotEdited.expreti); assignFromKeyfile(keyFile, "Locallab", "retinexMethod_" + std::to_string(i), pedited, spot.retinexMethod, spotEdited.retinexMethod); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 9886a3dcb..bd264e453 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1075,6 +1075,15 @@ struct LocallabParams { double softradiustm; double amount; bool equiltm; + std::vector CCmasktmcurve; + std::vector LLmasktmcurve; + std::vector HHmasktmcurve; + bool enatmMask; + int blendmasktm; + double radmasktm; + double chromasktm; + double gammasktm; + double slomasktm; // Retinex bool expreti; Glib::ustring retinexMethod; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index c36f85f97..2c328bf36 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -731,7 +731,17 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvlocallabexpMethod LUMINANCECURVE, //EvLocallablaplacexp LUMINANCECURVE, //EvLocallabbalanexp - LUMINANCECURVE //EvLocallablinear + LUMINANCECURVE, //EvLocallablinear + LUMINANCECURVE, // EvlocallabCCmasktmshape + LUMINANCECURVE, //EvlocallabLLmasktmshape + LUMINANCECURVE, //EvlocallabHHmasktmshape + LUMINANCECURVE, //EvLocallabEnatmMask + LUMINANCECURVE, //Evlocallabblendmasktm + LUMINANCECURVE, //Evlocallabradmasktm + LUMINANCECURVE, //Evlocallabchromasktm + LUMINANCECURVE, //Evlocallabgammasktm + LUMINANCECURVE, //Evlocallabslomasktm + LUMINANCECURVE //EvlocallabshowmasktmMethod }; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 8bfec9ebc..1dea2663b 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -507,7 +507,7 @@ public: virtual void updateUnLock() = 0; - virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask) = 0; + virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask) = 0; /** Creates and returns a Crop instance that acts as a window on the image * @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index e41e47601..deaeaa700 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -146,6 +146,7 @@ Locallab::Locallab(): expmasksh(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), expmaskcb(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), expmaskreti(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), + expmasktm(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), // CurveEditorGroup widgets // Color & Light @@ -159,6 +160,8 @@ Locallab::Locallab(): maskSHCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), // Vibrance curveEditorGG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL"))), + //TM + masktmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), // Retinex LocalcurveEditorgainT(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONGAIN"))), maskretiCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), @@ -236,6 +239,11 @@ Locallab::Locallab(): softradiustm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))), amount(Gtk::manage(new Adjuster(M("TP_LOCALLAB_AMOUNT"), 50., 100.0, 0.5, 95.))), satur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SATUR"), -100., 100., 0.1, 0.))),//by default satur = 0 ==> use Mantiuk value + blendmasktm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), + radmasktm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 10.))), + chromasktm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), + gammasktm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.05, 5.0, 0.01, 1.))), + slomasktm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), // Retinex str(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STR"), 0., 100., 0.1, 0.0))), chrrt(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHRRT"), 0.0, 100.0, 0.1, 0.0))), @@ -315,6 +323,7 @@ Locallab::Locallab(): activlum(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIV")))), //TM equiltm(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))), + enatmMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), // Retinex equilret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))), inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), @@ -343,6 +352,8 @@ Locallab::Locallab(): //soft Method softMethod(Gtk::manage(new MyComboBoxText())), showmasksoftMethod(Gtk::manage(new MyComboBoxText())), + //TM + showmasktmMethod(Gtk::manage(new MyComboBoxText())), // Retinex retinexMethod(Gtk::manage(new MyComboBoxText())), showmaskretiMethod(Gtk::manage(new MyComboBoxText())), @@ -1060,6 +1071,10 @@ Locallab::Locallab(): exptonemap->set_tooltip_text(M("TP_LOCALLAB_TONEMAP_TOOLTIP")); } + setExpandAlignProperties(expmasktm, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + expmasktm->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmasktm)); + expmasktm->setLevel(2); + stren->setAdjusterListener(this); gamma->setAdjusterListener(this); @@ -1090,6 +1105,77 @@ Locallab::Locallab(): equiltmConn = equiltm->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::equiltmChanged)); + masktmCurveEditorG->setCurveListener(this); + + CCmasktmshape = static_cast(masktmCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false)); + CCmasktmshape->setIdentityValue(0.); + CCmasktmshape->setResetCurve(FlatCurveType(defSpot.CCmasktmcurve.at(0)), defSpot.CCmasktmcurve); + + if (showtooltip) { + CCmasktmshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + CCmasktmshape->setBottomBarColorProvider(this, 7); + + LLmasktmshape = static_cast(masktmCurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false)); + LLmasktmshape->setIdentityValue(0.); + LLmasktmshape->setResetCurve(FlatCurveType(defSpot.LLmasktmcurve.at(0)), defSpot.LLmasktmcurve); + + if (showtooltip) { + LLmasktmshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + LLmasktmshape->setBottomBarBgGradient(mllshape); + + HHmasktmshape = static_cast(masktmCurveEditorG->addCurve(CT_Flat, "LC(H)", nullptr, false, true)); + HHmasktmshape->setIdentityValue(0.); + HHmasktmshape->setResetCurve(FlatCurveType(defSpot.HHmasktmcurve.at(0)), defSpot.HHmasktmcurve); + + if (showtooltip) { + HHmasktmshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + HHmasktmshape->setCurveColorProvider(this, 6); + HHmasktmshape->setBottomBarColorProvider(this, 6); + + masktmCurveEditorG->curveListComplete(); + enatmMaskConn = enatmMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enatmMaskChanged)); + + showmasktmMethod->append(M("TP_LOCALLAB_SHOWMNONE")); + showmasktmMethod->append(M("TP_LOCALLAB_SHOWMODIF")); + showmasktmMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); + showmasktmMethod->append(M("TP_LOCALLAB_SHOWMASK")); + showmasktmMethod->append(M("TP_LOCALLAB_PREVIEWSEL")); + + + showmasktmMethod->set_active(0); + + if (showtooltip) { + showmasktmMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); + } + + showmasktmMethodConn = showmasktmMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmasktmMethodChanged)); + + + + blendmasktm->setAdjusterListener(this); + radmasktm->setAdjusterListener(this); + chromasktm->setAdjusterListener(this); + gammasktm->setAdjusterListener(this); + slomasktm->setAdjusterListener(this); + + ToolParamBlock* const masktmBox = Gtk::manage(new ToolParamBlock()); + masktmBox->pack_start(*showmasktmMethod, Gtk::PACK_SHRINK, 4); + masktmBox->pack_start(*enatmMask, Gtk::PACK_SHRINK, 0); + masktmBox->pack_start(*masktmCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + masktmBox->pack_start(*blendmasktm, Gtk::PACK_SHRINK, 0); + masktmBox->pack_start(*radmasktm, Gtk::PACK_SHRINK, 0); + masktmBox->pack_start(*chromasktm, Gtk::PACK_SHRINK, 0); + masktmBox->pack_start(*gammasktm, Gtk::PACK_SHRINK, 0); + masktmBox->pack_start(*slomasktm, Gtk::PACK_SHRINK, 0); + expmasktm->add(*masktmBox, false); + + ToolParamBlock* const tmBox = Gtk::manage(new ToolParamBlock()); // tmBox->pack_start(*amount);//to use if we change transit_shapedetect parameters tmBox->pack_start(*stren); @@ -1101,6 +1187,8 @@ Locallab::Locallab(): tmBox->pack_start(*rewei); // tmBox->pack_start(*softradiustm);//always bad with TM ?? tmBox->pack_start(*sensitm); + // tmBox->pack_start(*expmasktm); + exptonemap->add(*tmBox, false); exptonemap->setLevel(2); @@ -1616,6 +1704,7 @@ Locallab::~Locallab() delete maskSHCurveEditorG; delete curveEditorGG; delete LocalcurveEditorgainT; + delete masktmCurveEditorG; delete maskretiCurveEditorG; delete maskcbCurveEditorG; } @@ -1640,6 +1729,7 @@ void Locallab::foldAllButMe(GdkEventButton* event, MyExpander *expander) expmasksh->set_expanded(expmasksh == expander); expmaskcb->set_expanded(expmaskcb == expander); expmaskreti->set_expanded(expmaskreti == expander); + expmasktm->set_expanded(expmasktm == expander); } } @@ -1731,6 +1821,7 @@ void Locallab::writeOptions(std::vector &tpOpen) tpOpen.push_back(expmasksh->get_expanded()); tpOpen.push_back(expmaskcb->get_expanded()); tpOpen.push_back(expmaskreti->get_expanded()); + tpOpen.push_back(expmasktm->get_expanded()); } @@ -1780,6 +1871,11 @@ void Locallab::refChanged(double huer, double lumar, double chromar) LLmaskcbshape->updateLocallabBackground(normLumar); HHmaskcbshape->updateLocallabBackground(normHuer); + // Update TM mask background + CCmasktmshape->updateLocallabBackground(normChromar); + LLmasktmshape->updateLocallabBackground(normLumar); + HHmasktmshape->updateLocallabBackground(normHuer); + // Update Retinex mask background CCmaskretishape->updateLocallabBackground(normChromar); LLmaskretishape->updateLocallabBackground(normLumar); @@ -1793,7 +1889,7 @@ void Locallab::refChanged(double huer, double lumar, double chromar) void Locallab::updateToolState(std::vector &tpOpen) { - if (tpOpen.size() >= 19) { + if (tpOpen.size() >= 20) { expsettings->setExpanded(tpOpen.at(0)); expcolor->set_expanded(tpOpen.at(1)); expexpose->set_expanded(tpOpen.at(2)); @@ -1812,6 +1908,7 @@ void Locallab::updateToolState(std::vector &tpOpen) expmasksh->set_expanded(tpOpen.at(15)); expmaskcb->set_expanded(tpOpen.at(16)); expmaskreti->set_expanded(tpOpen.at(17)); + expmasktm->set_expanded(tpOpen.at(18)); } } @@ -2531,6 +2628,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).softradiustm = softradiustm->getValue(); pp->locallab.spots.at(pp->locallab.selspot).amount = amount->getValue(); pp->locallab.spots.at(pp->locallab.selspot).equiltm = equiltm->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).LLmasktmcurve = LLmasktmshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).CCmasktmcurve = CCmasktmshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).HHmasktmcurve = HHmasktmshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).enatmMask = enatmMask->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).blendmasktm = blendmasktm->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).radmasktm = radmasktm->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).chromasktm = chromasktm->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).gammasktm = gammasktm->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).slomasktm = slomasktm->getValue(); // Retinex pp->locallab.spots.at(pp->locallab.selspot).expreti = expreti->getEnabled(); @@ -2766,6 +2872,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).softradiustm = pe->locallab.spots.at(pp->locallab.selspot).softradiustm || softradiustm->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).amount = pe->locallab.spots.at(pp->locallab.selspot).amount || amount->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).equiltm = pe->locallab.spots.at(pp->locallab.selspot).equiltm || !equiltm->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).CCmasktmcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmasktmcurve || !CCmasktmshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).LLmasktmcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmasktmcurve || !LLmasktmshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).HHmasktmcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmasktmcurve || !HHmasktmshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).enatmMask = pe->locallab.spots.at(pp->locallab.selspot).enatmMask || !enatmMask->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).blendmasktm = pe->locallab.spots.at(pp->locallab.selspot).blendmasktm || blendmasktm->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).radmasktm = pe->locallab.spots.at(pp->locallab.selspot).radmasktm || radmasktm->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).chromasktm = pe->locallab.spots.at(pp->locallab.selspot).chromasktm || chromasktm->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).gammasktm = pe->locallab.spots.at(pp->locallab.selspot).gammasktm || gammasktm->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).slomasktm = pe->locallab.spots.at(pp->locallab.selspot).slomasktm || slomasktm->getEditedState(); // Retinex pe->locallab.spots.at(pp->locallab.selspot).expreti = pe->locallab.spots.at(pp->locallab.selspot).expreti || !expreti->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).retinexMethod = pe->locallab.spots.at(pp->locallab.selspot).retinexMethod || retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -2996,6 +3111,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).enaretiMask = pedited->locallab.spots.at(pp->locallab.selspot).enaretiMask || !enaretiMask->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap = pedited->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap || !enaretiMasktmap->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).equiltm = pedited->locallab.spots.at(pp->locallab.selspot).equiltm || !equiltm->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).CCmasktmcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmasktmcurve || !CCmasktmshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).LLmasktmcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmasktmcurve || !LLmasktmshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).HHmasktmcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmasktmcurve || !HHmasktmshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).enatmMask = pedited->locallab.spots.at(pp->locallab.selspot).enatmMask || !enatmMask->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).blendmasktm = pedited->locallab.spots.at(pp->locallab.selspot).blendmasktm || blendmasktm->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).radmasktm = pedited->locallab.spots.at(pp->locallab.selspot).radmasktm || radmasktm->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).chromasktm = pedited->locallab.spots.at(pp->locallab.selspot).chromasktm || chromasktm->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).gammasktm = pedited->locallab.spots.at(pp->locallab.selspot).gammasktm || gammasktm->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).slomasktm = pedited->locallab.spots.at(pp->locallab.selspot).slomasktm || slomasktm->getEditedState(); // Retinex pedited->locallab.spots.at(pp->locallab.selspot).expreti = pedited->locallab.spots.at(pp->locallab.selspot).expreti || !expreti->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).retinexMethod = pedited->locallab.spots.at(pp->locallab.selspot).retinexMethod || retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -3309,6 +3433,29 @@ void Locallab::curveChanged(CurveEditor* ce) } } + // TM + if (getEnabled() && exptonemap->getEnabled()) { + + if (ce == CCmasktmshape) { + if (listener) { + listener->panelChanged(EvlocallabCCmasktmshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == LLmasktmshape) { + if (listener) { + listener->panelChanged(EvlocallabLLmasktmshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == HHmasktmshape) { + if (listener) { + listener->panelChanged(EvlocallabHHmasktmshape, M("HISTORY_CUSTOMCURVE")); + } + } + + } + // Retinex if (getEnabled() && expreti->getEnabled()) { if (ce == cTgainshape) { @@ -3413,6 +3560,7 @@ void Locallab::showmaskcolMethodChanged() showmaskcbMethod->set_active(0); showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); if (listener) { @@ -3431,6 +3579,7 @@ void Locallab::showmaskexpMethodChanged() showmaskSHMethod->set_active(0); showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); if (listener) { @@ -3476,6 +3625,7 @@ void Locallab::showmaskSHMethodChanged() showmaskcbMethod->set_active(0); showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); if (listener) { @@ -3494,6 +3644,7 @@ void Locallab::showmaskcbMethodChanged() showmaskexpMethod->set_active(0); showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); if (listener) { @@ -3501,6 +3652,26 @@ void Locallab::showmaskcbMethodChanged() } } +void Locallab::showmasktmMethodChanged() +{ + // printf("showmaskSHMethodChanged\n"); + + // When one mask state is changed, other masks are deactivated + disableListener(); + showmaskcolMethod->set_active(0); + showmaskSHMethod->set_active(0); + showmaskexpMethod->set_active(0); + showmaskcbMethod->set_active(0); + showmaskretiMethod->set_active(0); + showmasksoftMethod->set_active(0); + enableListener(); + + if (listener) { + listener->panelChanged(EvlocallabshowmasktmMethod, ""); + } +} + + void Locallab::showmaskretiMethodChanged() { // printf("showmaskSHMethodChanged\n"); @@ -3512,6 +3683,7 @@ void Locallab::showmaskretiMethodChanged() showmaskexpMethod->set_active(0); showmaskcbMethod->set_active(0); showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); if (listener) { @@ -3530,6 +3702,7 @@ void Locallab::showmasksoftMethodChanged() showmaskSHMethod->set_active(0); showmaskcbMethod->set_active(0); showmaskretiMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); if (listener) { @@ -3548,6 +3721,7 @@ void Locallab::resetMaskVisibility() showmaskcbMethod->set_active(0); showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); enableListener(); } @@ -3560,6 +3734,7 @@ Locallab::llMaskVisibility* Locallab::getMaskVisibility() maskStruct->cbMask = showmaskcbMethod->get_active_row_number(); maskStruct->retiMask = showmaskretiMethod->get_active_row_number(); maskStruct->softMask = showmasksoftMethod->get_active_row_number(); + maskStruct->tmMask = showmasktmMethod->get_active_row_number(); // printf("SHmask=%i \n", maskStruct->SHMask); // printf("retimask=%i \n", maskStruct->retiMask); @@ -3638,6 +3813,31 @@ void Locallab::enaSHMaskChanged() } } +void Locallab::enatmMaskChanged() +{ + printf("enatmmaskChanged\n"); + + if (multiImage) { + if (enatmMask->get_inconsistent()) { + enatmMask->set_inconsistent(false); + enatmMaskConn.block(true); + enatmMask->set_active(false); + enatmMaskConn.block(false); + } + } + + if (getEnabled() && exptonemap->getEnabled()) { + if (listener) { + if (enatmMask->get_active()) { + listener->panelChanged(EvLocallabEnatmMask, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvLocallabEnatmMask, M("GENERAL_DISABLED")); + } + } + } +} + + void Locallab::enaretiMaskChanged() { printf("enaretimaskChanged\n"); @@ -4268,6 +4468,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensitm->setDefault((double)defSpot->sensitm); softradiustm->setDefault(defSpot->softradiustm); amount->setDefault(defSpot->amount); + blendmasktm->setDefault((double)defSpot->blendmasktm); + radmasktm->setDefault(defSpot->radmasktm); + chromasktm->setDefault(defSpot->chromasktm); + gammasktm->setDefault(defSpot->gammasktm); + slomasktm->setDefault(defSpot->slomasktm); // Retinex str->setDefault(defSpot->str); chrrt->setDefault(defSpot->chrrt); @@ -4406,6 +4611,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensitm->setDefaultEditedState(Irrelevant); softradiustm->setDefaultEditedState(Irrelevant); amount->setDefaultEditedState(Irrelevant); + blendmasktm->setDefaultEditedState(Irrelevant); + radmasktm->setDefaultEditedState(Irrelevant); + chromasktm->setDefaultEditedState(Irrelevant); + gammasktm->setDefaultEditedState(Irrelevant); + slomasktm->setDefaultEditedState(Irrelevant); // Retinex str->setDefaultEditedState(Irrelevant); chrrt->setDefaultEditedState(Irrelevant); @@ -4548,6 +4758,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensitm->setDefaultEditedState(defSpotState->sensitm ? Edited : UnEdited); softradiustm->setDefaultEditedState(defSpotState->softradiustm ? Edited : UnEdited); amount->setDefaultEditedState(defSpotState->amount ? Edited : UnEdited); + blendmasktm->setDefaultEditedState(defSpotState->blendmasktm ? Edited : UnEdited); + radmasktm->setDefaultEditedState(defSpotState->radmasktm ? Edited : UnEdited); + chromasktm->setDefaultEditedState(defSpotState->chromasktm ? Edited : UnEdited); + gammasktm->setDefaultEditedState(defSpotState->gammasktm ? Edited : UnEdited); + slomasktm->setDefaultEditedState(defSpotState->slomasktm ? Edited : UnEdited); // Retinex str->setDefaultEditedState(defSpotState->str ? Edited : UnEdited); chrrt->setDefaultEditedState(defSpotState->chrrt ? Edited : UnEdited); @@ -5079,6 +5294,37 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == blendmasktm) { + if (listener) { + listener->panelChanged(Evlocallabblendmasktm, blendmasktm->getTextValue()); + } + } + + if (a == radmasktm) { + if (listener) { + listener->panelChanged(Evlocallabradmasktm, radmasktm->getTextValue()); + } + } + + if (a == chromasktm) { + if (listener) { + listener->panelChanged(Evlocallabchromasktm, chromasktm->getTextValue()); + } + } + + if (a == gammasktm) { + if (listener) { + listener->panelChanged(Evlocallabgammasktm, gammasktm->getTextValue()); + } + } + + if (a == slomasktm) { + if (listener) { + listener->panelChanged(Evlocallabslomasktm, slomasktm->getTextValue()); + } + } + + } // Retinex @@ -5538,6 +5784,11 @@ void Locallab::setBatchMode(bool batchMode) sensitm->showEditedCB(); softradiustm->showEditedCB(); amount->showEditedCB(); + blendmasktm->showEditedCB(); + radmasktm->showEditedCB(); + chromasktm->showEditedCB(); + gammasktm->showEditedCB(); + slomasktm->showEditedCB(); // Retinex str->showEditedCB(); chrrt->showEditedCB(); @@ -5618,6 +5869,7 @@ void Locallab::setBatchMode(bool batchMode) showmaskSHMethod->hide(); showmaskcbMethod->hide(); showmaskretiMethod->hide(); + showmasktmMethod->hide(); } std::vector Locallab::getCurvePoints(ThresholdSelector* tAdjuster) const @@ -5788,6 +6040,8 @@ void Locallab::enableListener() // Tone Mapping enabletonemapConn.block(false); equiltmConn.block(false); + enatmMaskConn.block(false); + showmasktmMethodConn.block(false); // Retinex enableretiConn.block(false); retinexMethodConn.block(false); @@ -5851,6 +6105,8 @@ void Locallab::disableListener() // Tone Mapping enabletonemapConn.block(true); equiltmConn.block(true); + enatmMaskConn.block(true); + showmasktmMethodConn.block(true); // Retinex enableretiConn.block(true); retinexMethodConn.block(true); @@ -6036,6 +6292,15 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con softradiustm->setValue(pp->locallab.spots.at(index).softradiustm); amount->setValue(pp->locallab.spots.at(index).amount); equiltm->set_active(pp->locallab.spots.at(index).equiltm); + enatmMask->set_active(pp->locallab.spots.at(index).enatmMask); + blendmasktm->setValue(pp->locallab.spots.at(index).blendmasktm); + radmasktm->setValue(pp->locallab.spots.at(index).radmasktm); + chromasktm->setValue(pp->locallab.spots.at(index).chromasktm); + gammasktm->setValue(pp->locallab.spots.at(index).gammasktm); + slomasktm->setValue(pp->locallab.spots.at(index).slomasktm); + CCmasktmshape->setCurve(pp->locallab.spots.at(index).CCmasktmcurve); + LLmasktmshape->setCurve(pp->locallab.spots.at(index).LLmasktmcurve); + HHmasktmshape->setCurve(pp->locallab.spots.at(index).HHmasktmcurve); // Retinex expreti->setEnabled(pp->locallab.spots.at(index).expreti); @@ -6307,6 +6572,15 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con softradiustm->setEditedState(spotState->softradiustm ? Edited : UnEdited); amount->setEditedState(spotState->amount ? Edited : UnEdited); equiltm->set_inconsistent(multiImage && !spotState->equiltm); + CCmasktmshape->setUnChanged(!spotState->CCmasktmcurve); + LLmasktmshape->setUnChanged(!spotState->LLmasktmcurve); + HHmasktmshape->setUnChanged(!spotState->HHmasktmcurve); + enatmMask->set_inconsistent(multiImage && !spotState->enatmMask); + blendmasktm->setEditedState(spotState->blendmasktm ? Edited : UnEdited); + radmasktm->setEditedState(spotState->radmasktm ? Edited : UnEdited); + chromasktm->setEditedState(spotState->chromasktm ? Edited : UnEdited); + gammasktm->setEditedState(spotState->gammasktm ? Edited : UnEdited); + slomasktm->setEditedState(spotState->slomasktm ? Edited : UnEdited); // Retinex expreti->set_inconsistent(!spotState->expreti); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 1ef7672d6..4898d718b 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -65,6 +65,7 @@ private: MyExpander* const expmasksh; MyExpander* const expmaskcb; MyExpander* const expmaskreti; + MyExpander* const expmasktm; sigc::connection enablecolorConn, enableexposeConn, enableshadhighConn, enablevibranceConn, enablesoftConn, enableblurConn, enabletonemapConn, enableretiConn, enablesharpConn, enablecontrastConn, enablecbdlConn, enabledenoiConn; // Curve widgets @@ -94,6 +95,11 @@ private: // Vibrance CurveEditorGroup* const curveEditorGG; DiagonalCurveEditor* skinTonesCurve; + // TM + CurveEditorGroup* const masktmCurveEditorG; + FlatCurveEditor* CCmasktmshape; + FlatCurveEditor* LLmasktmshape; + FlatCurveEditor* HHmasktmshape; // Retinex CurveEditorGroup* const LocalcurveEditorgainT; CurveEditorGroup* const maskretiCurveEditorG; @@ -178,6 +184,11 @@ private: Adjuster* const softradiustm; Adjuster* const amount; Adjuster* const satur; + Adjuster* const blendmasktm; + Adjuster* const radmasktm; + Adjuster* const chromasktm; + Adjuster* const gammasktm; + Adjuster* const slomasktm; // Retinex Adjuster* const str; Adjuster* const chrrt; @@ -267,6 +278,8 @@ private: //Tone mapping Gtk::CheckButton* const equiltm; sigc::connection equiltmConn; + Gtk::CheckButton* const enatmMask; + sigc::connection enatmMaskConn; // Retinex Gtk::CheckButton* const equilret; sigc::connection equilretConn; @@ -313,7 +326,9 @@ private: sigc::connection softMethodConn; MyComboBoxText* const showmasksoftMethod; sigc::connection showmasksoftMethodConn; - + //TM + MyComboBoxText* const showmasktmMethod; + sigc::connection showmasktmMethodConn; // Retinex MyComboBoxText* const retinexMethod; sigc::connection retinexMethodConn; @@ -377,6 +392,7 @@ private: void activlumChanged(); //TM void equiltmChanged(); + void enatmMaskChanged(); // Retinex void equilretChanged(); void inversretChanged(); @@ -404,6 +420,8 @@ private: // Soft light void softMethodChanged(); void showmasksoftMethodChanged(); + //TM + void showmasktmMethodChanged(); // Retinex void retinexMethodChanged(); void showmaskretiMethodChanged(); @@ -446,6 +464,7 @@ public: int cbMask; int retiMask; int softMask; + int tmMask; }; void resetMaskVisibility(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 1013cd99f..e3f331879 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1068,6 +1068,15 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).softradiustm = locallab.spots.at(j).softradiustm && pSpot.softradiustm == otherSpot.softradiustm; locallab.spots.at(j).amount = locallab.spots.at(j).amount && pSpot.amount == otherSpot.amount; locallab.spots.at(j).equiltm = locallab.spots.at(j).equiltm && pSpot.equiltm == otherSpot.equiltm; + locallab.spots.at(j).CCmasktmcurve = locallab.spots.at(j).CCmasktmcurve && pSpot.CCmasktmcurve == otherSpot.CCmasktmcurve; + locallab.spots.at(j).LLmasktmcurve = locallab.spots.at(j).LLmasktmcurve && pSpot.LLmasktmcurve == otherSpot.LLmasktmcurve; + locallab.spots.at(j).HHmasktmcurve = locallab.spots.at(j).HHmasktmcurve && pSpot.HHmasktmcurve == otherSpot.HHmasktmcurve; + locallab.spots.at(j).enatmMask = locallab.spots.at(j).enatmMask && pSpot.enatmMask == otherSpot.enatmMask; + locallab.spots.at(j).blendmasktm = locallab.spots.at(j).blendmasktm && pSpot.blendmasktm == otherSpot.blendmasktm; + locallab.spots.at(j).radmasktm = locallab.spots.at(j).radmasktm && pSpot.radmasktm == otherSpot.radmasktm; + locallab.spots.at(j).chromasktm = locallab.spots.at(j).chromasktm && pSpot.chromasktm == otherSpot.chromasktm; + locallab.spots.at(j).gammasktm = locallab.spots.at(j).gammasktm && pSpot.gammasktm == otherSpot.gammasktm; + locallab.spots.at(j).slomasktm = locallab.spots.at(j).slomasktm && pSpot.slomasktm == otherSpot.slomasktm; // Retinex locallab.spots.at(j).expreti = locallab.spots.at(j).expreti && pSpot.expreti == otherSpot.expreti; locallab.spots.at(j).retinexMethod = locallab.spots.at(j).retinexMethod && pSpot.retinexMethod == otherSpot.retinexMethod; @@ -3104,6 +3113,42 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).amount = mods.locallab.spots.at(i).amount; } + if (locallab.spots.at(i).CCmasktmcurve) { + toEdit.locallab.spots.at(i).CCmasktmcurve = mods.locallab.spots.at(i).CCmasktmcurve; + } + + if (locallab.spots.at(i).LLmasktmcurve) { + toEdit.locallab.spots.at(i).LLmasktmcurve = mods.locallab.spots.at(i).LLmasktmcurve; + } + + if (locallab.spots.at(i).HHmasktmcurve) { + toEdit.locallab.spots.at(i).HHmasktmcurve = mods.locallab.spots.at(i).HHmasktmcurve; + } + + if (locallab.spots.at(i).enatmMask) { + toEdit.locallab.spots.at(i).enatmMask = mods.locallab.spots.at(i).enatmMask; + } + + if (locallab.spots.at(i).blendmasktm) { + toEdit.locallab.spots.at(i).blendmasktm = mods.locallab.spots.at(i).blendmasktm; + } + + if (locallab.spots.at(i).radmasktm) { + toEdit.locallab.spots.at(i).radmasktm = mods.locallab.spots.at(i).radmasktm; + } + + if (locallab.spots.at(i).chromasktm) { + toEdit.locallab.spots.at(i).chromasktm = mods.locallab.spots.at(i).chromasktm; + } + + if (locallab.spots.at(i).gammasktm) { + toEdit.locallab.spots.at(i).gammasktm = mods.locallab.spots.at(i).gammasktm; + } + + if (locallab.spots.at(i).slomasktm) { + toEdit.locallab.spots.at(i).slomasktm = mods.locallab.spots.at(i).slomasktm; + } + // Retinex if (locallab.spots.at(i).expreti) { toEdit.locallab.spots.at(i).expreti = mods.locallab.spots.at(i).expreti; @@ -4508,6 +4553,15 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : softradiustm(v), amount(v), equiltm(v), + CCmasktmcurve(v), + LLmasktmcurve(v), + HHmasktmcurve(v), + enatmMask(v), + blendmasktm(v), + radmasktm(v), + chromasktm(v), + gammasktm(v), + slomasktm(v), // Retinex expreti(v), retinexMethod(v), @@ -4729,6 +4783,15 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) softradiustm = v; amount = v; equiltm = v; + CCmasktmcurve = v; + LLmasktmcurve = v; + HHmasktmcurve = v; + enatmMask = v; + blendmasktm = v; + radmasktm = v; + chromasktm = v; + gammasktm = v; + slomasktm = v; // Retinex expreti = v; retinexMethod = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index af89f45da..e5dbfce78 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -491,6 +491,15 @@ public: bool softradiustm; bool amount; bool equiltm; + bool CCmasktmcurve; + bool LLmasktmcurve; + bool HHmasktmcurve; + bool enatmMask; + bool blendmasktm; + bool radmasktm; + bool chromasktm; + bool gammasktm; + bool slomasktm; // Retinex bool expreti; bool retinexMethod; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 86abcd009..d92a069d9 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -474,9 +474,9 @@ void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const } // Manage Locallab mask visibility - if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod ) { + if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod || event == rtengine::EvlocallabshowmasktmMethod) { Locallab::llMaskVisibility* maskStruc = locallab->getMaskVisibility(); - ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask); + ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask, maskStruc->tmMask); } ipc->endUpdateParams(changeFlags); // starts the IPC processing @@ -584,7 +584,7 @@ void ToolPanelCoordinator::profileChange( // Reset Locallab mask visibility when a picture is loaded if (event == rtengine::EvPhotoLoaded) { locallab->resetMaskVisibility(); - ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0); + ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0, 0); } // start the IPC processing