First quick&dirty version of flat region blur, #5075
This commit is contained in:
@@ -27,6 +27,7 @@ Sharpening::Sharpening () : FoldableToolPanel(this, "sharpening", M("TP_SHARPENI
|
||||
{
|
||||
auto m = ProcEventMapper::getInstance();
|
||||
EvSharpenContrast = m->newEvent(SHARPENING, "HISTORY_MSG_SHARPENING_CONTRAST");
|
||||
EvSharpenBlur = m->newEvent(SHARPENING, "HISTORY_MSG_SHARPENING_BLUR");
|
||||
|
||||
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
|
||||
hb->show ();
|
||||
@@ -34,6 +35,10 @@ Sharpening::Sharpening () : FoldableToolPanel(this, "sharpening", M("TP_SHARPENI
|
||||
contrast->setAdjusterListener (this);
|
||||
pack_start(*contrast);
|
||||
contrast->show();
|
||||
blur = Gtk::manage(new Adjuster (M("TP_SHARPENING_BLUR"), 0.2, 2.0, 0.05, 0.2));
|
||||
blur->setAdjusterListener (this);
|
||||
pack_start(*blur);
|
||||
blur->show();
|
||||
|
||||
Gtk::Label* ml = Gtk::manage (new Gtk::Label (M("TP_SHARPENING_METHOD") + ":"));
|
||||
ml->show ();
|
||||
@@ -152,7 +157,8 @@ void Sharpening::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
disableListener ();
|
||||
|
||||
if (pedited) {
|
||||
contrast->setEditedState (pedited->sharpening.contrast ? Edited : UnEdited);
|
||||
contrast->setEditedState (pedited->sharpening.contrast ? Edited : UnEdited);
|
||||
blur->setEditedState (pedited->sharpening.blurradius ? Edited : UnEdited);
|
||||
amount->setEditedState (pedited->sharpening.amount ? Edited : UnEdited);
|
||||
radius->setEditedState (pedited->sharpening.radius ? Edited : UnEdited);
|
||||
threshold->setEditedState (pedited->sharpening.threshold ? Edited : UnEdited);
|
||||
@@ -182,6 +188,7 @@ void Sharpening::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
lastHaloControl = pp->sharpening.halocontrol;
|
||||
|
||||
contrast->setValue (pp->sharpening.contrast);
|
||||
blur->setValue (pp->sharpening.blurradius);
|
||||
amount->setValue (pp->sharpening.amount);
|
||||
radius->setValue (pp->sharpening.radius);
|
||||
threshold->setValue<int>(pp->sharpening.threshold);
|
||||
@@ -224,6 +231,7 @@ void Sharpening::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
{
|
||||
|
||||
pp->sharpening.contrast = contrast->getValue ();
|
||||
pp->sharpening.blurradius = blur->getValue ();
|
||||
pp->sharpening.amount = (int)amount->getValue();
|
||||
pp->sharpening.enabled = getEnabled ();
|
||||
pp->sharpening.radius = radius->getValue ();
|
||||
@@ -246,6 +254,7 @@ void Sharpening::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
|
||||
if (pedited) {
|
||||
pedited->sharpening.contrast = contrast->getEditedState ();
|
||||
pedited->sharpening.blurradius = blur->getEditedState ();
|
||||
pedited->sharpening.amount = amount->getEditedState ();
|
||||
pedited->sharpening.radius = radius->getEditedState ();
|
||||
pedited->sharpening.threshold = threshold->getEditedState ();
|
||||
@@ -266,6 +275,7 @@ void Sharpening::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
void Sharpening::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited)
|
||||
{
|
||||
contrast->setDefault (defParams->sharpening.contrast);
|
||||
blur->setDefault (defParams->sharpening.blurradius);
|
||||
amount->setDefault (defParams->sharpening.amount);
|
||||
radius->setDefault (defParams->sharpening.radius);
|
||||
threshold->setDefault<int> (defParams->sharpening.threshold);
|
||||
@@ -279,6 +289,7 @@ void Sharpening::setDefaults (const ProcParams* defParams, const ParamsEdited* p
|
||||
|
||||
if (pedited) {
|
||||
contrast->setDefaultEditedState (pedited->sharpening.contrast ? Edited : UnEdited);
|
||||
blur->setDefaultEditedState (pedited->sharpening.blurradius ? Edited : UnEdited);
|
||||
amount->setDefaultEditedState (pedited->sharpening.amount ? Edited : UnEdited);
|
||||
radius->setDefaultEditedState (pedited->sharpening.radius ? Edited : UnEdited);
|
||||
threshold->setDefaultEditedState (pedited->sharpening.threshold ? Edited : UnEdited);
|
||||
@@ -291,6 +302,7 @@ void Sharpening::setDefaults (const ProcParams* defParams, const ParamsEdited* p
|
||||
ddamping->setDefaultEditedState (pedited->sharpening.deconvdamping ? Edited : UnEdited);
|
||||
} else {
|
||||
contrast->setDefaultEditedState (Irrelevant);
|
||||
blur->setDefaultEditedState (Irrelevant);
|
||||
amount->setDefaultEditedState (Irrelevant);
|
||||
radius->setDefaultEditedState (Irrelevant);
|
||||
threshold->setDefaultEditedState (Irrelevant);
|
||||
@@ -310,7 +322,7 @@ void Sharpening::adjusterChanged(Adjuster* a, double newval)
|
||||
|
||||
Glib::ustring costr;
|
||||
|
||||
if (a == radius || a == dradius) {
|
||||
if (a == radius || a == dradius || a == blur) {
|
||||
costr = Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), a->getValue());
|
||||
} else if (a == eradius) {
|
||||
costr = Glib::ustring::format (std::setw(2), std::fixed, std::setprecision(1), a->getValue());
|
||||
@@ -324,6 +336,8 @@ void Sharpening::adjusterChanged(Adjuster* a, double newval)
|
||||
listener->panelChanged (EvShrAmount, costr);
|
||||
} else if (a == radius) {
|
||||
listener->panelChanged (EvShrRadius, costr);
|
||||
} else if (a == blur) {
|
||||
listener->panelChanged (EvSharpenBlur, costr);
|
||||
} else if (a == eradius) {
|
||||
listener->panelChanged (EvShrEdgeRadius, costr);
|
||||
} else if (a == etolerance) {
|
||||
@@ -487,6 +501,7 @@ void Sharpening::setBatchMode (bool batchMode)
|
||||
pack_start (*rld);
|
||||
|
||||
contrast->showEditedCB ();
|
||||
blur->showEditedCB ();
|
||||
radius->showEditedCB ();
|
||||
amount->showEditedCB ();
|
||||
threshold->showEditedCB ();
|
||||
@@ -518,6 +533,7 @@ void Sharpening::setAdjusterBehavior (bool contrastadd, bool radiusadd, bool amo
|
||||
void Sharpening::trimValues (rtengine::procparams::ProcParams* pp)
|
||||
{
|
||||
contrast->trimValue(pp->sharpening.contrast);
|
||||
blur->trimValue(pp->sharpening.blurradius);
|
||||
radius->trimValue(pp->sharpening.radius);
|
||||
dradius->trimValue(pp->sharpening.deconvradius);
|
||||
amount->trimValue(pp->sharpening.amount);
|
||||
|
Reference in New Issue
Block a user