diff --git a/rtdata/languages/default b/rtdata/languages/default index 55361cd0f..724af3f0a 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1174,6 +1174,9 @@ HISTORY_MSG_934;Local - Mask Common laplacian HISTORY_MSG_935;Local - Mask Common chroma HISTORY_MSG_936;Local - Mask Common gamma HISTORY_MSG_937;Local - Mask Common slope +HISTORY_MSG_938;Local - Mask Common curve C(C) +HISTORY_MSG_939;Local - Mask Common curve L(L) +HISTORY_MSG_940;Local - Mask Common curve LC(H) 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 53cf55590..3402f0388 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -960,6 +960,9 @@ enum ProcEventCode { Evlocallabchromask = 934, Evlocallabgammask = 935, Evlocallabslopmask = 936, + EvlocallabCCmask_shape = 937, + EvlocallabLLmask_shape = 938, + EvlocallabHHmask_shape = 939, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f038738cc..8f35d68df 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3740,6 +3740,51 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensimask(60), blendmask(0), enamask(false), + CCmask_curve{ + static_cast(FCT_MinMaxCPoints), + 0.0, + 1.0, + 0.35, + 0.35, + 0.50, + 1.0, + 0.35, + 0.35, + 1.00, + 1.0, + 0.35, + 0.35 + }, + LLmask_curve{ + static_cast(FCT_MinMaxCPoints), + 0.0, + 1.0, + 0.35, + 0.35, + 0.50, + 1.0, + 0.35, + 0.35, + 1.00, + 1.0, + 0.35, + 0.35 + }, + HHmask_curve{ + static_cast(FCT_MinMaxCPoints), + 0.0, + 1.0, + 0.35, + 0.35, + 0.50, + 1.0, + 0.35, + 0.35, + 1.00, + 1.0, + 0.35, + 0.35 + }, radmask(0.0), lapmask(0.0), chromask(0.0), @@ -4223,6 +4268,9 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensimask == other.sensimask && blendmask == other.blendmask && enamask == other.enamask + && CCmask_curve == other.CCmask_curve + && LLmask_curve == other.LLmask_curve + && HHmask_curve == other.HHmask_curve && radmask == other.radmask && lapmask == other.lapmask && chromask == other.chromask @@ -5729,6 +5777,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->sensimask, "Locallab", "Sensimask_" + index_str, spot.sensimask, keyFile); 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->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); saveToKeyfile(!pedited || spot_edited->radmask, "Locallab", "Radmask_" + index_str, spot.radmask, keyFile); saveToKeyfile(!pedited || spot_edited->lapmask, "Locallab", "Lapmask_" + index_str, spot.lapmask, keyFile); saveToKeyfile(!pedited || spot_edited->chromask, "Locallab", "Chromask_" + index_str, spot.chromask, keyFile); @@ -7454,6 +7505,9 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sensimask_" + index_str, pedited, spot.sensimask, spotEdited.sensimask); 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", "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); assignFromKeyfile(keyFile, "Locallab", "Radmask_" + index_str, pedited, spot.radmask, spotEdited.radmask); assignFromKeyfile(keyFile, "Locallab", "Lapmask_" + index_str, pedited, spot.lapmask, spotEdited.lapmask); assignFromKeyfile(keyFile, "Locallab", "Chromask_" + index_str, pedited, spot.chromask, spotEdited.chromask); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index abb32e137..b744b4be2 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1428,6 +1428,9 @@ struct LocallabParams { int sensimask; int blendmask; bool enamask; + std::vector CCmask_curve; + std::vector LLmask_curve; + std::vector HHmask_curve; double radmask; double lapmask; double chromask; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 2347b8917..c778560be 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -963,7 +963,10 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallablapmask LUMINANCECURVE, // Evlocallabchromask LUMINANCECURVE, // Evlocallabgammask - LUMINANCECURVE // Evlocallabslopmask + LUMINANCECURVE, // Evlocallabslopmask + LUMINANCECURVE, // EvlocallabCCmask_shape + LUMINANCECURVE, // EvlocallabLLmask_shape + LUMINANCECURVE // EvlocallabHHmask_shape }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 1cc184b24..3472c3ea4 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -1201,12 +1201,18 @@ private: class LocallabMask: public Gtk::VBox, public LocallabTool + { private: Adjuster* const sensimask; Adjuster* const blendmask; MyComboBoxText* const showmaskMethod; Gtk::CheckButton* const enamask; + CurveEditorGroup* const mask_CurveEditorG; + FlatCurveEditor* const CCmask_shape; + FlatCurveEditor* const LLmask_shape; + FlatCurveEditor* const HHmask_shape; + Adjuster* const radmask; Adjuster* const lapmask; Adjuster* const chromask; @@ -1217,6 +1223,7 @@ private: public: LocallabMask(); + ~LocallabMask(); bool isMaskViewActive() override; void resetMaskView() override; @@ -1230,6 +1237,7 @@ public: void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; + void curveChanged(CurveEditor* ce) override; // void updateAutocompute(const float blackev, const float whiteev, const float sourceg, const float targetg); diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 0efc7e0ad..7c7de4a91 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -4734,6 +4734,11 @@ LocallabMask::LocallabMask(): blendmask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), showmaskMethod(Gtk::manage(new MyComboBoxText())), enamask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), + mask_CurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASKCOL"))), + CCmask_shape(static_cast(mask_CurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false))), + LLmask_shape(static_cast(mask_CurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false))), + HHmask_shape(static_cast(mask_CurveEditorG->addCurve(CT_Flat, "LC(H)", nullptr, false, true))), + 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.))), chromask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), @@ -4742,6 +4747,8 @@ LocallabMask::LocallabMask(): { // Parameter Mask common specific widgets + const LocallabParams::LocallabSpot defSpot; + sensimask->setAdjusterListener(this); blendmask->setAdjusterListener(this); showmaskMethod->append(M("TP_LOCALLAB_SHOWMNONE")); @@ -4752,6 +4759,23 @@ LocallabMask::LocallabMask(): showmaskMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskMethodConn = showmaskMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabMask::showmaskMethodChanged)); enamaskConn = enamask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabMask::enamaskChanged)); + mask_CurveEditorG->setCurveListener(this); + + CCmask_shape->setIdentityValue(0.); + CCmask_shape->setResetCurve(FlatCurveType(defSpot.CCmask_curve.at(0)), defSpot.CCmask_curve); + CCmask_shape->setBottomBarColorProvider(this, 1); + + LLmask_shape->setIdentityValue(0.); + LLmask_shape->setResetCurve(FlatCurveType(defSpot.LLmask_curve.at(0)), defSpot.LLmask_curve); + LLmask_shape->setBottomBarBgGradient({{0., 0., 0., 0.}, {1., 1., 1., 1.}}); + + HHmask_shape->setIdentityValue(0.); + HHmask_shape->setResetCurve(FlatCurveType(defSpot.HHmask_curve.at(0)), defSpot.HHmask_curve); + HHmask_shape->setCurveColorProvider(this, 2); + HHmask_shape->setBottomBarColorProvider(this, 2); + + mask_CurveEditorG->curveListComplete(); + radmask->setAdjusterListener(this); lapmask->setAdjusterListener(this); chromask->setAdjusterListener(this); @@ -4761,6 +4785,7 @@ LocallabMask::LocallabMask(): pack_start(*sensimask, Gtk::PACK_SHRINK, 0); pack_start(*blendmask, Gtk::PACK_SHRINK, 0); pack_start(*showmaskMethod, Gtk::PACK_SHRINK, 4); + pack_start(*mask_CurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor pack_start(*enamask, Gtk::PACK_SHRINK, 0); pack_start(*radmask, Gtk::PACK_SHRINK, 0); pack_start(*lapmask, Gtk::PACK_SHRINK, 0); @@ -4796,14 +4821,25 @@ void LocallabMask::updateAdviceTooltips(const bool showTooltips) exp->set_tooltip_text(M("TP_LOCALLAB_MASKCOM_TOOLTIP")); sensimask->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); blendmask->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); + CCmask_shape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + LLmask_shape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + HHmask_shape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); } else { exp->set_tooltip_text(M("")); sensimask->set_tooltip_text(M("")); blendmask->set_tooltip_text(M("")); + CCmask_shape->setTooltip(M("")); + LLmask_shape->setTooltip(M("")); + HHmask_shape->setTooltip(M("")); } } +LocallabMask::~LocallabMask() +{ + delete mask_CurveEditorG; +} + void LocallabMask::disableListener() { LocallabTool::disableListener(); @@ -4855,6 +4891,9 @@ void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const Params sensimask->setValue(spot.sensimask); blendmask->setValue(spot.blendmask); enamask->set_active(spot.enamask); + CCmask_shape->setCurve(spot.CCmask_curve); + LLmask_shape->setCurve(spot.LLmask_curve); + HHmask_shape->setCurve(spot.HHmask_curve); radmask->setValue(spot.radmask); lapmask->setValue(spot.lapmask); chromask->setValue(spot.chromask); @@ -4889,6 +4928,9 @@ void LocallabMask::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.sensimask = sensimask->getIntValue(); spot.blendmask = blendmask->getIntValue(); spot.enamask = enamask->get_active(); + spot.CCmask_curve = CCmask_shape->getCurve(); + spot.LLmask_curve = LLmask_shape->getCurve(); + spot.HHmask_curve = HHmask_shape->getCurve(); spot.radmask = radmask->getValue(); spot.lapmask = lapmask->getValue(); spot.chromask = chromask->getValue(); @@ -4970,6 +5012,37 @@ void LocallabMask::convertParamToNormal() } +void LocallabMask::curveChanged(CurveEditor* ce) +{ + if (isLocActivated && exp->getEnabled()) { + + if (ce == CCmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabCCmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == LLmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabLLmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (ce == HHmask_shape) { + if (listener) { + listener->panelChanged(EvlocallabHHmask_shape, + M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + + } +} + + + void LocallabMask::adjusterChanged(Adjuster* a, double newval) { if (isLocActivated && exp->getEnabled()) { diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 1cb15568a..8f0abbcf4 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1484,6 +1484,9 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensimask = locallab.spots.at(j).sensimask && pSpot.sensimask == otherSpot.sensimask; 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).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; locallab.spots.at(j).radmask = locallab.spots.at(j).radmask && pSpot.radmask == otherSpot.radmask; locallab.spots.at(j).lapmask = locallab.spots.at(j).lapmask && pSpot.lapmask == otherSpot.lapmask; locallab.spots.at(j).chromask = locallab.spots.at(j).chromask && pSpot.chromask == otherSpot.chromask; @@ -4819,6 +4822,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).enamask = mods.locallab.spots.at(i).enamask; } + if (locallab.spots.at(i).CCmask_curve) { + toEdit.locallab.spots.at(i).CCmask_curve = mods.locallab.spots.at(i).CCmask_curve; + } + + if (locallab.spots.at(i).LLmask_curve) { + toEdit.locallab.spots.at(i).LLmask_curve = mods.locallab.spots.at(i).LLmask_curve; + } + + if (locallab.spots.at(i).HHmask_curve) { + toEdit.locallab.spots.at(i).HHmask_curve = mods.locallab.spots.at(i).HHmask_curve; + } + if (locallab.spots.at(i).radmask) { toEdit.locallab.spots.at(i).radmask = mods.locallab.spots.at(i).radmask; } @@ -6415,6 +6430,9 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sensimask(v), blendmask(v), enamask(v), + CCmask_curve(v), + LLmask_curve(v), + HHmask_curve(v), radmask(v), lapmask(v), chromask(v), @@ -6888,6 +6906,9 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) sensimask = v; blendmask = v; enamask = v; + CCmask_curve = v; + LLmask_curve = v; + HHmask_curve = v; radmask = v; lapmask = v; chromask = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index f91b93f61..49fc7d07a 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -842,6 +842,9 @@ public: bool sensimask; bool blendmask; bool enamask; + bool CCmask_curve; + bool LLmask_curve; + bool HHmask_curve; bool radmask; bool lapmask; bool chromask;