RGB curves: option for luminosity mode (issue 1607)

Thanks for help, Jacques!
This commit is contained in:
michael
2013-02-16 22:16:06 -05:00
parent 8ecdb0fdc1
commit d7195e6c38
25 changed files with 160 additions and 29 deletions

View File

@@ -448,6 +448,7 @@ void Options::setDefaults () {
rtSettings.protectredh = 0.3;
rtSettings.CRI_color =0;
rtSettings.autocielab=true;
rtSettings.rgbcurveslumamode_gamut=true;
lastIccDir = rtSettings.iccDirectory;
lastDarkframeDir = rtSettings.darkFramesPath;
lastFlatfieldDir = rtSettings.flatFieldsPath;
@@ -654,6 +655,7 @@ if (keyFile.has_group ("Color Management")) {
if (keyFile.has_key ("Color Management", "AutoMonitorProfile")) rtSettings.autoMonitorProfile = keyFile.get_boolean ("Color Management", "AutoMonitorProfile");
if (keyFile.has_key ("Color Management", "Autocielab")) rtSettings.autocielab = keyFile.get_boolean ("Color Management", "Autocielab");
if (keyFile.has_key ("Color Management", "Ciencamfloat")) rtSettings.ciecamfloat = keyFile.get_boolean ("Color Management", "Ciecamfloat");
if (keyFile.has_key ("Color Management", "RGBcurvesLumamode_Gamut")) rtSettings.rgbcurveslumamode_gamut = keyFile.get_boolean ("Color Management", "RGBcurvesLumamode_Gamut");
if (keyFile.has_key ("Color Management", "Intent")) rtSettings.colorimetricIntent = keyFile.get_integer("Color Management", "Intent");
if (keyFile.has_key ("Color Management", "CRI")) rtSettings.CRI_color = keyFile.get_integer("Color Management", "CRI");
@@ -902,6 +904,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_string ("Color Management", "MonitorProfile", rtSettings.monitorProfile);
keyFile.set_boolean ("Color Management", "AutoMonitorProfile", rtSettings.autoMonitorProfile);
keyFile.set_boolean ("Color Management", "Autocielab", rtSettings.autocielab);
keyFile.set_boolean ("Color Management", "RGBcurvesLumamode_Gamut", rtSettings.rgbcurveslumamode_gamut);
keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent);
keyFile.set_integer ("Color Management", "view", rtSettings.viewingdevice);
keyFile.set_integer ("Color Management", "grey", rtSettings.viewingdevicegrey);

View File

@@ -59,6 +59,7 @@ void ParamsEdited::set (bool v) {
labCurve.rstprotection = v;
labCurve.bwtoning = v;
labCurve.lcredsk = v;
rgbCurves.lumamode = v;
rgbCurves.rcurve = v;
rgbCurves.gcurve = v;
rgbCurves.bcurve = v;
@@ -290,7 +291,8 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
labCurve.avoidcolorshift = labCurve.avoidcolorshift && p.labCurve.avoidcolorshift == other.labCurve.avoidcolorshift;
labCurve.rstprotection = labCurve.rstprotection && p.labCurve.rstprotection == other.labCurve.rstprotection;
labCurve.bwtoning = labCurve.bwtoning && p.labCurve.bwtoning == other.labCurve.bwtoning;
labCurve.lcredsk = labCurve.lcredsk && p.labCurve.lcredsk == other.labCurve.lcredsk;
labCurve.lcredsk = labCurve.lcredsk && p.labCurve.lcredsk == other.labCurve.lcredsk;
rgbCurves.lumamode = rgbCurves.lumamode && p.rgbCurves.lumamode == other.rgbCurves.lumamode;
rgbCurves.rcurve = rgbCurves.rcurve && p.rgbCurves.rcurve == other.rgbCurves.rcurve;
rgbCurves.gcurve = rgbCurves.gcurve && p.rgbCurves.gcurve == other.rgbCurves.gcurve;
rgbCurves.bcurve = rgbCurves.bcurve && p.rgbCurves.bcurve == other.rgbCurves.bcurve;
@@ -523,6 +525,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (labCurve.bwtoning) toEdit.labCurve.bwtoning = mods.labCurve.bwtoning;
if (labCurve.lcredsk) toEdit.labCurve.lcredsk = mods.labCurve.lcredsk;
if (rgbCurves.lumamode) toEdit.rgbCurves.lumamode = mods.rgbCurves.lumamode;
if (rgbCurves.rcurve) toEdit.rgbCurves.rcurve = mods.rgbCurves.rcurve;
if (rgbCurves.gcurve) toEdit.rgbCurves.gcurve = mods.rgbCurves.gcurve;
if (rgbCurves.bcurve) toEdit.rgbCurves.bcurve = mods.rgbCurves.bcurve;

View File

@@ -72,6 +72,7 @@ class LCurveParamsEdited {
class RGBCurvesParamsEdited {
public:
bool lumamode;
bool rcurve;
bool gcurve;
bool bcurve;

View File

@@ -26,6 +26,18 @@ RGBCurves::RGBCurves () : Gtk::VBox(), FoldableToolPanel(this) {
set_border_width(4);
lumamode = Gtk::manage (new Gtk::CheckButton (M("TP_RGBCURVES_LUMAMODE")));
lumamode->set_tooltip_markup (M("TP_RGBCURVES_LUMAMODE_TOOLTIP"));
lumamode->set_active (false);
lumamode->show ();
pack_start (*lumamode);
Gtk::HSeparator *hsep1 = Gtk::manage (new Gtk::HSeparator());
hsep1->show ();
pack_start (*hsep1);
lumamodeConn = lumamode->signal_toggled().connect( sigc::mem_fun(*this, &RGBCurves::lumamodeChanged) );
std::vector<GradientMilestone> milestones;
curveEditorG = new CurveEditorGroup (options.lastRgbCurvesDir, M("TP_RGBCURVES_CHANNEL"));
@@ -66,8 +78,15 @@ void RGBCurves::read (const ProcParams* pp, const ParamsEdited* pedited) {
Rshape->setUnChanged (!pedited->rgbCurves.rcurve);
Gshape->setUnChanged (!pedited->rgbCurves.gcurve);
Bshape->setUnChanged (!pedited->rgbCurves.bcurve);
lumamode->set_inconsistent (!pedited->rgbCurves.lumamode);
}
lumamodeConn.block (true);
lumamode->set_active (pp->rgbCurves.lumamode);
lumamodeConn.block (false);
lastLumamode = pp->rgbCurves.lumamode;
Rshape->setCurve (pp->rgbCurves.rcurve);
Gshape->setCurve (pp->rgbCurves.gcurve);
Bshape->setCurve (pp->rgbCurves.bcurve);
@@ -87,11 +106,13 @@ void RGBCurves::write (ProcParams* pp, ParamsEdited* pedited) {
pp->rgbCurves.rcurve = Rshape->getCurve ();
pp->rgbCurves.gcurve = Gshape->getCurve ();
pp->rgbCurves.bcurve = Bshape->getCurve ();
pp->rgbCurves.lumamode = lumamode->get_active();
if (pedited) {
pedited->rgbCurves.rcurve = !Rshape->isUnChanged ();
pedited->rgbCurves.gcurve = !Gshape->isUnChanged ();
pedited->rgbCurves.bcurve = !Bshape->isUnChanged ();
pedited->rgbCurves.lumamode = !lumamode->get_inconsistent();
}
}
@@ -114,6 +135,29 @@ void RGBCurves::curveChanged (CurveEditor* ce) {
}
}
void RGBCurves::lumamodeChanged () {
if (batchMode) {
if (lumamode->get_inconsistent()) {
lumamode->set_inconsistent (false);
lumamodeConn.block (true);
lumamode->set_active (false);
lumamodeConn.block (false);
}
else if (lastLumamode)
lumamode->set_inconsistent (true);
lastLumamode = lumamode->get_active ();
}
if (listener) {
if (lumamode->get_active ())
listener->panelChanged (EvRGBrCurveLumamode, M("GENERAL_ENABLED"));
else
listener->panelChanged (EvRGBrCurveLumamode, M("GENERAL_DISABLED"));
}
}
void RGBCurves::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);

View File

@@ -34,6 +34,10 @@ class RGBCurves : public Gtk::VBox, public AdjusterListener, public FoldableTool
DiagonalCurveEditor* Gshape;
DiagonalCurveEditor* Bshape;
Gtk::CheckButton* lumamode;
bool lastLumamode;
sigc::connection lumamodeConn;
public:
RGBCurves ();
@@ -46,6 +50,7 @@ class RGBCurves : public Gtk::VBox, public AdjusterListener, public FoldableTool
void curveChanged (CurveEditor* ce);
void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma);
void lumamodeChanged ();
};
#endif