From 27c4c546ef31a455539a72cc1dd5dcd91fce25b6 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 25 Oct 2020 09:35:03 +0100 Subject: [PATCH] Added complex method standard advanced to ciecam02 --- rtdata/languages/default | 1 + rtengine/procparams.cc | 4 ++ rtengine/procparams.h | 1 + rtgui/colorappearance.cc | 123 +++++++++++++++++++++++++++++++++++++-- rtgui/colorappearance.h | 9 +++ rtgui/paramsedited.cc | 6 ++ rtgui/paramsedited.h | 1 + 7 files changed, 141 insertions(+), 4 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 0263e99fd..6fcbb7b32 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1968,6 +1968,7 @@ TP_COLORAPP_SURROUND_AVER;Average TP_COLORAPP_SURROUND_DARK;Dark TP_COLORAPP_SURROUND_DIM;Dim TP_COLORAPP_SURROUND_EXDARK;Extremly Dark (Cutsheet) +TP_COLORAPP_SURSOURCE_TOOLTIP;Changes tones and colors to take into account the Scene conditions.\n\nAverage: Average light environment (standard). The image will not change.\n\nDim: Dim environment. The image will become slightly bright.\n\nDark: Dark environment. The image will become more bright.\n\nExtremly Dark: Extremly dark environment (cutsheet). The image will become very bright. TP_COLORAPP_SURROUND_TOOLTIP;Changes tones and colors to take into account the viewing conditions of the output device.\n\nAverage: Average light environment (standard). The image will not change.\n\nDim: Dim environment (TV). The image will become slightly dark.\n\nDark: Dark environment (projector). The image will become more dark.\n\nExtremly Dark: Extremly dark environment (cutsheet). The image will become very dark. TP_COLORAPP_TCMODE_BRIGHTNESS;Brightness TP_COLORAPP_TCMODE_CHROMA;Chroma diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 503fa05eb..0528f0e49 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1375,6 +1375,7 @@ ColorAppearanceParams::ColorAppearanceParams() : curveMode(TcMode::LIGHT), curveMode2(TcMode::LIGHT), curveMode3(CtcMode::CHROMA), + complexmethod("normal"), surround("Average"), surrsrc("Average"), adapscen(2000.0), @@ -1423,6 +1424,7 @@ bool ColorAppearanceParams::operator ==(const ColorAppearanceParams& other) cons && curveMode == other.curveMode && curveMode2 == other.curveMode2 && curveMode3 == other.curveMode3 + && complexmethod == other.complexmethod && surround == other.surround && surrsrc == other.surrsrc && adapscen == other.adapscen @@ -5282,6 +5284,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->colorappearance.degreeout, "Color appearance", "Degreeout", colorappearance.degreeout, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.autodegreeout, "Color appearance", "AutoDegreeout", colorappearance.autodegreeout, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.surround, "Color appearance", "Surround", colorappearance.surround, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.complexmethod, "Color appearance", "complex", colorappearance.complexmethod, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.surrsrc, "Color appearance", "Surrsrc", colorappearance.surrsrc, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.adaplum, "Color appearance", "AdaptLum", colorappearance.adaplum, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.badpixsl, "Color appearance", "Badpixsl", colorappearance.badpixsl, keyFile); @@ -6863,6 +6866,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "AutoDegreeout", pedited, colorappearance.autodegreeout, pedited->colorappearance.autodegreeout); + assignFromKeyfile(keyFile, "Color appearance", "complex", pedited, colorappearance.complexmethod, pedited->colorappearance.complexmethod); assignFromKeyfile(keyFile, "Color appearance", "Surround", pedited, colorappearance.surround, pedited->colorappearance.surround); assignFromKeyfile(keyFile, "Color appearance", "Surrsrc", pedited, colorappearance.surrsrc, pedited->colorappearance.surrsrc); assignFromKeyfile(keyFile, "Color appearance", "AdaptLum", pedited, colorappearance.adaplum, pedited->colorappearance.adaplum); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index a017d6177..7cf8bf4a2 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -672,6 +672,7 @@ struct ColorAppearanceParams { TcMode curveMode; TcMode curveMode2; CtcMode curveMode3; + Glib::ustring complexmethod; Glib::ustring surround; Glib::ustring surrsrc; diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 934f922ae..b55d45294 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -222,7 +222,21 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" Evcatpreset = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_CAT02PRESET"); EvCATAutotempout = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_TEMPOUT"); EvCATillum = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ILLUM"); + EvCATcomplex = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_CATCOMPLEX"); //preset button cat02 + + complexmethod = Gtk::manage (new MyComboBoxText ()); + complexmethod->append(M("TP_WAVELET_COMPNORMAL")); + complexmethod->append(M("TP_WAVELET_COMPEXPERT")); + complexmethodconn = complexmethod->signal_changed().connect(sigc::mem_fun(*this, &ColorAppearance::complexmethodChanged)); + complexmethod->set_tooltip_text(M("TP_WAVELET_COMPLEX_TOOLTIP")); + Gtk::HBox* const complexHBox = Gtk::manage(new Gtk::HBox()); + Gtk::Label* const complexLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_COMPLEXLAB") + ":")); + complexHBox->pack_start(*complexLabel, Gtk::PACK_SHRINK, 4); + complexHBox->pack_start(*complexmethod); + pack_start (*complexHBox, Gtk::PACK_SHRINK); + + presetcat02 = Gtk::manage (new Gtk::CheckButton (M ("TP_COLORAPP_PRESETCAT02"))); presetcat02->set_tooltip_markup (M("TP_COLORAPP_PRESETCAT02_TIP")); presetcat02conn = presetcat02->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::presetcat02pressed)); @@ -256,7 +270,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" Gtk::HBox* surrHBox1 = Gtk::manage (new Gtk::HBox ()); surrHBox1->set_spacing (2); - surrHBox1->set_tooltip_markup (M ("TP_COLORAPP_SURROUND_TOOLTIP")); + surrHBox1->set_tooltip_markup (M ("TP_COLORAPP_SURSOURCE_TOOLTIP")); Gtk::Label* surrLabel1 = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); surrHBox1->pack_start (*surrLabel1, Gtk::PACK_SHRINK); surrsrc = Gtk::manage (new MyComboBoxText ()); @@ -270,7 +284,11 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" // p1VBox->pack_start (*surrsource, Gtk::PACK_SHRINK); - Gtk::HBox* wbmHBox = Gtk::manage (new Gtk::HBox ()); + + +// Gtk::HBox* wbmHBox = Gtk::manage (new Gtk::HBox ()); + wbmHBox = Gtk::manage (new Gtk::HBox ()); + wbmHBox->set_spacing (2); wbmHBox->set_tooltip_markup (M ("TP_COLORAPP_MODEL_TOOLTIP")); Gtk::Label* wbmLab = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_MODEL") + ":")); @@ -285,7 +303,8 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" p1VBox->pack_start (*wbmHBox); - Gtk::HBox* illumHBox = Gtk::manage (new Gtk::HBox ()); +// Gtk::HBox* illumHBox = Gtk::manage (new Gtk::HBox ()); + illumHBox = Gtk::manage (new Gtk::HBox ()); illumHBox->set_spacing (2); illumHBox->set_tooltip_markup (M ("TP_COLORAPP_ILLUM_TOOLTIP")); Gtk::Label* illumLab = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_ILLUM") + ":")); @@ -362,7 +381,8 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" p2VBox = Gtk::manage ( new Gtk::VBox()); p2VBox->set_spacing (2); - Gtk::HBox* alHBox = Gtk::manage (new Gtk::HBox ()); +// Gtk::HBox* alHBox = Gtk::manage (new Gtk::HBox ()); + alHBox = Gtk::manage (new Gtk::HBox ()); alHBox->set_spacing (2); alHBox->set_tooltip_markup (M ("TP_COLORAPP_ALGO_TOOLTIP")); Gtk::Label* alLabel = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_ALGO") + ":")); @@ -803,6 +823,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); + complexmethodconn.block(true); tcmodeconn.block (true); tcmode2conn.block (true); tcmode3conn.block (true); @@ -861,6 +882,9 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) if (!pedited->colorappearance.curveMode) { toneCurveMode->set_active (2); } + if (!pedited->colorappearance.complexmethod) { + complexmethod->set_active_text(M("GENERAL_UNCHANGED")); + } if (!pedited->colorappearance.curveMode2) { toneCurveMode2->set_active (2); @@ -876,6 +900,13 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) setEnabled (pp->colorappearance.enabled); + if (pp->colorappearance.complexmethod == "normal") { + complexmethod->set_active(0); + } else if (pp->colorappearance.complexmethod == "expert") { + complexmethod->set_active(1); + } + + surrsrcconn.block (true); if (pedited && !pedited->colorappearance.surrsrc) { @@ -1038,9 +1069,18 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) presetcat02conn.block (false); lastpresetcat02 = pp->colorappearance.presetcat02; + if (complexmethod->get_active_row_number() == 0) { + updateGUIToMode(0); + convertParamToNormal(); + + } else { + updateGUIToMode(1); + } + tcmode3conn.block (false); tcmode2conn.block (false); tcmodeconn.block (false); + complexmethodconn.block(false); enableListener (); } void ColorAppearance::autoOpenCurve () @@ -1119,6 +1159,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) } if (pedited) { + pedited->colorappearance.complexmethod = complexmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->colorappearance.degree = degree->getEditedState (); pedited->colorappearance.degreeout = degreeout->getEditedState (); pedited->colorappearance.adapscen = adapscen->getEditedState (); @@ -1166,6 +1207,14 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) } + if (complexmethod->get_active_row_number() == 0) { + pp->colorappearance.complexmethod = "normal"; + } else if (complexmethod->get_active_row_number() == 1) { + pp->colorappearance.complexmethod = "expert"; + } + + + if (surrsrc->get_active_row_number() == 0) { pp->colorappearance.surrsrc = "Average"; } else if (surrsrc->get_active_row_number() == 1) { @@ -1224,6 +1273,69 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) } } + + +void ColorAppearance::updateGUIToMode(int mode) +{ + if(mode ==0) { + alHBox->hide(); + wbmHBox->hide(); + curveEditorG->hide(); + curveEditorG2->hide(); + curveEditorG3->hide(); + greenout->hide(); + badpixsl->hide(); + } else { + alHBox->show(); + wbmHBox->show(); + curveEditorG->show(); + curveEditorG2->show(); + curveEditorG3->show(); + greenout->show(); + badpixsl->show(); + } + +} + +void ColorAppearance::convertParamToNormal() +{ + const ColorAppearanceParams def_params; + disableListener(); + algo->set_active (0); + shape->setCurve(def_params.curve); + shape2->setCurve(def_params.curve2); + shape3->setCurve(def_params.curve3); + shape->reset(); + shape2->reset(); + shape3->reset(); + wbmodel->set_active (0); + if (presetcat02->get_active ()) { + wbmodel->set_active (2); + } + greenout->setValue(def_params.greenout); + badpixsl->setValue(def_params.badpixsl); + + enableListener(); + + // Update GUI based on converted widget parameters: +} + +void ColorAppearance::complexmethodChanged() +{ + if (complexmethod->get_active_row_number() == 0) { + updateGUIToMode(0); + convertParamToNormal(); + + } else { + updateGUIToMode(1); + } + + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvCATcomplex, complexmethod->get_active_text()); + } +} + + void ColorAppearance::curveChanged (CurveEditor* ce) { @@ -1924,6 +2036,7 @@ void ColorAppearance::wbmodelChanged () { if (wbmodel->get_active_row_number() == 0 || wbmodel->get_active_row_number() == 1) { illum->hide(); + illumHBox->hide(); tempsc->hide(); greensc->hide(); tempsc->setValue (5003); @@ -1931,6 +2044,7 @@ void ColorAppearance::wbmodelChanged () } if (wbmodel->get_active_row_number() == 2) { + illumHBox->show(); tempsc->show(); greensc->show(); illum->show(); @@ -2081,6 +2195,7 @@ void ColorAppearance::setBatchMode (bool batchMode) tempsc->showEditedCB (); greensc->showEditedCB (); + complexmethod->append(M("GENERAL_UNCHANGED")); surround->append (M ("GENERAL_UNCHANGED")); surrsrc->append (M ("GENERAL_UNCHANGED")); wbmodel->append (M ("GENERAL_UNCHANGED")); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index c326b06f9..6976f4d29 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -77,6 +77,9 @@ public: void curveMode3Changed (); bool curveMode3Changed_ (); void neutral_pressed (); + void complexmethodChanged(); + void convertParamToNormal(); + void updateGUIToMode(int mode); void expandCurve (bool isExpanded); bool isCurveExpanded (); @@ -104,6 +107,7 @@ private: rtengine::ProcEvent Evcatpreset; rtengine::ProcEvent EvCATAutotempout; rtengine::ProcEvent EvCATillum; + rtengine::ProcEvent EvCATcomplex; bool bgTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip); bool srTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip); void foldAllButMe (GdkEventButton* event, MyExpander *expander); @@ -139,6 +143,7 @@ private: MyComboBoxText* toneCurveMode; MyComboBoxText* toneCurveMode2; MyComboBoxText* toneCurveMode3; + MyComboBoxText* complexmethod; //Adjuster* edge; Gtk::CheckButton* surrsource; @@ -165,6 +170,10 @@ private: sigc::connection surrconn; sigc::connection gamutconn, datacieconn, tonecieconn /*,badpixconn , sharpcieconn*/; sigc::connection tcmodeconn, tcmode2conn, tcmode3conn, neutralconn; + sigc::connection complexmethodconn; + Gtk::HBox* alHBox; + Gtk::HBox* wbmHBox; + Gtk::HBox* illumHBox; CurveEditorGroup* curveEditorG; CurveEditorGroup* curveEditorG2; CurveEditorGroup* curveEditorG3; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 024806556..94d706dc7 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -244,6 +244,7 @@ void ParamsEdited::set(bool v) colorappearance.curveMode = v; colorappearance.curveMode2 = v; colorappearance.curveMode3 = v; + colorappearance.complexmethod = v; colorappearance.tempout = v; colorappearance.autotempout = v; colorappearance.greenout = v; @@ -912,6 +913,7 @@ void ParamsEdited::initFrom(const std::vector& colorappearance.curveMode = colorappearance.curveMode && p.colorappearance.curveMode == other.colorappearance.curveMode; colorappearance.curveMode2 = colorappearance.curveMode2 && p.colorappearance.curveMode2 == other.colorappearance.curveMode2; colorappearance.curveMode3 = colorappearance.curveMode3 && p.colorappearance.curveMode3 == other.colorappearance.curveMode3; + colorappearance.complexmethod = colorappearance.complexmethod && p.colorappearance.complexmethod == other.colorappearance.complexmethod; colorappearance.tempout = colorappearance.tempout && p.colorappearance.tempout == other.colorappearance.tempout; colorappearance.autotempout = colorappearance.autotempout && p.colorappearance.autotempout == other.colorappearance.autotempout; colorappearance.greenout = colorappearance.greenout && p.colorappearance.greenout == other.colorappearance.greenout; @@ -2605,6 +2607,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.colorappearance.curveMode3 = mods.colorappearance.curveMode3; } + if (colorappearance.complexmethod) { + toEdit.colorappearance.complexmethod = mods.colorappearance.complexmethod; + } + if (colorappearance.enabled) { toEdit.colorappearance.enabled = mods.colorappearance.enabled; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index a043688c5..0cacef527 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -266,6 +266,7 @@ struct ColorAppearanceParamsEdited { bool curveMode; bool curveMode2; bool curveMode3; + bool complexmethod; bool enabled; bool degree; bool autodegree;