Capture sharpening: removed gamma

This commit is contained in:
Ingo Weyrich
2019-11-10 16:05:24 +01:00
parent 5235a82a70
commit d32c570383
9 changed files with 30 additions and 87 deletions

View File

@@ -37,7 +37,6 @@ PdSharpening::PdSharpening() :
{
auto m = ProcEventMapper::getInstance();
EvPdShrContrast = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_CONTRAST");
EvPdSharpenGamma = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_GAMMA");
EvPdShrDRadius = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS");
EvPdShrDRadiusOffset = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS_BOOST");
EvPdShrDIterations = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_ITERATIONS");
@@ -57,17 +56,14 @@ PdSharpening::PdSharpening() :
pack_start(*hb);
Gtk::VBox* rld = Gtk::manage(new Gtk::VBox());
gamma = Gtk::manage(new Adjuster(M("TP_SHARPENING_GAMMA"), 0.5, 6.0, 0.05, 1.00));
dradius = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS"), 0.4, 1.15, 0.01, 0.75));
dradius->addAutoButton();
dradius->setAutoValue(true);
dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_BOOST"), -0.5, 0.5, 0.01, 0.0));
diter = Gtk::manage(new Adjuster(M("TP_SHARPENING_RLD_ITERATIONS"), 1, 100, 1, 20));
rld->pack_start(*gamma);
rld->pack_start(*dradius);
rld->pack_start(*dradiusOffset);
rld->pack_start(*diter);
gamma->show();
dradius->show();
dradiusOffset->show();
diter->show();
@@ -76,13 +72,11 @@ PdSharpening::PdSharpening() :
dradius->setAdjusterListener(this);
dradiusOffset->setAdjusterListener(this);
gamma->setAdjusterListener(this);
diter->setAdjusterListener(this);
contrast->delay = std::max(contrast->delay, options.adjusterMaxDelay);
dradius->delay = std::max(dradius->delay, options.adjusterMaxDelay);
dradiusOffset->delay = std::max(dradiusOffset->delay, options.adjusterMaxDelay);
gamma->delay = std::max(gamma->delay, options.adjusterMaxDelay);
diter->delay = std::max(diter->delay, options.adjusterMaxDelay);
}
@@ -101,7 +95,6 @@ void PdSharpening::read(const ProcParams* pp, const ParamsEdited* pedited)
contrast->setEditedState(pedited->pdsharpening.contrast ? Edited : UnEdited);
contrast->setAutoInconsistent(multiImage && !pedited->pdsharpening.autoContrast);
dradius->setAutoInconsistent(multiImage && !pedited->pdsharpening.autoRadius);
gamma->setEditedState(pedited->pdsharpening.gamma ? Edited : UnEdited);
dradius->setEditedState(pedited->pdsharpening.deconvradius ? Edited : UnEdited);
dradiusOffset->setEditedState(pedited->pdsharpening.deconvradiusOffset ? Edited : UnEdited);
diter->setEditedState(pedited->pdsharpening.deconviter ? Edited : UnEdited);
@@ -113,7 +106,6 @@ void PdSharpening::read(const ProcParams* pp, const ParamsEdited* pedited)
contrast->setValue(pp->pdsharpening.contrast);
contrast->setAutoValue(pp->pdsharpening.autoContrast);
gamma->setValue(pp->pdsharpening.gamma);
dradius->setValue(pp->pdsharpening.deconvradius);
dradius->setAutoValue(pp->pdsharpening.autoRadius);
dradiusOffset->setValue(pp->pdsharpening.deconvradiusOffset);
@@ -130,7 +122,6 @@ void PdSharpening::write(ProcParams* pp, ParamsEdited* pedited)
pp->pdsharpening.contrast = contrast->getValue();
pp->pdsharpening.autoContrast = contrast->getAutoValue();
pp->pdsharpening.enabled = getEnabled();
pp->pdsharpening.gamma = gamma->getValue();
pp->pdsharpening.deconvradius = dradius->getValue();
pp->pdsharpening.autoRadius = dradius->getAutoValue();
pp->pdsharpening.deconvradiusOffset = dradiusOffset->getValue();
@@ -139,7 +130,6 @@ void PdSharpening::write(ProcParams* pp, ParamsEdited* pedited)
if (pedited) {
pedited->pdsharpening.contrast = contrast->getEditedState();
pedited->pdsharpening.autoContrast = !contrast->getAutoInconsistent();
pedited->pdsharpening.gamma = gamma->getEditedState();
pedited->pdsharpening.deconvradius = dradius->getEditedState();
pedited->pdsharpening.autoRadius = !dradius->getAutoInconsistent();
pedited->pdsharpening.deconvradiusOffset = dradiusOffset->getEditedState();
@@ -152,20 +142,17 @@ void PdSharpening::setDefaults(const ProcParams* defParams, const ParamsEdited*
{
contrast->setDefault(defParams->pdsharpening.contrast);
gamma->setDefault(defParams->pdsharpening.gamma);
dradius->setDefault(defParams->pdsharpening.deconvradius);
dradiusOffset->setDefault(defParams->pdsharpening.deconvradiusOffset);
diter->setDefault(defParams->pdsharpening.deconviter);
if (pedited) {
contrast->setDefaultEditedState(pedited->pdsharpening.contrast ? Edited : UnEdited);
gamma->setDefaultEditedState(pedited->pdsharpening.gamma ? Edited : UnEdited);
dradius->setDefaultEditedState(pedited->pdsharpening.deconvradius ? Edited : UnEdited);
dradiusOffset->setDefaultEditedState(pedited->pdsharpening.deconvradiusOffset ? Edited : UnEdited);
diter->setDefaultEditedState(pedited->pdsharpening.deconviter ? Edited : UnEdited);
} else {
contrast->setDefaultEditedState(Irrelevant);
gamma->setDefaultEditedState(Irrelevant);
dradius->setDefaultEditedState(Irrelevant);
dradiusOffset->setDefaultEditedState(Irrelevant);
diter->setDefaultEditedState(Irrelevant);
@@ -178,7 +165,7 @@ void PdSharpening::adjusterChanged(Adjuster* a, double newval)
Glib::ustring costr;
if (a == gamma || a == dradius || a == dradiusOffset) {
if (a == dradius || a == dradiusOffset) {
costr = Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2), a->getValue());
} else {
costr = Glib::ustring::format((int)a->getValue());
@@ -186,8 +173,6 @@ void PdSharpening::adjusterChanged(Adjuster* a, double newval)
if (a == contrast) {
listener->panelChanged(EvPdShrContrast, costr);
} else if (a == gamma) {
listener->panelChanged(EvPdSharpenGamma, costr);
} else if (a == dradius) {
listener->panelChanged(EvPdShrDRadius, costr);
} else if (a == dradiusOffset) {
@@ -217,17 +202,15 @@ void PdSharpening::setBatchMode(bool batchMode)
ToolPanel::setBatchMode(batchMode);
contrast->showEditedCB();
gamma->showEditedCB();
dradius->showEditedCB();
dradiusOffset->showEditedCB();
diter->showEditedCB();
}
void PdSharpening::setAdjusterBehavior(bool contrastadd, bool gammaadd, bool radiusadd, bool iteradd)
void PdSharpening::setAdjusterBehavior(bool contrastadd, bool radiusadd, bool iteradd)
{
contrast->setAddMode(contrastadd);
gamma->setAddMode(gammaadd);
dradius->setAddMode(radiusadd);
dradiusOffset->setAddMode(radiusadd);
diter->setAddMode(iteradd);
@@ -237,7 +220,6 @@ void PdSharpening::trimValues(rtengine::procparams::ProcParams* pp)
{
contrast->trimValue(pp->pdsharpening.contrast);
gamma->trimValue(pp->pdsharpening.gamma);
dradius->trimValue(pp->pdsharpening.deconvradius);
dradiusOffset->trimValue(pp->pdsharpening.deconvradiusOffset);
diter->trimValue(pp->pdsharpening.deconviter);
@@ -271,47 +253,25 @@ void PdSharpening::autoRadiusChanged(double autoRadius)
void PdSharpening::adjusterAutoToggled(Adjuster* a, bool newval)
{
if (a == contrast) {
if (multiImage) {
if (contrast->getAutoInconsistent()) {
contrast->setAutoInconsistent(false);
contrast->setAutoValue(false);
} else if (lastAutoContrast) {
contrast->setAutoInconsistent(true);
}
lastAutoContrast = contrast->getAutoValue();
if (multiImage) {
if (a->getAutoInconsistent()) {
a->setAutoInconsistent(false);
a->setAutoValue(false);
} else if (lastAutoRadius) {
a->setAutoInconsistent(true);
}
if (listener) {
if (contrast->getAutoInconsistent()) {
listener->panelChanged(EvPdShrAutoContrast, M("GENERAL_UNCHANGED"));
} else if (contrast->getAutoValue()) {
listener->panelChanged(EvPdShrAutoContrast, M("GENERAL_ENABLED"));
} else {
listener->panelChanged(EvPdShrAutoContrast, M("GENERAL_DISABLED"));
}
}
} else { // must be dradius
if (multiImage) {
if (dradius->getAutoInconsistent()) {
dradius->setAutoInconsistent(false);
dradius->setAutoValue(false);
} else if (lastAutoRadius) {
dradius->setAutoInconsistent(true);
}
(a == contrast ? lastAutoContrast : lastAutoRadius) = a->getAutoValue();
}
lastAutoRadius = dradius->getAutoValue();
}
if (listener) {
if (dradius->getAutoInconsistent()) {
listener->panelChanged(EvPdShrAutoRadius, M("GENERAL_UNCHANGED"));
} else if (dradius->getAutoValue()) {
listener->panelChanged(EvPdShrAutoRadius, M("GENERAL_ENABLED"));
} else {
listener->panelChanged(EvPdShrAutoRadius, M("GENERAL_DISABLED"));
}
if (listener) {
const auto event = (a == contrast ? EvPdShrAutoContrast : EvPdShrAutoRadius);
if (a->getAutoInconsistent()) {
listener->panelChanged(event, M("GENERAL_UNCHANGED"));
} else if (a->getAutoValue()) {
listener->panelChanged(event, M("GENERAL_ENABLED"));
} else {
listener->panelChanged(event, M("GENERAL_DISABLED"));
}
}
}