Added RGB saturation slider. Fixed coding error in RGB contrast curve.

This commit is contained in:
Emil Martinec
2010-11-07 11:34:15 -06:00
parent a022dc0c56
commit 9bf2ff0079
23 changed files with 325 additions and 234 deletions

View File

@@ -23,9 +23,9 @@
#define ADDSET_CA 19
#define ADDSET_VIGN_AMOUNT 20
#define ADDSET_LC_SATURATION 21
#define ADDSET_TC_SATURATION 22
// When adding items, make sure to update ADDSET_PARAM_NUM
#define ADDSET_PARAM_NUM 22 // THIS IS USED AS A DELIMITER!!
#define ADDSET_PARAM_NUM 23 // THIS IS USED AS A DELIMITER!!
#endif

View File

@@ -120,7 +120,7 @@ void BatchToolPanelCoordinator::initSession () {
pparams = selected[0]->getProcParams ();
coarse->initBatchBehavior ();
curve->setAdjusterBehavior (options.baBehav[ADDSET_TC_EXPCOMP], options.baBehav[ADDSET_TC_BRIGHTNESS], options.baBehav[ADDSET_TC_BLACKLEVEL], options.baBehav[ADDSET_TC_CONTRAST]);
curve->setAdjusterBehavior (options.baBehav[ADDSET_TC_EXPCOMP], options.baBehav[ADDSET_TC_BRIGHTNESS], options.baBehav[ADDSET_TC_BLACKLEVEL], options.baBehav[ADDSET_TC_CONTRAST], options.baBehav[ADDSET_TC_SATURATION]);
lcurve->setAdjusterBehavior (options.baBehav[ADDSET_LC_BRIGHTNESS], options.baBehav[ADDSET_LC_CONTRAST], options.baBehav[ADDSET_LC_SATURATION]);
whitebalance->setAdjusterBehavior (options.baBehav[ADDSET_WB_TEMPERATURE], options.baBehav[ADDSET_WB_GREEN]);
vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT]);

View File

@@ -32,6 +32,7 @@ void ParamsEdited::set (bool v) {
toneCurve.brightness = v;
toneCurve.black = v;
toneCurve.contrast = v;
toneCurve.saturation = v;
toneCurve.shcompr = v;
toneCurve.hlcompr = v;
toneCurve.autoexp = v;
@@ -163,7 +164,8 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
toneCurve.brightness = toneCurve.brightness && p.toneCurve.brightness == other.toneCurve.brightness;
toneCurve.black = toneCurve.black && p.toneCurve.black == other.toneCurve.black;
toneCurve.contrast = toneCurve.contrast && p.toneCurve.contrast == other.toneCurve.contrast;
toneCurve.shcompr = toneCurve.shcompr && p.toneCurve.shcompr == other.toneCurve.shcompr;
toneCurve.saturation = toneCurve.saturation && p.toneCurve.saturation == other.toneCurve.saturation;
toneCurve.shcompr = toneCurve.shcompr && p.toneCurve.shcompr == other.toneCurve.shcompr;
toneCurve.hlcompr = toneCurve.hlcompr && p.toneCurve.hlcompr == other.toneCurve.hlcompr;
toneCurve.autoexp = toneCurve.autoexp && p.toneCurve.autoexp == other.toneCurve.autoexp;
toneCurve.clip = toneCurve.clip && p.toneCurve.clip == other.toneCurve.clip;
@@ -295,6 +297,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (toneCurve.brightness) toEdit.toneCurve.brightness = options.baBehav[ADDSET_TC_BRIGHTNESS] ? toEdit.toneCurve.brightness + mods.toneCurve.brightness : mods.toneCurve.brightness;
if (toneCurve.black) toEdit.toneCurve.black = options.baBehav[ADDSET_TC_BLACKLEVEL] ? toEdit.toneCurve.black + mods.toneCurve.black : mods.toneCurve.black;
if (toneCurve.contrast) toEdit.toneCurve.contrast = options.baBehav[ADDSET_TC_CONTRAST] ? toEdit.toneCurve.contrast + mods.toneCurve.contrast : mods.toneCurve.contrast;
if (toneCurve.saturation) toEdit.toneCurve.saturation = options.baBehav[ADDSET_TC_SATURATION] ? toEdit.toneCurve.saturation + mods.toneCurve.saturation : mods.toneCurve.saturation;
if (toneCurve.shcompr) toEdit.toneCurve.shcompr = mods.toneCurve.shcompr;
if (toneCurve.hlcompr) toEdit.toneCurve.hlcompr = mods.toneCurve.hlcompr;
if (toneCurve.autoexp) toEdit.toneCurve.autoexp = mods.toneCurve.autoexp;

View File

@@ -31,7 +31,8 @@ class ToneCurveParamsEdited {
bool brightness;
bool black;
bool contrast;
bool shcompr;
bool saturation;
bool shcompr;
bool hlcompr;
bool autoexp;
bool clip;

View File

@@ -133,6 +133,7 @@ Gtk::Widget* Preferences::getBatchProcPanel () {
appendBehavList (mi, M("TP_EXPOSURE_BRIGHTNESS"), ADDSET_TC_BRIGHTNESS, false);
appendBehavList (mi, M("TP_EXPOSURE_BLACKLEVEL"), ADDSET_TC_BLACKLEVEL, false);
appendBehavList (mi, M("TP_EXPOSURE_CONTRAST"), ADDSET_TC_CONTRAST, false);
appendBehavList (mi, M("TP_EXPOSURE_SATURATION"), ADDSET_TC_SATURATION, false);
mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_SHADOWSHLIGHTS_LABEL"));

View File

@@ -67,7 +67,8 @@ ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(fal
pack_start (*brightness);
contrast = Gtk::manage (new Adjuster (M("TP_EXPOSURE_CONTRAST"), -100, 100, 1, 0));
pack_start (*contrast);
saturation = Gtk::manage (new Adjuster (M("TP_EXPOSURE_SATURATION"), -100, 100, 1, 0));
pack_start (*saturation);
//----------- Curve ------------------------------
pack_start (*Gtk::manage (new Gtk::HSeparator()));
@@ -91,6 +92,7 @@ ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(fal
hlcompr->setAdjusterListener (this);
shcompr->setAdjusterListener (this);
contrast->setAdjusterListener (this);
saturation->setAdjusterListener (this);
}
void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
@@ -104,7 +106,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
shcompr->setEditedState (pedited->toneCurve.shcompr ? Edited : UnEdited);
brightness->setEditedState (pedited->toneCurve.brightness ? Edited : UnEdited);
contrast->setEditedState (pedited->toneCurve.contrast ? Edited : UnEdited);
autolevels->set_inconsistent (!pedited->toneCurve.autoexp);
saturation->setEditedState (pedited->toneCurve.saturation ? Edited : UnEdited);
autolevels->set_inconsistent (!pedited->toneCurve.autoexp);
clipDirty = pedited->toneCurve.clip;
shape->setUnChanged (!pedited->toneCurve.curve);
}
@@ -121,7 +124,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
shcompr->setValue (pp->toneCurve.shcompr);
brightness->setValue (pp->toneCurve.brightness);
contrast->setValue (pp->toneCurve.contrast);
shape->setCurve (pp->toneCurve.curve);
saturation->setValue (pp->toneCurve.saturation);
shape->setCurve (pp->toneCurve.curve);
enableListener ();
}
@@ -136,6 +140,7 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pp->toneCurve.shcompr = (int)shcompr->getValue ();
pp->toneCurve.brightness = (int)brightness->getValue ();
pp->toneCurve.contrast = (int)contrast->getValue ();
pp->toneCurve.saturation = (int)saturation->getValue ();
pp->toneCurve.curve = shape->getCurve ();
if (pedited) {
@@ -145,7 +150,8 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->toneCurve.shcompr = shcompr->getEditedState ();
pedited->toneCurve.brightness = brightness->getEditedState ();
pedited->toneCurve.contrast = contrast->getEditedState ();
pedited->toneCurve.autoexp = !autolevels->get_inconsistent();
pedited->toneCurve.saturation = saturation->getEditedState ();
pedited->toneCurve.autoexp = !autolevels->get_inconsistent();
pedited->toneCurve.clip = clipDirty;
pedited->toneCurve.curve = !shape->isUnChanged ();
}
@@ -159,6 +165,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
hlcompr->setDefault (defParams->toneCurve.hlcompr);
shcompr->setDefault (defParams->toneCurve.shcompr);
contrast->setDefault (defParams->toneCurve.contrast);
saturation->setDefault (defParams->toneCurve.saturation);
if (pedited) {
expcomp->setDefaultEditedState (pedited->toneCurve.expcomp ? Edited : UnEdited);
@@ -167,6 +174,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
shcompr->setDefaultEditedState (pedited->toneCurve.shcompr ? Edited : UnEdited);
brightness->setDefaultEditedState (pedited->toneCurve.brightness ? Edited : UnEdited);
contrast->setDefaultEditedState (pedited->toneCurve.contrast ? Edited : UnEdited);
saturation->setDefaultEditedState (pedited->toneCurve.saturation ? Edited : UnEdited);
}
else {
expcomp->setDefaultEditedState (Irrelevant);
@@ -175,6 +183,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
shcompr->setDefaultEditedState (Irrelevant);
brightness->setDefaultEditedState (Irrelevant);
contrast->setDefaultEditedState (Irrelevant);
saturation->setDefaultEditedState (Irrelevant);
}
}
@@ -209,6 +218,8 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) {
listener->panelChanged (EvBlack, costr);
else if (a==contrast)
listener->panelChanged (EvContrast, costr);
else if (a==saturation)
listener->panelChanged (EvSaturation, costr);
else if (a==hlcompr)
listener->panelChanged (EvHLCompr, costr);
else if (a==shcompr)
@@ -272,6 +283,7 @@ void ToneCurve::waitForAutoExp () {
hlcompr->setEnabled (false);
shcompr->setEnabled (false);
contrast->setEnabled (false);
saturation->setEnabled (false);
curveEditorG->set_sensitive (false);
}
@@ -301,6 +313,7 @@ void ToneCurve::enableAll () {
hlcompr->setEnabled (true);
shcompr->setEnabled (true);
contrast->setEnabled (true);
saturation->setEnabled (true);
curveEditorG->set_sensitive (true);
}
@@ -329,11 +342,12 @@ void ToneCurve::setBatchMode (bool batchMode) {
shcompr->showEditedCB ();
brightness->showEditedCB ();
contrast->showEditedCB ();
saturation->showEditedCB ();
curveEditorG->setBatchMode (batchMode);
}
void ToneCurve::setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, bool contradd) {
void ToneCurve::setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, bool contradd, bool satadd) {
if ((!expAdd && expadd) || (expAdd && !expadd))
expcomp->setLimits (-5, 5, 0.01, 0);
@@ -345,11 +359,14 @@ void ToneCurve::setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, boo
brightness->setLimits (-100, 100, 1, 0);
if ((!contrAdd && contradd) || (contrAdd && !contradd))
contrast->setLimits (-100, 100, 1, 0);
if ((!satAdd && satadd) || (satAdd && !satadd))
saturation->setLimits (-100, 100, 1, 0);
expAdd = expadd;
blackAdd = blackadd;
brAdd = bradd;
contrAdd = contradd;
satAdd = satadd;
}
void ToneCurve::updateCurveBackgroundHistogram (unsigned* hist) {

View File

@@ -38,7 +38,9 @@ class ToneCurve : public Gtk::VBox, public AdjusterListener, public ToolPanel, p
Adjuster* hlcompr;
Adjuster* shcompr;
Adjuster* contrast;
bool expAdd, blackAdd, brAdd, contrAdd, clipDirty, lastAuto;
Adjuster* saturation;
bool expAdd, blackAdd, brAdd, contrAdd, satAdd, clipDirty, lastAuto;
sigc::connection autoconn;
CurveEditorGroup* curveEditorG;
CurveEditor* shape;
@@ -53,7 +55,7 @@ class ToneCurve : public Gtk::VBox, public AdjusterListener, public ToolPanel, p
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, bool contradd);
void setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, bool contradd, bool satadd);
void adjusterChanged (Adjuster* a, double newval);
void autolevels_toggled ();