Allow vignetting to become really strong for artistic purposes.

Also allows to change the center of vignetting.
This commit is contained in:
Jacek Poplawski
2010-10-30 13:01:38 +02:00
parent 725508ec01
commit abe8f457d1
8 changed files with 132 additions and 37 deletions

View File

@@ -107,6 +107,9 @@ void ParamsEdited::set (bool v) {
cacorrection.blue = v;
vignetting.amount = v;
vignetting.radius = v;
vignetting.strength = v;
vignetting.centerX = v;
vignetting.centerY = v;
chmixer.red[0] = v;
chmixer.red[1] = v;
chmixer.red[2] = v;
@@ -234,6 +237,9 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
cacorrection.blue = cacorrection.blue && p.cacorrection.blue == other.cacorrection.blue;
vignetting.amount = vignetting.amount && p.vignetting.amount == other.vignetting.amount;
vignetting.radius = vignetting.radius && p.vignetting.radius == other.vignetting.radius;
vignetting.strength = vignetting.strength && p.vignetting.strength == other.vignetting.strength;
vignetting.centerX = vignetting.centerX && p.vignetting.centerX == other.vignetting.centerX;
vignetting.centerY = vignetting.centerY && p.vignetting.centerY == other.vignetting.centerY;
chmixer.red[0] = chmixer.red[0] && p.chmixer.red[0] == other.chmixer.red[0];
chmixer.red[1] = chmixer.red[1] && p.chmixer.red[1] == other.chmixer.red[1];
chmixer.red[2] = chmixer.red[2] && p.chmixer.red[2] == other.chmixer.red[2];
@@ -352,6 +358,9 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (cacorrection.blue) toEdit.cacorrection.blue = options.baBehav[ADDSET_CA] ? toEdit.cacorrection.blue + mods.cacorrection.blue : mods.cacorrection.blue;
if (vignetting.amount) toEdit.vignetting.amount = options.baBehav[ADDSET_VIGN_AMOUNT] ? toEdit.vignetting.amount + mods.vignetting.amount : mods.vignetting.amount;
if (vignetting.radius) toEdit.vignetting.radius = mods.vignetting.radius;
if (vignetting.strength) toEdit.vignetting.strength = mods.vignetting.strength;
if (vignetting.centerX) toEdit.vignetting.centerX = mods.vignetting.centerX;
if (vignetting.centerY) toEdit.vignetting.centerY = mods.vignetting.centerY;
if (chmixer.red[0]) toEdit.chmixer.red[0] = mods.chmixer.red[0];
if (chmixer.red[1]) toEdit.chmixer.red[1] = mods.chmixer.red[1];
if (chmixer.red[2]) toEdit.chmixer.red[2] = mods.chmixer.red[2];

View File

@@ -191,6 +191,9 @@ class VignettingParamsEdited {
public:
bool amount;
bool radius;
bool strength;
bool centerX;
bool centerY;
};
class ChannelMixerParamsEdited {

View File

@@ -30,8 +30,20 @@ Vignetting::Vignetting () : vigAdd(false) {
radius = Gtk::manage (new Adjuster (M("TP_VIGNETTING_RADIUS"), 0, 100, 1, 50));
radius->setAdjusterListener (this);
strength = Gtk::manage (new Adjuster (M("TP_VIGNETTING_STRENGTH"), 1, 100, 1, 1));
strength->setAdjusterListener (this);
centerX = Gtk::manage (new Adjuster (M("TP_VIGNETTING_CENTER_X"), -100, 100, 1, 0));
centerX->setAdjusterListener (this);
centerY = Gtk::manage (new Adjuster (M("TP_VIGNETTING_CENTER_Y"), -100, 100, 1, 0));
centerY->setAdjusterListener (this);
pack_start (*amount);
pack_start (*radius);
pack_start (*strength);
pack_start (*centerX);
pack_start (*centerY);
show_all();
}
@@ -45,6 +57,9 @@ void Vignetting::read (const ProcParams* pp, const ParamsEdited* pedited) {
amount->setValue (pp->vignetting.amount);
radius->setValue (pp->vignetting.radius);
strength->setValue (pp->vignetting.strength);
centerX->setValue (pp->vignetting.centerX);
centerY->setValue (pp->vignetting.centerY);
enableListener ();
}
@@ -53,6 +68,9 @@ void Vignetting::write (ProcParams* pp, ParamsEdited* pedited) {
pp->vignetting.amount = (int)amount->getValue ();
pp->vignetting.radius = (int)radius->getValue ();
pp->vignetting.strength = (int)strength->getValue ();
pp->vignetting.centerX = (int)centerX->getValue ();
pp->vignetting.centerY = (int)centerY->getValue ();
if (pedited)
pedited->vignetting.amount = amount->getEditedState ();
@@ -62,6 +80,9 @@ void Vignetting::setDefaults (const ProcParams* defParams, const ParamsEdited* p
amount->setDefault (defParams->vignetting.amount);
radius->setDefault (defParams->vignetting.radius);
strength->setDefault (defParams->vignetting.strength);
centerX->setDefault (defParams->vignetting.centerX);
centerY->setDefault (defParams->vignetting.centerY);
if (pedited)
amount->setDefaultEditedState (pedited->vignetting.amount ? Edited : UnEdited);
@@ -72,7 +93,7 @@ void Vignetting::setDefaults (const ProcParams* defParams, const ParamsEdited* p
void Vignetting::adjusterChanged (Adjuster* a, double newval) {
if (listener)
listener->panelChanged (EvVignetting, Glib::ustring::compose ("%1=%3\n%2=%4", M("TP_VIGNETTING_AMOUNT"), M("TP_VIGNETTING_RADIUS"), (int)amount->getValue(), (int)radius->getValue()));
listener->panelChanged (EvVignetting, Glib::ustring::compose ("%1=%5\n%2=%6\n%3=%7\n%4=%8 %9", M("TP_VIGNETTING_AMOUNT"), M("TP_VIGNETTING_RADIUS"), M("TP_VIGNETTING_STRENGTH"), M("TP_VIGNETTING_CENTER"), (int)amount->getValue(), (int)radius->getValue(), (int)strength->getValue(), (int)centerX->getValue(), (int)centerY->getValue()));
}
void Vignetting::setAdjusterBehavior (bool bvadd) {

View File

@@ -28,6 +28,9 @@ class Vignetting : public Gtk::VBox, public AdjusterListener, public ToolPanel {
protected:
Adjuster* amount;
Adjuster* radius;
Adjuster* strength;
Adjuster* centerX;
Adjuster* centerY;
bool vigAdd;
public: