shadows/highlights: added colorspace selection (RGB or L*a*b*)

This commit is contained in:
Alberto Griggio
2018-10-03 23:41:30 +02:00
parent 17e4f6f25c
commit 30d8a674aa
9 changed files with 131 additions and 32 deletions

View File

@@ -292,6 +292,7 @@ void ParamsEdited::set(bool v)
sh.shadows = v;
sh.stonalwidth = v;
sh.radius = v;
sh.lab = v;
crop.enabled = v;
crop.x = v;
crop.y = v;
@@ -851,6 +852,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
sh.shadows = sh.shadows && p.sh.shadows == other.sh.shadows;
sh.stonalwidth = sh.stonalwidth && p.sh.stonalwidth == other.sh.stonalwidth;
sh.radius = sh.radius && p.sh.radius == other.sh.radius;
sh.lab = sh.lab && p.sh.lab == other.sh.lab;
crop.enabled = crop.enabled && p.crop.enabled == other.crop.enabled;
crop.x = crop.x && p.crop.x == other.crop.x;
crop.y = crop.y && p.crop.y == other.crop.y;
@@ -2116,6 +2118,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.sh.radius = mods.sh.radius;
}
if (sh.lab) {
toEdit.sh.lab = mods.sh.lab;
}
if (crop.enabled) {
toEdit.crop.enabled = mods.crop.enabled;
}

View File

@@ -402,12 +402,12 @@ class SHParamsEdited
public:
bool enabled;
bool hq;
bool highlights;
bool htonalwidth;
bool shadows;
bool stonalwidth;
bool radius;
bool lab;
};
class CropParamsEdited

View File

@@ -1,11 +1,13 @@
#pragma once
// This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes
#define PPVERSION 343
#define PPVERSION 344
#define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified
/*
Log of version changes
344 2018-10-04
added Lab/RGB color space selection for shadows/highlights
343 2018-09-06
raw auto ca correction avoid colour shift
342 2018-09-05

View File

@@ -17,12 +17,26 @@
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "shadowshighlights.h"
#include "eventmapper.h"
using namespace rtengine;
using namespace rtengine::procparams;
ShadowsHighlights::ShadowsHighlights () : FoldableToolPanel(this, "shadowshighlights", M("TP_SHADOWSHLIGHTS_LABEL"), false, true)
{
auto m = ProcEventMapper::getInstance();
EvSHColorspace = m->newEvent(RGBCURVE, "HISTORY_MSG_SH_COLORSPACE");
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
hb->pack_start(*Gtk::manage(new Gtk::Label(M("TP_DIRPYRDENOISE_MAIN_COLORSPACE") + ": ")), Gtk::PACK_SHRINK);
colorspace = Gtk::manage(new MyComboBoxText());
colorspace->append(M("TP_DIRPYRDENOISE_MAIN_COLORSPACE_RGB"));
colorspace->append(M("TP_DIRPYRDENOISE_MAIN_COLORSPACE_LAB"));
hb->pack_start(*colorspace);
pack_start(*hb);
pack_start (*Gtk::manage (new Gtk::HSeparator()));
highlights = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_HIGHLIGHTS"), 0, 100, 1, 0));
h_tonalwidth = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_HLTONALW"), 10, 100, 1, 70));
pack_start (*highlights);
@@ -46,6 +60,8 @@ ShadowsHighlights::ShadowsHighlights () : FoldableToolPanel(this, "shadowshighli
shadows->setAdjusterListener (this);
s_tonalwidth->setAdjusterListener (this);
colorspace->signal_changed().connect(sigc::mem_fun(*this, &ShadowsHighlights::colorspaceChanged));
show_all_children ();
}
@@ -61,6 +77,7 @@ void ShadowsHighlights::read (const ProcParams* pp, const ParamsEdited* pedited)
shadows->setEditedState (pedited->sh.shadows ? Edited : UnEdited);
s_tonalwidth->setEditedState (pedited->sh.stonalwidth ? Edited : UnEdited);
set_inconsistent (multiImage && !pedited->sh.enabled);
}
setEnabled (pp->sh.enabled);
@@ -71,6 +88,14 @@ void ShadowsHighlights::read (const ProcParams* pp, const ParamsEdited* pedited)
shadows->setValue (pp->sh.shadows);
s_tonalwidth->setValue (pp->sh.stonalwidth);
if (pedited && !pedited->sh.lab) {
colorspace->set_active(2);
} else if (pp->sh.lab) {
colorspace->set_active(1);
} else {
colorspace->set_active(0);
}
enableListener ();
}
@@ -84,6 +109,12 @@ void ShadowsHighlights::write (ProcParams* pp, ParamsEdited* pedited)
pp->sh.stonalwidth = (int)s_tonalwidth->getValue ();
pp->sh.enabled = getEnabled();
if (colorspace->get_active_row_number() == 0) {
pp->sh.lab = false;
} else if (colorspace->get_active_row_number() == 1) {
pp->sh.lab = true;
}
if (pedited) {
pedited->sh.radius = radius->getEditedState ();
pedited->sh.highlights = highlights->getEditedState ();
@@ -91,6 +122,7 @@ void ShadowsHighlights::write (ProcParams* pp, ParamsEdited* pedited)
pedited->sh.shadows = shadows->getEditedState ();
pedited->sh.stonalwidth = s_tonalwidth->getEditedState ();
pedited->sh.enabled = !get_inconsistent();
pedited->sh.lab = colorspace->get_active_row_number() != 2;
}
}
@@ -153,6 +185,13 @@ void ShadowsHighlights::enabledChanged ()
}
}
void ShadowsHighlights::colorspaceChanged()
{
if (listener && (multiImage || getEnabled()) ) {
listener->panelChanged(EvSHColorspace, colorspace->get_active_text());
}
}
void ShadowsHighlights::setBatchMode (bool batchMode)
{
@@ -162,6 +201,7 @@ void ShadowsHighlights::setBatchMode (bool batchMode)
h_tonalwidth->showEditedCB ();
shadows->showEditedCB ();
s_tonalwidth->showEditedCB ();
colorspace->append(M("GENERAL_UNCHANGED"));
}
void ShadowsHighlights::setAdjusterBehavior (bool hadd, bool sadd)

View File

@@ -32,6 +32,9 @@ protected:
Adjuster* shadows;
Adjuster* s_tonalwidth;
Adjuster* radius;
MyComboBoxText *colorspace;
rtengine::ProcEvent EvSHColorspace;
public:
@@ -47,6 +50,8 @@ public:
void setAdjusterBehavior (bool hadd, bool sadd);
void trimValues (rtengine::procparams::ProcParams* pp);
void colorspaceChanged();
};
#endif