diff --git a/rtengine/curves.cc b/rtengine/curves.cc index fef80121c..19ba12505 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1571,6 +1571,101 @@ void LocretigainCurverab::Set(const std::vector &curvePoints) } +LocCCmaskCurve::LocCCmaskCurve() : sum(0.f) {}; + +void LocCCmaskCurve::Reset() +{ + lutLocCCmaskCurve.reset(); + sum = 0.f; +} + +void LocCCmaskCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocCCmaskCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocCCmaskCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocCCmaskCurve[i] < 0.02f) { + lutLocCCmaskCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocCCmaskCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocCCmaskCurve::Set(const std::vector &curvePoints, bool &HHutili) +{ + // 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.); + Set(ttcurve); + HHutili = true; + } else { + Reset(); + } +} + +LocLLmaskCurve::LocLLmaskCurve() : sum(0.f) {}; + +void LocLLmaskCurve::Reset() +{ + lutLocLLmaskCurve.reset(); + sum = 0.f; +} + +void LocLLmaskCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocLLmaskCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocLLmaskCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocLLmaskCurve[i] < 0.02f) { + lutLocLLmaskCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocLLmaskCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocLLmaskCurve::Set(const std::vector &curvePoints, bool &HHutili) +{ + // 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.); + Set(ttcurve); + HHutili = true; + } else { + Reset(); + } +} + + + + LocHHCurve::LocHHCurve() : sum(0.f) {}; void LocHHCurve::Reset() diff --git a/rtengine/curves.h b/rtengine/curves.h index 5c8f920e6..a9dc685bb 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -632,6 +632,63 @@ public: } }; +class LocCCmaskCurve +{ +private: + LUTf lutLocCCmaskCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocCCmaskCurve() {}; + LocCCmaskCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool &HHutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocCCmaskCurve[index]; + } + operator bool (void) const + { + return lutLocCCmaskCurve; + } +}; + +class LocLLmaskCurve +{ +private: + LUTf lutLocLLmaskCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocLLmaskCurve() {}; + LocLLmaskCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool &HHutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocLLmaskCurve[index]; + } + operator bool (void) const + { + return lutLocLLmaskCurve; + } +}; + + class LocHHCurve { private: diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 2c22157be..dc15702e6 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -895,12 +895,15 @@ void Crop::update(int todo) LUTu lhist16loc2(32770, 0); bool LHutili = parent->LHutili; bool HHutili = parent->HHutili; - + bool CCmaskutili = parent->CCmaskutili; + bool LLmaskutili = parent->LLmaskutili; LUTu dummy; bool needslocal = params.locallab.enabled; LocretigainCurve locRETgainCurve; LocLHCurve loclhCurve; LocHHCurve lochhCurve; + LocCCmaskCurve locccmasCurve; + LocLLmaskCurve locllmasCurve; LocretigainCurverab locRETgainCurverab; locallutili = false; @@ -914,6 +917,8 @@ void Crop::update(int todo) locRETgainCurve.Set(params.locallab.spots.at(sp).localTgaincurve); loclhCurve.Set(params.locallab.spots.at(sp).LHcurve, LHutili); lochhCurve.Set(params.locallab.spots.at(sp).HHcurve, HHutili); + locccmasCurve.Set(params.locallab.spots.at(sp).CCmaskcurve, CCmaskutili); + locllmasCurve.Set(params.locallab.spots.at(sp).LLmaskcurve, LLmaskutili); locallutili = false; CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve2, sca); localcutili = false; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 3a6982ca3..de8bb8c74 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -771,6 +771,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float **shbuffer = nullptr; int sca = 1; + double huere, chromare, lumare, huerefblu, sobelre; for (int sp = 0; sp < params.locallab.nbspot && sp < (int)params.locallab.spots.size(); sp++) { // Set local curves of current spot to LUT @@ -780,9 +781,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) localexutili = false; localcutili = false; localskutili = false; + CCmaskutili = false; + LLmaskutili = false; locRETgainCurve.Set(params.locallab.spots.at(sp).localTgaincurve); loclhCurve.Set(params.locallab.spots.at(sp).LHcurve, LHutili); lochhCurve.Set(params.locallab.spots.at(sp).HHcurve, HHutili); + locccmasCurve.Set(params.locallab.spots.at(sp).CCmaskcurve, CCmaskutili); + locllmasCurve.Set(params.locallab.spots.at(sp).LLmaskcurve, LLmaskutili); CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve, sca); CurveFactory::curveCCLocal(localcutili, params.locallab.spots.at(sp).cccurve, cclocalcurve, sca); CurveFactory::curveskLocal(localskutili, params.locallab.spots.at(sp).skintonescurve, sklocalcurve, sca); @@ -798,14 +803,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Reference parameters computation - double huere, chromare, lumare, huerefblu, sobelre; - if (params.locallab.spots.at(sp).spotMethod == "exc") { ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); } else { ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); } - CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lhist16loc, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, sca); @@ -816,7 +818,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) lumar = lumarefs[sp] = lumare ; sobeler = sobelrefs[sp] = sobelre; - printf("huerblu=%f, huer=%f, chromar=%f, lumar=%f, sobeler=%f\n", huerblu, huer, chromar, lumar, sobeler); + //printf("sp=%i huerblu=%f, huer=%f, chromar=%f, lumar=%f, sobeler=%f\n", sp, huerblu, huer, chromar, lumar, sobeler); // Locallab tools computation /* Notes: @@ -826,12 +828,31 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.Lab_Local(3, sp, sobelrefs, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, huer, chromar, lumar, sobeler); + if (params.locallab.spots.at(sp).spotMethod == "exc") { + ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); + } else { + ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); + } + // Clear local curves lllocalcurve.clear(); cclocalcurve.clear(); sklocalcurve.clear(); exlocalcurve.clear(); } + for (int sp = 0; sp < params.locallab.nbspot && sp < (int)params.locallab.spots.size(); sp++) { + //update references after threatment + if (params.locallab.spots.at(sp).spotMethod == "exc") { + ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); + } else { + ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre, lhist16loc); + } + huerblu = huerefblurs[sp] = huerefblu; + huer = huerefs[sp] = huere; + chromar = chromarefs[sp] = chromare; + lumar = lumarefs[sp] = lumare ; + sobeler = sobelrefs[sp] = sobelre; + } } //************************************************************* diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 45d9862aa..ffa481487 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -234,6 +234,8 @@ protected: LocretigainCurverab locRETgainCurverab; LocLHCurve loclhCurve; LocHHCurve lochhCurve; + LocCCmaskCurve locccmasCurve; + LocLLmaskCurve locllmasCurve; ProcParams nextParams2; bool locallutili; bool localcutili; @@ -241,6 +243,8 @@ protected: bool localexutili; bool LHutili; bool HHutili; + bool CCmaskutili; + bool LLmaskutili; LUTf huerefs; LUTf huerefblurs; LUTf chromarefs; diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 09668b5ed..dd1bcbcda 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -6984,9 +6984,6 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform //always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise struct local_params lp; calcLocalParams(sp, oW, oH, params->locallab, lp); - int del = 3; - int bfh = int (lp.ly + lp.lyT) + del; //bfw bfh real size of square zone - int bfw = int (lp.lx + lp.lxL) + del; int begy = lp.yc - lp.lyT; int begx = lp.xc - lp.lxL; int yEn = lp.yc + lp.ly; @@ -7119,7 +7116,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform } //ref for sobel - bool toto = true; + bool toto = false; if (toto) { for (int y = max(cy, (int)(lp.yc - spotSise2)); y < min(transformed->H + cy, (int)(lp.yc + spotSise2 + 1)); y++) { @@ -7182,7 +7179,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform // printf("hueblur=%f hue=%f\n", huerefblur, hueref); chromaref = aveChro; lumaref = avL; - + //printf("Calcref => sp=%i huere=%f chromare=%f lumare=%f \n", sp, hueref, chromaref, lumaref); if (isdenoise) { delete origblur; delete blurorig; @@ -7535,7 +7532,6 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu float radiussob = strred / (sk * 1.4f); double ave = 0.; int n = 0; - float av = 0; int levred; bool noiscfactiv = false; @@ -7574,11 +7570,10 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu } ave = ave / n; - av = ave / 327.68f; } printf("call= %i sp=%i hueref=%f chromaref=%f lumaref=%f\n", call, sp, hueref, chromaref, lumaref); - struct local_contra lco; +// struct local_contra lco; // we must here detect : general case, skin, sky,...foliages ??? // delta dhue, luminance and chroma @@ -7614,17 +7609,6 @@ void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbu float moddE = 2.5f; float powdE = 6.f; - constexpr float maxh = 3.5f; // 3.5 amplification contrast above mean - - constexpr float maxl = 2.5f; // 3 reductio contrast under mean - - float multh = (float) fabs(lp.cont) * (maxh - 1.f) / 100.f + 1.f; - - float mult = (float)fabs(lp.cont) * (maxl - 1.f) / 100.f + 1.f; - - lco.dx = 1.f - 1.f / mult; - - lco.dy = 1.f - 1.f / multh; if (lp.excmet == 1 && call <= 3) { diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 11c70b076..ea9da6b97 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -631,8 +631,10 @@ enum ProcEventCode { Evlocallabsensisf = 601, Evlocallabsharblur = 602, EvLocenalabregion = 603, - EvlocallabshowmaskcolMethod = 604, - EvlocallabshowmaskexpMethod = 605, + EvlocallabshowmaskcolMethod = 604, + EvlocallabshowmaskexpMethod = 605, + EvlocallabCCmaskshape = 606, + EvlocallabLLmaskshape = 607, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 767bcb8a8..de5450d6f 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2368,6 +2368,9 @@ LocallabParams::LocallabSpot::LocallabSpot() : cccurve{(double)DCT_NURBS, 0.0, 0.0, 1.0, 1.0}, LHcurve{(double)FCT_MinMaxCPoints, 0.0, 0.50, 0.35, 0.35, 0.166, 0.50, 0.35, 0.35, 0.333, 0.50, 0.35, 0.35, 0.50, 0.50, 0.35, 0.35, 0.666, 0.50, 0.35, 0.35, 0.833, 0.50, 0.35, 0.35}, HHcurve{(double)FCT_MinMaxCPoints, 0.0, 0.50, 0.35, 0.35, 0.166, 0.50, 0.35, 0.35, 0.333, 0.50, 0.35, 0.35, 0.50, 0.50, 0.35, 0.35, 0.666, 0.50, 0.35, 0.35, 0.833, 0.50, 0.35, 0.35}, + CCmaskcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, + LLmaskcurve{(double)FCT_MinMaxCPoints, 0., 1., 0.35, 0.35, 1., 1., 0.35, 0.35}, + invers(false), // Exposure expexpose(false), @@ -2498,6 +2501,8 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && cccurve == other.cccurve && LHcurve == other.LHcurve && HHcurve == other.HHcurve + && CCmaskcurve == other.CCmaskcurve + && LLmaskcurve == other.LLmaskcurve && invers == other.invers // Exposure && expexpose == other.expexpose @@ -3581,6 +3586,8 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).cccurve, "Locallab", "CCCurve_" + std::to_string(i), spot.cccurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LHcurve, "Locallab", "LHCurve_" + std::to_string(i), spot.LHcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHcurve, "Locallab", "HHCurve_" + std::to_string(i), spot.HHcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskcurve, "Locallab", "CCmaskCurve_" + std::to_string(i), spot.CCmaskcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskcurve, "Locallab", "LLmaskCurve_" + std::to_string(i), spot.LLmaskcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).invers, "Locallab", "Invers_" + std::to_string(i), spot.invers, keyFile); // Exposure saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expexpose, "Locallab", "Expexpose_" + std::to_string(i), spot.expexpose, keyFile); @@ -4791,6 +4798,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "CCCurve_" + std::to_string(i), pedited, spot.cccurve, spotEdited.cccurve); assignFromKeyfile(keyFile, "Locallab", "LHCurve_" + std::to_string(i), pedited, spot.LHcurve, spotEdited.LHcurve); assignFromKeyfile(keyFile, "Locallab", "HHCurve_" + std::to_string(i), pedited, spot.HHcurve, spotEdited.HHcurve); + assignFromKeyfile(keyFile, "Locallab", "CCmaskCurve_" + std::to_string(i), pedited, spot.CCmaskcurve, spotEdited.CCmaskcurve); + assignFromKeyfile(keyFile, "Locallab", "LLmaskCurve_" + std::to_string(i), pedited, spot.LLmaskcurve, spotEdited.LLmaskcurve); assignFromKeyfile(keyFile, "Locallab", "Invers_" + std::to_string(i), pedited, spot.invers, spotEdited.invers); // Exposure assignFromKeyfile(keyFile, "Locallab", "Expexpose_" + std::to_string(i), pedited, spot.expexpose, spotEdited.expexpose); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 690c59d6d..7a1d4158f 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -962,6 +962,8 @@ struct LocallabParams { std::vector cccurve; std::vector LHcurve; std::vector HHcurve; + std::vector CCmaskcurve; + std::vector LLmaskcurve; bool invers; // Exposure bool expexpose; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index b23e8f0aa..50846958d 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -632,7 +632,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabsharblur LUMINANCECURVE, //EvLocenalabregion LUMINANCECURVE, //EvlocallabshowmaskcolMethod - LUMINANCECURVE //EvlocallabshowmaskexpMethod + LUMINANCECURVE, //EvlocallabshowmaskexpMethod + LUMINANCECURVE, //EvlocallabCCmaskshape + LUMINANCECURVE //EvlocallabLLmaskshape }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 7f7bf0401..2fa12d8fd 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1074,6 +1074,8 @@ private: LocretigainCurve locRETgainCurve; LocLHCurve loclhCurve; LocHHCurve lochhCurve; + LocCCmaskCurve locccmasCurve; + LocLLmaskCurve locllmasCurve; LUTf lllocalcurve(65536, 0); LUTf cclocalcurve(65536, 0); LUTf sklocalcurve(65536, 0); @@ -1099,6 +1101,8 @@ private: // Set local curves of current spot to LUT bool LHutili = false; bool HHutili = false; + bool CCmaskutili = false; + bool LLmaskutili = false; bool locallutili = false; bool localcutili = false; bool localskutili = false; @@ -1106,6 +1110,8 @@ private: locRETgainCurve.Set(params.locallab.spots.at(sp).localTgaincurve); loclhCurve.Set(params.locallab.spots.at(sp).LHcurve, LHutili); lochhCurve.Set(params.locallab.spots.at(sp).HHcurve, HHutili); + locccmasCurve.Set(params.locallab.spots.at(sp).CCmaskcurve, CCmaskutili); + locllmasCurve.Set(params.locallab.spots.at(sp).LLmaskcurve, LLmaskutili); CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve, 1); CurveFactory::curveCCLocal(localcutili, params.locallab.spots.at(sp).cccurve, cclocalcurve, 1); CurveFactory::curveskLocal(localskutili, params.locallab.spots.at(sp).skintonescurve, sklocalcurve, 1); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index fe6bc5217..94145cdf1 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -61,6 +61,7 @@ Locallab::Locallab(): // CurveEditorGroup widgets // Color & Light llCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_LUM"))), + maskCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), // Exposure curveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_CURVEEDITOR_TONES_LABEL"))), // Vibrance @@ -281,9 +282,24 @@ Locallab::Locallab(): HHshape->setBottomBarBgGradient(mHHshape); llCurveEditorG->curveListComplete(); + maskCurveEditorG->setCurveListener(this); inversConn = invers->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversChanged)); + CCmaskshape = static_cast(maskCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false)); + CCmaskshape->setIdentityValue(0.); + CCmaskshape->setResetCurve(FlatCurveType(defSpot.CCmaskcurve.at(0)), defSpot.CCmaskcurve); + CCmaskshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + CCmaskshape->setBottomBarColorProvider(this, 7); + + LLmaskshape = static_cast(maskCurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false)); + LLmaskshape->setIdentityValue(0.); + LLmaskshape->setResetCurve(FlatCurveType(defSpot.CCmaskcurve.at(0)), defSpot.CCmaskcurve); + LLmaskshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + LLmaskshape->setBottomBarBgGradient(mllshape); + + maskCurveEditorG->curveListComplete(); + ToolParamBlock* const colorBox = Gtk::manage(new ToolParamBlock()); Gtk::Frame* const superFrame = Gtk::manage(new Gtk::Frame()); superFrame->set_label_align(0.025, 0.5); @@ -305,6 +321,7 @@ Locallab::Locallab(): maskcolFrame->set_label_align(0.025, 0.5); ToolParamBlock* const maskcolBox = Gtk::manage(new ToolParamBlock()); maskcolBox->pack_start(*showmaskcolMethod, Gtk::PACK_SHRINK, 0); +// maskcolBox->pack_start(*maskCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor maskcolFrame->add(*maskcolBox); colorBox->pack_start(*maskcolFrame); @@ -1380,6 +1397,8 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).cccurve = ccshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).LHcurve = LHshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).HHcurve = HHshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).CCmaskcurve = CCmaskshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).LLmaskcurve = LLmaskshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).invers = invers->get_active(); // Exposure pp->locallab.spots.at(pp->locallab.selspot).expexpose = expexpose->getEnabled(); @@ -1533,6 +1552,8 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).cccurve = pe->locallab.spots.at(pp->locallab.selspot).cccurve || !ccshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).LHcurve = pe->locallab.spots.at(pp->locallab.selspot).LHcurve || !LHshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).HHcurve = pe->locallab.spots.at(pp->locallab.selspot).HHcurve || !HHshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).CCmaskcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskcurve || !CCmaskshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).LLmaskcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskcurve || !LLmaskshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).invers = pe->locallab.spots.at(pp->locallab.selspot).invers || !invers->get_inconsistent(); // Exposure pe->locallab.spots.at(pp->locallab.selspot).expexpose = pe->locallab.spots.at(pp->locallab.selspot).expexpose || !expexpose->get_inconsistent(); @@ -1668,6 +1689,8 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).cccurve = pedited->locallab.spots.at(pp->locallab.selspot).cccurve || !ccshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).LHcurve = pedited->locallab.spots.at(pp->locallab.selspot).LHcurve || !LHshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).HHcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHcurve || !HHshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).CCmaskcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskcurve || !CCmaskshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).LLmaskcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskcurve || !LLmaskshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).invers = pedited->locallab.spots.at(pp->locallab.selspot).invers || !invers->get_inconsistent(); // Exposure pedited->locallab.spots.at(pp->locallab.selspot).expexpose = pedited->locallab.spots.at(pp->locallab.selspot).expexpose || !expexpose->get_inconsistent(); @@ -1889,6 +1912,19 @@ void Locallab::curveChanged(CurveEditor* ce) listener->panelChanged(EvlocallabHHshape, M("HISTORY_CUSTOMCURVE")); } } + + if (ce == CCmaskshape) { + if (listener) { + listener->panelChanged(EvlocallabCCmaskshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == LLmaskshape) { + if (listener) { + listener->panelChanged(EvlocallabLLmaskshape, M("HISTORY_CUSTOMCURVE")); + } + } + } // Exposure @@ -3141,6 +3177,17 @@ void Locallab::colorForValue(double valX, double valY, enum ColorCaller::ElemTyp } Color::hsv2rgb01(h, 0.5f, 0.5f, R, G, B); + } else if (callerId == 6) { + // TODO + float x = valX - 1.f/6.f; + if (x < 0.f) { + x += 1.f; + } + x = log2lin(x, 3.f); + // float x = valX; + Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); + } else if (callerId == 7) { + Color::hsv2rgb01(float(valY), float(valX), 0.5f, R, G, B); } caller->ccRed = double (R); @@ -3281,6 +3328,8 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con ccshape->setCurve(pp->locallab.spots.at(index).cccurve); LHshape->setCurve(pp->locallab.spots.at(index).LHcurve); HHshape->setCurve(pp->locallab.spots.at(index).HHcurve); + CCmaskshape->setCurve(pp->locallab.spots.at(index).CCmaskcurve); + LLmaskshape->setCurve(pp->locallab.spots.at(index).LLmaskcurve); invers->set_active(pp->locallab.spots.at(index).invers); // Exposure @@ -3462,6 +3511,8 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con ccshape->setUnChanged(!spotState->cccurve); LHshape->setUnChanged(!spotState->LHcurve); HHshape->setUnChanged(!spotState->HHcurve); + CCmaskshape->setUnChanged(!spotState->CCmaskcurve); + LLmaskshape->setUnChanged(!spotState->LLmaskcurve); invers->set_inconsistent(multiImage && !spotState->invers); // Exposure @@ -3691,4 +3742,7 @@ void Locallab::autoOpenCurve() ccshape->openIfNonlinear(); LHshape->openIfNonlinear(); HHshape->openIfNonlinear(); + CCmaskshape->openIfNonlinear(); + LLmaskshape->openIfNonlinear(); + } diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 0673f9874..d7d0c84e1 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -61,10 +61,14 @@ private: // Curve widgets // Color & Light CurveEditorGroup* const llCurveEditorG; + CurveEditorGroup* const maskCurveEditorG; DiagonalCurveEditor* llshape; DiagonalCurveEditor* ccshape; FlatCurveEditor* LHshape; FlatCurveEditor* HHshape; + FlatCurveEditor* CCmaskshape; + FlatCurveEditor* LLmaskshape; + // Exposure CurveEditorGroup* const curveEditorG; DiagonalCurveEditor* shapeexpos; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index dbb741b36..de8c81fd7 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -954,6 +954,8 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).cccurve = locallab.spots.at(j).cccurve && pSpot.cccurve == otherSpot.cccurve; locallab.spots.at(j).LHcurve = locallab.spots.at(j).LHcurve && pSpot.LHcurve == otherSpot.LHcurve; locallab.spots.at(j).HHcurve = locallab.spots.at(j).HHcurve && pSpot.HHcurve == otherSpot.HHcurve; + locallab.spots.at(j).CCmaskcurve = locallab.spots.at(j).CCmaskcurve && pSpot.CCmaskcurve == otherSpot.CCmaskcurve; + locallab.spots.at(j).LLmaskcurve = locallab.spots.at(j).LLmaskcurve && pSpot.LLmaskcurve == otherSpot.LLmaskcurve; locallab.spots.at(j).invers = locallab.spots.at(j).invers && pSpot.invers == otherSpot.invers; // Exposure locallab.spots.at(j).expexpose = locallab.spots.at(j).expexpose && pSpot.expexpose == otherSpot.expexpose; @@ -2594,6 +2596,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).HHcurve = mods.locallab.spots.at(i).HHcurve; } + if (locallab.spots.at(i).CCmaskcurve) { + toEdit.locallab.spots.at(i).CCmaskcurve = mods.locallab.spots.at(i).CCmaskcurve; + } + + if (locallab.spots.at(i).LLmaskcurve) { + toEdit.locallab.spots.at(i).LLmaskcurve = mods.locallab.spots.at(i).LLmaskcurve; + } + if (locallab.spots.at(i).invers) { toEdit.locallab.spots.at(i).invers = mods.locallab.spots.at(i).invers; } @@ -3896,6 +3906,8 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : cccurve(v), LHcurve(v), HHcurve(v), + CCmaskcurve(v), + LLmaskcurve(v), invers(v), // Exposure expexpose(v), @@ -4023,6 +4035,8 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) cccurve = v; LHcurve = v; HHcurve = v; + CCmaskcurve = v; + LLmaskcurve = v; invers = v; // Exposure expexpose = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 2500a75b2..79f638887 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -493,6 +493,8 @@ public: bool cccurve; bool LHcurve; bool HHcurve; + bool CCmaskcurve; + bool LLmaskcurve; bool invers; // Exposure bool expexpose;