From bc740affe8d674b0f443a9b7b19da4ac40259a43 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 22 Jun 2020 17:59:58 +0200 Subject: [PATCH] Added common mask blur mask --- rtdata/languages/default | 2 ++ rtengine/procevents.h | 2 ++ rtengine/procparams.cc | 8 +++++++ rtengine/procparams.h | 2 ++ rtengine/refreshmap.cc | 4 +++- rtgui/locallabtools.h | 2 ++ rtgui/locallabtools2.cc | 49 ++++++++++++++++++++++++++++++++++------ rtgui/paramsedited.cc | 14 ++++++++++++ rtgui/paramsedited.h | 2 ++ 9 files changed, 77 insertions(+), 8 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 210048b8a..e954b156e 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1181,6 +1181,8 @@ HISTORY_MSG_941;Local - Mask Common structure as tool HISTORY_MSG_942;Local - Mask Common structure strength HISTORY_MSG_943;Local - Mask Common H(H) curve HISTORY_MSG_944;Local - Mask Common FFT +HISTORY_MSG_945;Local - Mask Common Blur radius +HISTORY_MSG_946;Local - Mask Common contrast threshold HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 879edf337..ad5cd34c4 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -967,6 +967,8 @@ enum ProcEventCode { Evlocallabstrumaskmask = 941, EvlocallabHHhmask_shape = 942, EvLocallabfftmask = 943, + Evlocallabblurmask = 944, + Evlocallabcontmask = 945, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 059b15057..591f57b13 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3741,6 +3741,8 @@ LocallabParams::LocallabSpot::LocallabSpot() : blendmask(0), enamask(false), fftmask(true), + blurmask(0.2), + contmask(0.), CCmask_curve{ static_cast(FCT_MinMaxCPoints), 0.0, @@ -4287,6 +4289,8 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && blendmask == other.blendmask && enamask == other.enamask && fftmask == other.fftmask + && blurmask == other.blurmask + && contmask == other.contmask && CCmask_curve == other.CCmask_curve && LLmask_curve == other.LLmask_curve && HHmask_curve == other.HHmask_curve @@ -5800,6 +5804,8 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->blendmask, "Locallab", "Blendmaskmask_" + index_str, spot.blendmask, keyFile); saveToKeyfile(!pedited || spot_edited->enamask, "Locallab", "Enamask_" + index_str, spot.enamask, keyFile); saveToKeyfile(!pedited || spot_edited->fftmask, "Locallab", "Fftmask_" + index_str, spot.fftmask, keyFile); + saveToKeyfile(!pedited || spot_edited->blurmask, "Locallab", "Blurmask_" + index_str, spot.blurmask, keyFile); + saveToKeyfile(!pedited || spot_edited->contmask, "Locallab", "Contmask_" + index_str, spot.contmask, keyFile); saveToKeyfile(!pedited || spot_edited->CCmask_curve, "Locallab", "CCmask_Curve_" + index_str, spot.CCmask_curve, keyFile); saveToKeyfile(!pedited || spot_edited->LLmask_curve, "Locallab", "LLmask_Curve_" + index_str, spot.LLmask_curve, keyFile); saveToKeyfile(!pedited || spot_edited->HHmask_curve, "Locallab", "HHmask_Curve_" + index_str, spot.HHmask_curve, keyFile); @@ -7532,6 +7538,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Blendmaskmask_" + index_str, pedited, spot.blendmask, spotEdited.blendmask); assignFromKeyfile(keyFile, "Locallab", "Enamask_" + index_str, pedited, spot.enamask, spotEdited.enamask); assignFromKeyfile(keyFile, "Locallab", "Fftmask_" + index_str, pedited, spot.fftmask, spotEdited.fftmask); + assignFromKeyfile(keyFile, "Locallab", "Blurmask_" + index_str, pedited, spot.blurmask, spotEdited.blurmask); + assignFromKeyfile(keyFile, "Locallab", "Contmask_" + index_str, pedited, spot.contmask, spotEdited.contmask); assignFromKeyfile(keyFile, "Locallab", "CCmask_Curve_" + index_str, pedited, spot.CCmask_curve, spotEdited.CCmask_curve); assignFromKeyfile(keyFile, "Locallab", "LLmask_Curve_" + index_str, pedited, spot.LLmask_curve, spotEdited.LLmask_curve); assignFromKeyfile(keyFile, "Locallab", "HHmask_Curve_" + index_str, pedited, spot.HHmask_curve, spotEdited.HHmask_curve); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c13055aa7..a0e5719f0 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1429,6 +1429,8 @@ struct LocallabParams { int blendmask; bool enamask; bool fftmask; + double blurmask; + double contmask; std::vector CCmask_curve; std::vector LLmask_curve; std::vector HHmask_curve; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index f9a0c39d5..d2459851d 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -970,7 +970,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvLocallabtoolmask LUMINANCECURVE, // Evlocallabstrumaskmask LUMINANCECURVE, // EvlocallabHHhmask_shape - LUMINANCECURVE // EvLocallabfftmask + LUMINANCECURVE, // EvLocallabfftmask + LUMINANCECURVE, // Evlocallabblurmask + LUMINANCECURVE // Evlocallabcontmask }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 0eaf0d206..fe3a3df79 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -1217,6 +1217,8 @@ private: Gtk::CheckButton* const toolmask; Gtk::Frame* const blurFrame; Gtk::CheckButton* const fftmask; + Adjuster* const contmask; + Adjuster* const blurmask; Adjuster* const radmask; Adjuster* const lapmask; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 40826613e..60c2c9707 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -4744,6 +4744,8 @@ LocallabMask::LocallabMask(): toolmask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TOOLCOL")))), blurFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABBLURM")))), fftmask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTCOL_MASK")))), + contmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTCOL"), 0., 200., 0.5, 0.))), + blurmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURCOL"), 0.2, 100., 0.5, 0.2))), radmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), -10.0, 1000.0, 0.1, 0.))), lapmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), @@ -4793,6 +4795,9 @@ LocallabMask::LocallabMask(): blurFrame->set_label_align(0.025, 0.5); fftmaskConn = fftmask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::fftmaskChanged)); + contmask->setAdjusterListener(this); + + blurmask->setAdjusterListener(this); radmask->setAdjusterListener(this); lapmask->setAdjusterListener(this); @@ -4826,6 +4831,8 @@ LocallabMask::LocallabMask(): ToolParamBlock* const blurmBox = Gtk::manage(new ToolParamBlock()); blurmBox->pack_start(*fftmask, Gtk::PACK_SHRINK, 0); + blurmBox->pack_start(*contmask); + blurmBox->pack_start(*blurmask); blurFrame->add(*blurmBox); maskmaskBox->pack_start(*blurFrame, Gtk::PACK_SHRINK, 0); @@ -4951,7 +4958,9 @@ void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const Params sensimask->setValue(spot.sensimask); + contmask->setValue(spot.contmask); updatemaskGUI3(); + blurmask->setValue(spot.blurmask); blendmask->setValue(spot.blendmask); enamask->set_active(spot.enamask); @@ -5008,6 +5017,8 @@ void LocallabMask::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.slopmask = slopmask->getValue(); spot.HHhmask_curve = HHhmask_shape->getCurve(); spot.fftmask = fftmask->get_active(); + spot.contmask = contmask->getValue(); + spot.blurmask = blurmask->getValue(); } @@ -5049,6 +5060,8 @@ void LocallabMask::setDefaults(const rtengine::procparams::ProcParams* defParams lapmask->setDefault(defSpot.lapmask); slopmask->setDefault(defSpot.slopmask); HHhmask_shape->setCurve(defSpot.HHhmask_curve); + contmask->setDefault(defSpot.contmask); + blurmask->setDefault(defSpot.blurmask); } @@ -5064,6 +5077,8 @@ void LocallabMask::updateGUIToMode(const modeType new_type) slopmask->hide(); struFrame->hide(); blurFrame->hide(); + mask_HCurveEditorG->hide(); + } else { // Advanced widgets are shown in Expert mode lapmask->show(); @@ -5071,6 +5086,8 @@ void LocallabMask::updateGUIToMode(const modeType new_type) slopmask->show(); struFrame->show(); blurFrame->show(); + mask_HCurveEditorG->show(); + } } @@ -5088,6 +5105,9 @@ void LocallabMask::convertParamToNormal() strumaskmask->setValue(defSpot.strumaskmask); toolmask->set_active(defSpot.toolmask); fftmask->set_active(defSpot.fftmask); + blurmask->setValue(defSpot.blurmask); + contmask->setValue(defSpot.contmask); + HHhmask_shape->setCurve(defSpot.HHhmask_curve); // Enable all listeners enableListener(); @@ -5095,17 +5115,17 @@ void LocallabMask::convertParamToNormal() } void LocallabMask::updatemaskGUI3() -{ /* - const double temp = blurcol->getValue(); +{ + const double temp = blurmask->getValue(); - if (fftColorMask->get_active()) { - blurcol->setLimits(0.2, 1000., 0.5, 0.2); + if (fftmask->get_active()) { + blurmask->setLimits(0.2, 1000., 0.5, 0.2); } else { - blurcol->setLimits(0.2, 100., 0.5, 0.2); + blurmask->setLimits(0.2, 100., 0.5, 0.2); } - blurcol->setValue(temp); - */ + blurmask->setValue(temp); + } @@ -5183,6 +5203,21 @@ void LocallabMask::adjusterChanged(Adjuster* a, double newval) } } + if (a == contmask) { + if (listener) { + listener->panelChanged(Evlocallabcontmask, + contmask->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == blurmask) { + if (listener) { + listener->panelChanged(Evlocallabblurmask, + blurmask->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == blendmask) { if (listener) { listener->panelChanged(Evlocallabblendmask, diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index bfa727be3..0f88e8ec9 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1485,6 +1485,8 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).blendmask = locallab.spots.at(j).blendmask && pSpot.blendmask == otherSpot.blendmask; locallab.spots.at(j).enamask = locallab.spots.at(j).enamask && pSpot.enamask == otherSpot.enamask; locallab.spots.at(j).fftmask = locallab.spots.at(j).fftmask && pSpot.fftmask == otherSpot.fftmask; + locallab.spots.at(j).blurmask = locallab.spots.at(j).blurmask && pSpot.blurmask == otherSpot.blurmask; + locallab.spots.at(j).contmask = locallab.spots.at(j).contmask && pSpot.contmask == otherSpot.contmask; locallab.spots.at(j).CCmask_curve = locallab.spots.at(j).CCmask_curve && pSpot.CCmask_curve == otherSpot.CCmask_curve; locallab.spots.at(j).LLmask_curve = locallab.spots.at(j).LLmask_curve && pSpot.LLmask_curve == otherSpot.LLmask_curve; locallab.spots.at(j).HHmask_curve = locallab.spots.at(j).HHmask_curve && pSpot.HHmask_curve == otherSpot.HHmask_curve; @@ -4830,6 +4832,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).fftmask = mods.locallab.spots.at(i).fftmask; } + if (locallab.spots.at(i).blurmask) { + toEdit.locallab.spots.at(i).blurmask = mods.locallab.spots.at(i).blurmask; + } + + if (locallab.spots.at(i).contmask) { + toEdit.locallab.spots.at(i).contmask = mods.locallab.spots.at(i).contmask; + } + if (locallab.spots.at(i).CCmask_curve) { toEdit.locallab.spots.at(i).CCmask_curve = mods.locallab.spots.at(i).CCmask_curve; } @@ -6451,6 +6461,8 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : blendmask(v), enamask(v), fftmask(v), + blurmask(v), + contmask(v), CCmask_curve(v), LLmask_curve(v), HHmask_curve(v), @@ -6931,6 +6943,8 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) blendmask = v; enamask = v; fftmask = v; + blurmask = v; + contmask = v; CCmask_curve = v; LLmask_curve = v; HHmask_curve = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 69d1e885b..bd76fc8c7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -843,6 +843,8 @@ public: bool blendmask; bool enamask; bool fftmask; + bool blurmask; + bool contmask; bool CCmask_curve; bool LLmask_curve; bool HHmask_curve;