From 4756e5184cbde0b362484d25e2196088c8bf22be Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 12 Mar 2019 08:56:40 +0100 Subject: [PATCH] Add inverse to Shadows Highlight --- rtdata/languages/default | 1 + rtengine/improccoordinator.cc | 224 ++++++++++++-------- rtengine/improccoordinator.h | 5 +- rtengine/iplocallab.cc | 40 +++- rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 + rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 +- rtgui/locallab.cc | 77 +++++++ rtgui/locallab.h | 3 + rtgui/paramsedited.cc | 9 +- rtgui/paramsedited.h | 380 ++++++++++------------------------ 12 files changed, 376 insertions(+), 372 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 38e70aab1..34fab44a9 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -894,6 +894,7 @@ HISTORY_MSG_640;Local - SH blend HISTORY_MSG_641;Local - Use SH mask HISTORY_MSG_642;Local - radius SH HISTORY_MSG_643;Local - Blur SH +HISTORY_MSG_644;Local - inverse SH HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index aeb91ce3f..3fe3a58c8 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -43,92 +43,147 @@ namespace rtengine extern const Settings* settings; ImProcCoordinator::ImProcCoordinator() - : orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), - ncie (nullptr), imgsrc (nullptr), lastAwbEqual (0.), lastAwbTempBias (0.0), ipf (¶ms, true), monitorIntent (RI_RELATIVE), - softProof(false), gamutCheck(false), sharpMask(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false), - allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), + : orig_prev(nullptr), + oprevi(nullptr), + oprevl(nullptr), + nprevl(nullptr), + fattal_11_dcrop_cache(nullptr), + previmg(nullptr), + workimg(nullptr), + ncie (nullptr), + imgsrc (nullptr), + lastAwbEqual (0.), + lastAwbTempBias (0.0), + ipf (¶ms, true), + monitorIntent (RI_RELATIVE), + softProof(false), + gamutCheck(false), + sharpMask(false), + scale(10), + highDetailPreprocessComputed(false), + highDetailRawComputed(false), + allocated(false), + bwAutoR(-9000.f), + bwAutoG(-9000.f), + bwAutoB(-9000.f), + CAMMean(NAN), - hltonecurve(65536), - shtonecurve(65536), - tonecurve(65536, 0), //,1); - lumacurve(32770, 0), // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation - chroma_acurve(65536, 0), - chroma_bcurve(65536, 0), - satcurve(65536, 0), - lhskcurve(65536, 0), - clcurve(65536, 0), - conversionBuffer(1, 1), - wavclCurve(65536, 0), - clToningcurve(65536, 0), - cl2Toningcurve(65536, 0), - Noisecurve(65536, 0), - NoiseCCcurve(65536, 0), - vhist16(65536), vhist16bw(65536), - lhist16CAM(65536), - lhist16CCAM(65536), - lhist16RETI(), - lhist16LClad(65536), - histRed(256), histRedRaw(256), - histGreen(256), histGreenRaw(256), - histBlue(256), histBlueRaw(256), - histLuma(256), - histToneCurve(256), - histToneCurveBW(256), - histLCurve(256), - histCCurve(256), - histLLCurve(256), - histLCAM(256), - histCCAM(256), - histClad(256), - bcabhist(256), - histChroma(256), - histLRETI(256), - CAMBrightCurveJ(), CAMBrightCurveQ(), - rCurve(), - gCurve(), - bCurve(), - ctColorCurve(), - rcurvehist(256), rcurvehistCropped(256), rbeforehist(256), - gcurvehist(256), gcurvehistCropped(256), gbeforehist(256), - bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), - fw(0), fh(0), tr(0), - fullw(1), fullh(1), - pW(-1), pH(-1), - plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), flatFieldAutoClipListener(nullptr), bayerAutoContrastListener(nullptr), xtransAutoContrastListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), locallListener(nullptr), hListener(nullptr), - resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), - butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), wavcontlutili(false), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), highQualityComputed(false), customTransformIn(nullptr), customTransformOut(nullptr), + hltonecurve(65536), + shtonecurve(65536), + tonecurve(65536, 0), //,1); + lumacurve(32770, 0), // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation + chroma_acurve(65536, 0), + chroma_bcurve(65536, 0), + satcurve(65536, 0), + lhskcurve(65536, 0), + clcurve(65536, 0), + conversionBuffer(1, 1), + wavclCurve(65536, 0), + clToningcurve(65536, 0), + cl2Toningcurve(65536, 0), + Noisecurve(65536, 0), + NoiseCCcurve(65536, 0), + vhist16(65536), vhist16bw(65536), + lhist16CAM(65536), + lhist16CCAM(65536), + lhist16RETI(), + lhist16LClad(65536), + histRed(256), histRedRaw(256), + histGreen(256), histGreenRaw(256), + histBlue(256), histBlueRaw(256), + histLuma(256), + histToneCurve(256), + histToneCurveBW(256), + histLCurve(256), + histCCurve(256), + histLLCurve(256), + histLCAM(256), + histCCAM(256), + histClad(256), + bcabhist(256), + histChroma(256), + histLRETI(256), + CAMBrightCurveJ(), CAMBrightCurveQ(), + rCurve(), + gCurve(), + bCurve(), + ctColorCurve(), + rcurvehist(256), rcurvehistCropped(256), rbeforehist(256), + gcurvehist(256), gcurvehistCropped(256), gbeforehist(256), + bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), + fw(0), fh(0), tr(0), + fullw(1), fullh(1), + pW(-1), pH(-1), + plistener(nullptr), + imageListener(nullptr), + aeListener(nullptr), + acListener(nullptr), + abwListener(nullptr), + awbListener(nullptr), + flatFieldAutoClipListener(nullptr), + bayerAutoContrastListener(nullptr), + xtransAutoContrastListener(nullptr), + frameCountListener(nullptr), + imageTypeListener(nullptr), + actListener(nullptr), + adnListener(nullptr), + awavListener(nullptr), + dehaListener(nullptr), + hListener(nullptr), + resultValid(false), + lastOutputProfile("BADFOOD"), + lastOutputIntent(RI__COUNT), + lastOutputBPC(false), + thread(nullptr), + changeSinceLast(0), + updaterRunning(false), + destroying(false), + utili(false), + autili(false), + butili(false), + ccutili(false), + cclutili(false), + clcutili(false), + opautili(false), + wavcontlutili(false), + colourToningSatLimit(0.f), + colourToningSatLimitOpacity(0.f), + highQualityComputed(false), + customTransformIn(nullptr), + customTransformOut(nullptr), //locallab - reserv(nullptr), - coordX(0), coordY(0), localX(0), localY(0), - lllocalcurve(65536, 0), - cclocalcurve(65536, 0), - sklocalcurve(65536, 0), - exlocalcurve(65536, 0), - hltonecurveloc(65536, 0), //32768 - shtonecurveloc(65536, 0), - tonecurveloc(65536, 0), - lightCurveloc(32770, 0), - locallutili(false), localcutili(false), localskutili(false), localexutili(false), LHutili(false), HHutili(false), - huerefs(500, -100000.f), - huerefblurs(500, -100000.f), - chromarefblurs(500, -100000.f), - lumarefblurs(500, -100000.f), - chromarefs(500, -100000.f), - lumarefs(500, -100000.f), - sobelrefs(500, -100000.f), - huer(0), - huerblu(0), - chromarblu(0), - lumarblu(0), - chromar(0), - lumar(0), - sobeler(0), - lastspotdup(false), - locallColorMask(0), - locallExpMask(0), - locallSHMask(0), - avg(0), - retistrsav(nullptr) + locallListener(nullptr), + reserv(nullptr), + coordX(0), coordY(0), localX(0), localY(0), + lllocalcurve(65536, 0), + cclocalcurve(65536, 0), + sklocalcurve(65536, 0), + exlocalcurve(65536, 0), + hltonecurveloc(65536, 0), //32768 + shtonecurveloc(65536, 0), + tonecurveloc(65536, 0), + lightCurveloc(32770, 0), + locallutili(false), localcutili(false), localskutili(false), localexutili(false), LHutili(false), HHutili(false), + huerefs(500, -100000.f), + huerefblurs(500, -100000.f), + chromarefblurs(500, -100000.f), + lumarefblurs(500, -100000.f), + chromarefs(500, -100000.f), + lumarefs(500, -100000.f), + sobelrefs(500, -100000.f), + huer(0), + huerblu(0), + chromarblu(0), + lumarblu(0), + chromar(0), + lumar(0), + sobeler(0), + lastspotdup(false), + locallColorMask(0), + locallExpMask(0), + locallSHMask(0), + avg(0), + retistrsav(nullptr) {} void ImProcCoordinator::assign(ImageSource* imgsrc) @@ -1605,7 +1660,6 @@ void ImProcCoordinator::process() || params.labCurve != nextParams.labCurve || params.localContrast != nextParams.localContrast || params.locallab != nextParams.locallab - || params.rgbCurves != nextParams.rgbCurves || params.colorToning != nextParams.colorToning || params.vibrance != nextParams.vibrance diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 9059be851..26e098591 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -167,7 +167,7 @@ protected: AutoChromaListener* adnListener; WaveletListener* awavListener; RetinexListener* dehaListener; - LocallabListener* locallListener; +// LocallabListener* locallListener; HistogramListener* hListener; @@ -220,6 +220,7 @@ protected: cmsHTRANSFORM customTransformOut; //locallab + LocallabListener* locallListener; LabImage *reserv; int coordX, coordY, localX, localY; LUTf lllocalcurve; @@ -244,7 +245,7 @@ protected: LocCCmaskSHCurve locccmasSHCurve; LocLLmaskSHCurve locllmasSHCurve; LocHHmaskSHCurve lochhmasSHCurve; - ProcParams nextParams2; +// ProcParams nextParams2; bool locallutili; bool localcutili; bool localskutili; diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 010ee7732..6ccf1386a 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -167,6 +167,7 @@ struct local_params { int dehaze; bool inv; bool invex; + bool invsh; bool curvact; bool invrad; bool invret; @@ -503,6 +504,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall bool cupas = false; // Provision int local_sensisf = locallab.spots.at(sp).sensisf; bool inverseex = locallab.spots.at(sp).inversex; + bool inversesh = locallab.spots.at(sp).inverssh; bool inverserad = false; // Provision bool inverseret = locallab.spots.at(sp).inversret; @@ -571,6 +573,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.lcamount = lcamount; lp.inv = inverse; lp.invex = inverseex; + lp.invsh = inversesh; lp.curvact = curvacti; lp.invrad = inverserad; lp.invret = inverseret; @@ -3964,6 +3967,10 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct varsens = lp.sensex; } + if (senstype == 2) { //shadows highlight + varsens = lp.senshs; + } + LabImage *temp = nullptr; LabImage *tempCL = nullptr; @@ -3971,6 +3978,18 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct int GH = transformed->H; float refa = chromaref * cos(hueref); float refb = chromaref * sin(hueref); + if (senstype == 2) { // Shadows highlight + temp = new LabImage(GW, GH); + for (int y = 0; y < transformed->H; y++) { + for (int x = 0; x < transformed->W; x++) { + temp->L[y][x] = original->L[y][x]; + temp->a[y][x] = original->a[y][x]; + temp->b[y][x] = original->b[y][x]; + } + } + + ImProcFunctions::shadowsHighlights(temp, lp.hsena, 1, lp.highlihs, lp.shadowhs, lp.radiushs, sk, lp.hltonalhs, lp.shtonalhs); + } if (senstype == 1) { //exposure temp = new LabImage(GW, GH); @@ -4093,6 +4112,9 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct radius = (2.f + 0.2f * lp.blurcol) / sk; } + if (senstype == 2) { + radius = (2.f + 0.2f * lp.blurSH) / sk; + } #ifdef _OPENMP #pragma omp parallel @@ -4280,7 +4302,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct } - } else if (senstype == 1) { + } else if (senstype == 1 || senstype == 2) { diflc = (temp->L[y][x] - original->L[y][x]) * reducdE; diflc *= factorx; difa = (temp->a[y][x] - original->a[y][x]) * reducdE; @@ -4291,7 +4313,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct transformed->a[y][x] = CLIPC(original->a[y][x] + difa) ; transformed->b[y][x] = CLIPC(original->b[y][x] + difb); - } + } break; } @@ -4356,15 +4378,14 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct transformed->b[y][x] = CLIPC(original->b[y][x] * facc * facCb); } - } else if (senstype == 1) { - + } else if (senstype == 1 || senstype == 2) { diflc = (temp->L[y][x] - original->L[y][x]) * reducdE; difa = (temp->a[y][x] - original->a[y][x]) * reducdE; difb = (temp->b[y][x] - original->b[y][x]) * reducdE; transformed->L[y][x] = CLIP(original->L[y][x] + diflc); transformed->a[y][x] = CLIPC(original->a[y][x] + difa) ; transformed->b[y][x] = CLIPC(original->b[y][x] + difb); - } + } } } @@ -4376,7 +4397,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct } delete origblur; - if (senstype == 1) { + if (senstype == 1 || senstype ==2) { delete temp; } @@ -6704,7 +6725,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o //shadow highlight - if ((lp.highlihs > 0.f || lp.shadowhs > 0.f || lp.showmaskSHmet == 2 || lp.enaSHMask || lp.showmaskSHmet == 3) && call < 3 && lp.hsena) { + if (! lp.invsh && (lp.highlihs > 0.f || lp.shadowhs > 0.f || lp.showmaskSHmet == 2 || lp.enaSHMask || lp.showmaskSHmet == 3) && call < 3 && lp.hsena) { LabImage *bufexporig = nullptr; LabImage *bufexpfin = nullptr; LabImage *bufmaskorigSH = nullptr; @@ -6964,7 +6985,12 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } + } else if (lp.invsh && (lp.highlihs > 0.f || lp.shadowhs > 0.f) && call < 3 && lp.hsena) { + + float adjustr = 2.f; + InverseColorLight_Local(sp, 2, lp, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk); } + diff --git a/rtengine/procevents.h b/rtengine/procevents.h index bd30a0095..e6cba9b15 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -670,6 +670,7 @@ enum ProcEventCode { EvLocallabEnaSHMask = 640, EvlocallabradmaskSH = 641, EvlocallabblurSHde = 642, + Evlocallabinverssh = 643, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7fb78c4ba..1d3a9b200 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2419,6 +2419,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : blendmaskSH(0), radmaskSH(10.0), blurSHde(5), + inverssh(false), // Vibrance expvibrance(false), saturated(0), @@ -2585,6 +2586,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && blendmaskSH == other.blendmaskSH && radmaskSH == other.radmaskSH && blurSHde == other.blurSHde + && inverssh == other.inverssh // Vibrance && expvibrance == other.expvibrance && saturated == other.saturated @@ -3708,6 +3710,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskSH, "Locallab", "BlendmaskSH_" + std::to_string(i), spot.blendmaskSH, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskSH, "Locallab", "RadmaskSH_" + std::to_string(i), spot.radmaskSH, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurSHde, "Locallab", "BlurSHde_" + std::to_string(i), spot.blurSHde, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inverssh, "Locallab", "Inverssh_" + std::to_string(i), spot.inverssh, keyFile); // Vibrance saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expvibrance, "Locallab", "Expvibrance_" + std::to_string(i), spot.expvibrance, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).saturated, "Locallab", "Saturated_" + std::to_string(i), spot.saturated, keyFile); @@ -4959,6 +4962,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "BlendmaskSH_" + std::to_string(i), pedited, spot.blendmaskSH, spotEdited.blendmaskSH); assignFromKeyfile(keyFile, "Locallab", "RadmaskSH_" + std::to_string(i), pedited, spot.radmaskSH, spotEdited.radmaskSH); assignFromKeyfile(keyFile, "Locallab", "BlurSHde_" + std::to_string(i), pedited, spot.blurSHde, spotEdited.blurSHde); + assignFromKeyfile(keyFile, "Locallab", "Inverssh_" + std::to_string(i), pedited, spot.inverssh, spotEdited.inverssh); // Vibrance assignFromKeyfile(keyFile, "Locallab", "Expvibrance_" + std::to_string(i), pedited, spot.expvibrance, spotEdited.expvibrance); assignFromKeyfile(keyFile, "Locallab", "Saturated_" + std::to_string(i), pedited, spot.saturated, spotEdited.saturated); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 900b46961..aa9f0292d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1020,6 +1020,7 @@ struct LocallabParams { int blendmaskSH; double radmaskSH; int blurSHde; + bool inverssh; // Vibrance bool expvibrance; int saturated; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index a40061b72..dd4751434 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -669,7 +669,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvlocallabblendmaskSH LUMINANCECURVE, //EvLocallabEnaSHMask LUMINANCECURVE, //EvlocallabradmaskSH - LUMINANCECURVE //EvlocallabblurSHde + LUMINANCECURVE, //EvlocallabblurSHde + LUMINANCECURVE //Evlocallabinverssh }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 50faf7b02..b605c98f5 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -174,6 +174,7 @@ Locallab::Locallab(): inversex(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), //Shadows Highlight enaSHMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), + inverssh(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), // Vibrance protectSkins(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PROTECTSKINS")))), avoidColorShift(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_AVOIDCOLORSHIFT")))), @@ -531,6 +532,7 @@ Locallab::Locallab(): blurSHde->setAdjusterListener(this); enaSHMaskConn = enaSHMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaSHMaskChanged)); + inversshConn = inverssh->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversshChanged)); showmaskSHMethod->append(M("TP_LOCALLAB_SHOWMNONE")); showmaskSHMethod->append(M("TP_LOCALLAB_SHOWMODIF")); @@ -573,6 +575,8 @@ Locallab::Locallab(): shadhighBox->pack_start(*sh_radius); shadhighBox->pack_start(*sensihs); shadhighBox->pack_start(*blurSHde); + shadhighBox->pack_start(*inverssh); + maskSHFrame->set_label_align(0.025, 0.5); ToolParamBlock* const maskSHBox = Gtk::manage(new ToolParamBlock()); @@ -1709,6 +1713,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).blendmaskSH = blendmaskSH->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).radmaskSH = radmaskSH->getValue(); pp->locallab.spots.at(pp->locallab.selspot).blurSHde = blurSHde->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).inverssh = inverssh->get_active(); // Vibrance pp->locallab.spots.at(pp->locallab.selspot).expvibrance = expvibrance->getEnabled(); @@ -1892,6 +1897,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).blendmaskSH = pe->locallab.spots.at(pp->locallab.selspot).blendmaskSH || blendmaskSH->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).radmaskSH = pe->locallab.spots.at(pp->locallab.selspot).radmaskSH || radmaskSH->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).blurSHde = pe->locallab.spots.at(pp->locallab.selspot).blurSHde || blurSHde->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).inverssh = pe->locallab.spots.at(pp->locallab.selspot).inverssh || !inverssh->get_inconsistent(); // Vibrance pe->locallab.spots.at(pp->locallab.selspot).expvibrance = pe->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).saturated = pe->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); @@ -2060,6 +2066,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).blendmaskSH = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskSH || blendmaskSH->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).radmaskSH = pedited->locallab.spots.at(pp->locallab.selspot).radmaskSH || radmaskSH->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).blurSHde = pedited->locallab.spots.at(pp->locallab.selspot).blurSHde || blurSHde->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).inverssh = pedited->locallab.spots.at(pp->locallab.selspot).inverssh || !inverssh->get_inconsistent(); // Vibrance pedited->locallab.spots.at(pp->locallab.selspot).expvibrance = pedited->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).saturated = pedited->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState(); @@ -2669,6 +2676,53 @@ void Locallab::inversexChanged() } } +void Locallab::inversshChanged() +{ + // printf("inversChanged\n"); + + if (multiImage) { + if (inverssh->get_inconsistent()) { + inverssh->set_inconsistent(false); + inversshConn.block(true); + inverssh->set_active(false); + inversshConn.block(false); + } + } + + // Update Color & Light GUI according to invers button state (to be compliant with updateSpecificGUIState function) + if (multiImage && inverssh->get_inconsistent()) { + + sensihs->show(); + blurSHde->show(); + maskSHFrame->show(); + + showmaskSHMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode + } else if (inverssh->get_active()) { + sensihs->show(); + maskSHFrame->hide(); + blurSHde->show(); + + } else { + sensihs->show(); + maskSHFrame->show(); + blurSHde->show(); + + if (batchMode) { + showmaskSHMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode + } + } + + if (getEnabled() && expshadhigh->getEnabled()) { + if (listener) { + if (inverssh->get_active()) { + listener->panelChanged(Evlocallabinverssh, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallabinverssh, M("GENERAL_DISABLED")); + } + } + } +} + void Locallab::curvactivChanged() { // printf("curvactivChanged\n"); @@ -4015,6 +4069,7 @@ void Locallab::enableListener() enableshadhighConn.block(false); showmaskSHMethodConn.block(false); enaSHMaskConn.block(false); + inversshConn.block(false); // Vibrance enablevibranceConn.block(false); pskinsconn.block(false); @@ -4066,6 +4121,7 @@ void Locallab::disableListener() enableshadhighConn.block(true); showmaskSHMethodConn.block(true); enaSHMaskConn.block(true); + inversshConn.block(true); // Vibrance enablevibranceConn.block(true); pskinsconn.block(true); @@ -4173,6 +4229,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con blendmaskSH->setValue(pp->locallab.spots.at(index).blendmaskSH); radmaskSH->setValue(pp->locallab.spots.at(index).radmaskSH); blurSHde->setValue(pp->locallab.spots.at(index).blurSHde); + inverssh->set_active(pp->locallab.spots.at(index).inverssh); // Vibrance expvibrance->setEnabled(pp->locallab.spots.at(index).expvibrance); saturated->setValue(pp->locallab.spots.at(index).saturated); @@ -4384,6 +4441,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con blendmaskSH->setEditedState(spotState->blendmaskSH ? Edited : UnEdited); radmaskSH->setEditedState(spotState->radmaskSH ? Edited : UnEdited); blurSHde->setEditedState(spotState->blurSHde ? Edited : UnEdited); + inverssh->set_inconsistent(multiImage && !spotState->inverssh); // Vibrance expvibrance->set_inconsistent(!spotState->expvibrance); @@ -4557,6 +4615,25 @@ void Locallab::updateSpecificGUIState() } } + // Update SH GUI according to black adjuster state (to be compliant with adjusterChanged function) + if (multiImage && inversex->get_inconsistent()) { + sensihs->show(); + maskSHFrame->show(); + blurSHde->show(); + showmaskSHMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode + } else if (inverssh->get_active()) { + sensihs->show(); + maskSHFrame->hide(); + blurSHde->show(); + } else { + sensihs->show(); + maskSHFrame->show(); + blurSHde->show(); + + if (batchMode) { + showmaskSHMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode + } + } if (multiImage && black->getEditedState() != Edited) { diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 794d18ef3..f01af0f42 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -197,6 +197,8 @@ private: //Shadows highlight Gtk::CheckButton* const enaSHMask; sigc::connection enaSHMaskConn; + Gtk::CheckButton* const inverssh; + sigc::connection inversshConn; // Vibrance Gtk::CheckButton* const protectSkins; Gtk::CheckButton* const avoidColorShift; @@ -284,6 +286,7 @@ private: void inversexChanged(); //Shadows Highlight void enaSHMaskChanged(); + void inversshChanged(); // Vibrance void protectskins_toggled(); void avoidcolorshift_toggled(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 99b3119eb..518f694ce 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -982,7 +982,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).structexp = locallab.spots.at(j).structexp && pSpot.structexp == otherSpot.structexp; locallab.spots.at(j).blurexpde = locallab.spots.at(j).blurexpde && pSpot.blurexpde == otherSpot.blurexpde; locallab.spots.at(j).excurve = locallab.spots.at(j).excurve && pSpot.excurve == otherSpot.excurve; - locallab.spots.at(j).inversex = locallab.spots.at(j).inversex && pSpot.invers == otherSpot.inversex; + locallab.spots.at(j).inversex = locallab.spots.at(j).inversex && pSpot.inversex == otherSpot.inversex; locallab.spots.at(j).enaExpMask = locallab.spots.at(j).enaExpMask && pSpot.enaExpMask == otherSpot.enaExpMask; locallab.spots.at(j).CCmaskexpcurve = locallab.spots.at(j).CCmaskexpcurve && pSpot.CCmaskexpcurve == otherSpot.CCmaskexpcurve; locallab.spots.at(j).LLmaskexpcurve = locallab.spots.at(j).LLmaskexpcurve && pSpot.LLmaskexpcurve == otherSpot.LLmaskexpcurve; @@ -1004,6 +1004,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).blendmaskSH = locallab.spots.at(j).blendmaskSH && pSpot.blendmaskSH == otherSpot.blendmaskSH; locallab.spots.at(j).radmaskSH = locallab.spots.at(j).radmaskSH && pSpot.radmaskSH == otherSpot.radmaskSH; locallab.spots.at(j).blurSHde = locallab.spots.at(j).blurSHde && pSpot.blurSHde == otherSpot.blurSHde; + locallab.spots.at(j).inverssh = locallab.spots.at(j).inverssh && pSpot.inverssh == otherSpot.inverssh; // Vibrance locallab.spots.at(j).expvibrance = locallab.spots.at(j).expvibrance && pSpot.expvibrance == otherSpot.expvibrance; locallab.spots.at(j).saturated = locallab.spots.at(j).saturated && pSpot.saturated == otherSpot.saturated; @@ -2822,6 +2823,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).blurSHde = mods.locallab.spots.at(i).blurSHde; } + if (locallab.spots.at(i).inverssh) { + toEdit.locallab.spots.at(i).inverssh = mods.locallab.spots.at(i).inverssh; + } + // Vibrance if (locallab.spots.at(i).expvibrance) { toEdit.locallab.spots.at(i).expvibrance = mods.locallab.spots.at(i).expvibrance; @@ -4124,6 +4129,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : blendmaskSH(v), radmaskSH(v), blurSHde(v), + inverssh(v), // Vibrance expvibrance(v), saturated(v), @@ -4287,6 +4293,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) blendmaskSH = v; radmaskSH = v; blurSHde = v; + inverssh = v; // Vibrance expvibrance = v; saturated = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index ac2387087..2c699fe51 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -16,27 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PARAMEDITED_H_ -#define _PARAMEDITED_H_ +#pragma once -#include #include -#include "../rtengine/procparams.h" + #include "../rtengine/rtengine.h" -class GeneralParamsEdited -{ - -public: +struct GeneralParamsEdited { bool rank; bool colorlabel; bool intrash; }; -class ToneCurveParamsEdited -{ - -public: +struct ToneCurveParamsEdited { bool curve; bool curve2; bool curveMode; @@ -58,9 +50,7 @@ public: bool clampOOG; }; -class RetinexParamsEdited -{ -public: +struct RetinexParamsEdited { bool enabled; bool str; bool scal; @@ -90,19 +80,17 @@ public: bool lhcurve; bool retinex; bool medianmap; - bool isUnchanged() const; bool highlights; bool htonalwidth; bool shadows; bool stonalwidth; bool radius; + bool isUnchanged() const; }; -class LCurveParamsEdited -{ -public: +struct LCurveParamsEdited { bool enabled; bool brightness; bool contrast; @@ -122,9 +110,7 @@ public: }; -class LocalContrastParamsEdited -{ -public: +struct LocalContrastParamsEdited { bool enabled; bool radius; bool amount; @@ -132,11 +118,7 @@ public: bool lightness; }; - -class RGBCurvesParamsEdited -{ - -public: +struct RGBCurvesParamsEdited { bool enabled; bool lumamode; bool rcurve; @@ -144,10 +126,7 @@ public: bool bcurve; }; -class ColorToningEdited -{ - -public: +struct ColorToningEdited { bool enabled; bool opacityCurve; bool colorCurve; @@ -182,31 +161,22 @@ public: bool labregionsShowMask; }; -class SharpenEdgeParamsEdited -{ - -public : +struct SharpenEdgeParamsEdited { bool enabled; bool passes; bool amount; bool threechannels; }; -class SharpenMicroParamsEdited -{ -public : +struct SharpenMicroParamsEdited { bool enabled; bool matrix; bool amount; bool contrast; bool uniformity; - }; -class SharpeningParamsEdited -{ - -public: +struct SharpeningParamsEdited { bool enabled; bool contrast; bool blurradius; @@ -226,10 +196,7 @@ public: bool deconvdamping; }; -class VibranceParamsEdited -{ - -public: +struct VibranceParamsEdited { bool enabled; bool pastels; bool saturated; @@ -240,19 +207,7 @@ public: bool skintonescurve; }; -/*class ColorBoostParamsEdited { - - public: - bool amount; - bool avoidclip; - bool enable_saturationlimiter; - bool rstprotection; -};*/ - -class WBParamsEdited -{ - -public: +struct WBParamsEdited { bool enabled; bool method; bool temperature; @@ -261,50 +216,19 @@ public: bool tempBias; }; -/*class ColorShiftParamsEdited { - - public: - bool a; - bool b; -};*/ - -/*class LumaDenoiseParamsEdited { - - public: - bool enabled; - bool radius; - bool edgetolerance; -};*/ - -/*class ColorDenoiseParamsEdited { - - public: - bool enabled; - bool amount; -};*/ - -class DefringeParamsEdited -{ - -public: +struct DefringeParamsEdited { bool enabled; bool radius; bool threshold; bool huecurve; }; -class ImpulseDenoiseParamsEdited -{ - -public: +struct ImpulseDenoiseParamsEdited { bool enabled; bool thresh; }; -class ColorAppearanceParamsEdited -{ - -public: +struct ColorAppearanceParamsEdited { bool curve; bool curve2; bool curve3; @@ -337,22 +261,16 @@ public: bool rstprotection; bool surrsource; bool gamut; -// bool badpix; bool datacie; bool tonecie; -// bool sharpcie; bool tempout; bool greenout; bool ybout; bool tempsc; bool greensc; - }; -class DirPyrDenoiseParamsEdited -{ - -public: +struct DirPyrDenoiseParamsEdited { bool enabled; bool enhance; bool median; @@ -365,7 +283,6 @@ public: bool lcurve; bool cccurve; -// bool perform; bool dmethod; bool Lmethod; bool Cmethod; @@ -375,12 +292,9 @@ public: bool methodmed; bool rgbmethod; bool passes; - }; -class EPDParamsEdited -{ -public: +struct EPDParamsEdited { bool enabled; bool strength; bool gamma; @@ -389,21 +303,14 @@ public: bool reweightingIterates; }; - -class FattalToneMappingParamsEdited -{ -public: +struct FattalToneMappingParamsEdited { bool enabled; bool threshold; bool amount; bool anchor; }; - -class SHParamsEdited -{ - -public: +struct SHParamsEdited { bool enabled; bool highlights; bool htonalwidth; @@ -413,10 +320,7 @@ public: bool lab; }; -class CropParamsEdited -{ - -public: +struct CropParamsEdited { bool enabled; bool x; bool y; @@ -428,33 +332,21 @@ public: bool guide; }; -class CoarseTransformParamsEdited -{ - -public: +struct CoarseTransformParamsEdited { bool rotate; bool hflip; bool vflip; }; -class CommonTransformParamsEdited -{ - -public: +struct CommonTransformParamsEdited { bool autofill; }; -class RotateParamsEdited -{ - -public: +struct RotateParamsEdited { bool degree; }; -class DistortionParamsEdited -{ - -public: +struct DistortionParamsEdited { bool amount; }; class LocallabParamsEdited @@ -543,6 +435,7 @@ public: bool blendmaskSH; bool radmaskSH; bool blurSHde; + bool inverssh; // Vibrance bool expvibrance; bool saturated; @@ -633,28 +526,29 @@ public: std::vector spots; }; -class LensProfParamsEdited -{ -public: - bool lcpFile, useDist, useVign, useCA; - bool useLensfun, lfAutoMatch, lfCameraMake, lfCameraModel, lfLens; +struct LensProfParamsEdited { + bool lcpFile; + bool useDist; + bool useVign; + bool useCA; + + bool useLensfun; + bool lfAutoMatch; + bool lfCameraMake; + bool lfCameraModel; + bool lfLens; + bool lcMode; bool isUnchanged() const; }; -class PerspectiveParamsEdited -{ - -public: +struct PerspectiveParamsEdited { bool horizontal; bool vertical; }; -class GradientParamsEdited -{ - -public: +struct GradientParamsEdited { bool enabled; bool degree; bool feather; @@ -663,20 +557,14 @@ public: bool centerY; }; -class PCVignetteParamsEdited -{ - -public: +struct PCVignetteParamsEdited { bool enabled; bool strength; bool feather; bool roundness; }; -class VignettingParamsEdited -{ - -public: +struct VignettingParamsEdited { bool amount; bool radius; bool strength; @@ -684,20 +572,15 @@ public: bool centerY; }; -class ChannelMixerParamsEdited -{ - -public: +struct ChannelMixerParamsEdited { bool enabled; bool red[3]; bool green[3]; bool blue[3]; }; -class BlackWhiteParamsEdited -{ -public: +struct BlackWhiteParamsEdited { bool enabledcc; bool enabled; bool method; @@ -721,28 +604,14 @@ public: bool afterCurveMode; bool autoc; bool algo; - }; -class CACorrParamsEdited -{ - -public: +struct CACorrParamsEdited { bool red; bool blue; }; -/* -class HRecParamsEdited { - public: - bool enabled; - bool method; -}; -*/ -class ResizeParamsEdited -{ - -public: +struct ResizeParamsEdited { bool scale; bool appliesTo; bool method; @@ -753,10 +622,7 @@ public: bool allowUpscaling; }; -class ColorManagementParamsEdited -{ - -public: +struct ColorManagementParamsEdited { bool inputProfile; bool toneCurve; bool applyLookTable; @@ -773,10 +639,8 @@ public: bool outputIntent; bool outputBPC; }; -class WaveletParamsEdited -{ -public: +struct WaveletParamsEdited { bool enabled; bool strength; bool balance; @@ -860,13 +724,9 @@ public: bool expfinal; bool exptoning; bool expnoise; - }; -class DirPyrEqualizerParamsEdited -{ - -public: +struct DirPyrEqualizerParamsEdited { bool enabled; bool gamutlab; bool mult[6]; @@ -874,52 +734,35 @@ public: bool threshold; bool skinprotect; bool hueskin; - // bool algo; }; -class HSVEqualizerParamsEdited -{ - -public: +struct HSVEqualizerParamsEdited { bool enabled; bool hcurve; bool scurve; bool vcurve; }; -class FilmSimulationParamsEdited -{ -public: +struct FilmSimulationParamsEdited { bool enabled; bool clutFilename; bool strength; }; -class SoftLightParamsEdited -{ -public: +struct SoftLightParamsEdited { bool enabled; bool strength; }; -class DehazeParamsEdited -{ -public: +struct DehazeParamsEdited { bool enabled; bool strength; bool showDepthMap; bool depth; }; - -class RAWParamsEdited -{ - -public: - class BayerSensor - { - - public: +struct RAWParamsEdited { + struct BayerSensor { bool method; bool border; bool imageNum; @@ -949,7 +792,6 @@ public: bool pixelShiftNonGreenCross; bool pixelShiftDemosaicMethod; - //bool allEnhance; bool greenEq; bool linenoise; bool linenoiseDirection; @@ -958,10 +800,7 @@ public: bool isUnchanged() const; }; - class XTransSensor - { - - public: + struct XTransSensor { bool method; bool dualDemosaicAutoContrast; bool dualDemosaicContrast; @@ -999,67 +838,57 @@ public: }; -class MetaDataParamsEdited -{ -public: +struct MetaDataParamsEdited { bool mode; }; - -class ParamsEdited -{ - -public: - GeneralParamsEdited general; - ToneCurveParamsEdited toneCurve; - LCurveParamsEdited labCurve; - LocalContrastParamsEdited localContrast; - RGBCurvesParamsEdited rgbCurves; - ColorToningEdited colorToning; - RetinexParamsEdited retinex; - SharpeningParamsEdited sharpening; - SharpeningParamsEdited prsharpening; - SharpenEdgeParamsEdited sharpenEdge; - SharpenMicroParamsEdited sharpenMicro; - VibranceParamsEdited vibrance; - ColorAppearanceParamsEdited colorappearance; - //ColorBoostParamsEdited colorBoost; - WBParamsEdited wb; - //ColorShiftParamsEdited colorShift; - //LumaDenoiseParamsEdited lumaDenoise; - //ColorDenoiseParamsEdited colorDenoise; - DefringeParamsEdited defringe; - DirPyrDenoiseParamsEdited dirpyrDenoise; - EPDParamsEdited epd; +struct ParamsEdited { + GeneralParamsEdited general; + ToneCurveParamsEdited toneCurve; + LCurveParamsEdited labCurve; + LocalContrastParamsEdited localContrast; + RGBCurvesParamsEdited rgbCurves; + ColorToningEdited colorToning; + RetinexParamsEdited retinex; + SharpeningParamsEdited sharpening; + SharpeningParamsEdited prsharpening; + SharpenEdgeParamsEdited sharpenEdge; + SharpenMicroParamsEdited sharpenMicro; + VibranceParamsEdited vibrance; + ColorAppearanceParamsEdited colorappearance; + WBParamsEdited wb; + DefringeParamsEdited defringe; + DirPyrDenoiseParamsEdited dirpyrDenoise; + EPDParamsEdited epd; FattalToneMappingParamsEdited fattal; - ImpulseDenoiseParamsEdited impulseDenoise; - SHParamsEdited sh; - CropParamsEdited crop; - CoarseTransformParamsEdited coarse; - CommonTransformParamsEdited commonTrans; - RotateParamsEdited rotate; - DistortionParamsEdited distortion; - LensProfParamsEdited lensProf; - PerspectiveParamsEdited perspective; - GradientParamsEdited gradient; + ImpulseDenoiseParamsEdited impulseDenoise; + SHParamsEdited sh; + CropParamsEdited crop; + CoarseTransformParamsEdited coarse; + CommonTransformParamsEdited commonTrans; + RotateParamsEdited rotate; + DistortionParamsEdited distortion; + LensProfParamsEdited lensProf; + PerspectiveParamsEdited perspective; + GradientParamsEdited gradient; LocallabParamsEdited locallab; - PCVignetteParamsEdited pcvignette; - CACorrParamsEdited cacorrection; - VignettingParamsEdited vignetting; - ChannelMixerParamsEdited chmixer; - BlackWhiteParamsEdited blackwhite; - ResizeParamsEdited resize; - ColorManagementParamsEdited icm; - RAWParamsEdited raw; - DirPyrEqualizerParamsEdited dirpyrequalizer; - WaveletParamsEdited wavelet; - HSVEqualizerParamsEdited hsvequalizer; - FilmSimulationParamsEdited filmSimulation; - SoftLightParamsEdited softlight; - DehazeParamsEdited dehaze; - MetaDataParamsEdited metadata; - bool exif; - bool iptc; + PCVignetteParamsEdited pcvignette; + CACorrParamsEdited cacorrection; + VignettingParamsEdited vignetting; + ChannelMixerParamsEdited chmixer; + BlackWhiteParamsEdited blackwhite; + ResizeParamsEdited resize; + ColorManagementParamsEdited icm; + RAWParamsEdited raw; + DirPyrEqualizerParamsEdited dirpyrequalizer; + WaveletParamsEdited wavelet; + HSVEqualizerParamsEdited hsvequalizer; + FilmSimulationParamsEdited filmSimulation; + SoftLightParamsEdited softlight; + DehazeParamsEdited dehaze; + MetaDataParamsEdited metadata; + bool exif; + bool iptc; explicit ParamsEdited(bool value = false); @@ -1067,4 +896,3 @@ public: void initFrom(const std::vector& src); void combine(rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet); }; -#endif