@@ -296,7 +296,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
|
||||
currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method);
|
||||
|
||||
if (params.wb.method == "Camera") {
|
||||
if (!params.wb.enabled) {
|
||||
currWB = ColorTemp();
|
||||
} else if (params.wb.method == "Camera") {
|
||||
currWB = imgsrc->getWB ();
|
||||
} else if (params.wb.method == "Auto") {
|
||||
if (lastAwbEqual != params.wb.equal || lastAwbTempBias != params.wb.tempBias) {
|
||||
@@ -320,10 +322,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
currWB = autoWB;
|
||||
}
|
||||
|
||||
if (params.wb.enabled) {
|
||||
params.wb.temperature = currWB.getTemp ();
|
||||
params.wb.green = currWB.getGreen ();
|
||||
}
|
||||
|
||||
if (params.wb.method == "Auto" && awbListener) {
|
||||
if (params.wb.method == "Auto" && awbListener && params.wb.enabled) {
|
||||
awbListener->WBChanged (params.wb.temperature, params.wb.green);
|
||||
}
|
||||
|
||||
|
||||
@@ -511,14 +511,13 @@ enum ProcEvent {
|
||||
EvCATgreensc = 481,
|
||||
EvCATybscen = 482,
|
||||
EvCATAutoyb = 483,
|
||||
// profiled lens correction new events
|
||||
EvLensCorrMode = 484,
|
||||
EvLensCorrLensfunCamera = 485,
|
||||
EvLensCorrLensfunLens = 486,
|
||||
// Fattal tone mapping
|
||||
EvTMFattalEnabled = 487,
|
||||
EvTMFattalThreshold = 488,
|
||||
EvTMFattalAmount = 489,
|
||||
EvWBEnabled = 490,
|
||||
|
||||
NUMOFEVENTS
|
||||
|
||||
|
||||
@@ -1094,6 +1094,7 @@ bool VibranceParams::operator !=(const VibranceParams& other) const
|
||||
}
|
||||
|
||||
WBParams::WBParams() :
|
||||
enabled(true),
|
||||
method("Camera"),
|
||||
temperature(6504),
|
||||
green(1.0),
|
||||
@@ -1105,7 +1106,8 @@ WBParams::WBParams() :
|
||||
bool WBParams::operator ==(const WBParams& other) const
|
||||
{
|
||||
return
|
||||
method == other.method
|
||||
enabled == other.enabled
|
||||
&& method == other.method
|
||||
&& temperature == other.temperature
|
||||
&& green == other.green
|
||||
&& equal == other.equal
|
||||
@@ -2864,6 +2866,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
|
||||
saveToKeyfile(!pedited || pedited->sharpenMicro.uniformity, "SharpenMicro", "Uniformity", sharpenMicro.uniformity, keyFile);
|
||||
|
||||
// WB
|
||||
saveToKeyfile(!pedited || pedited->wb.enabled, "White Balance", "Enabled", wb.enabled, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->wb.method, "White Balance", "Setting", wb.method, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->wb.temperature, "White Balance", "Temperature", wb.temperature, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->wb.green, "White Balance", "Green", wb.green, keyFile);
|
||||
@@ -3696,6 +3699,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
|
||||
}
|
||||
|
||||
if (keyFile.has_group ("White Balance")) {
|
||||
assignFromKeyfile(keyFile, "White Balance", "Enabled", pedited, wb.enabled, pedited->wb.enabled);
|
||||
assignFromKeyfile(keyFile, "White Balance", "Setting", pedited, wb.method, pedited->wb.method);
|
||||
assignFromKeyfile(keyFile, "White Balance", "Temperature", pedited, wb.temperature, pedited->wb.temperature);
|
||||
assignFromKeyfile(keyFile, "White Balance", "Green", pedited, wb.green, pedited->wb.green);
|
||||
|
||||
@@ -538,6 +538,7 @@ struct WBEntry {
|
||||
};
|
||||
|
||||
struct WBParams {
|
||||
bool enabled;
|
||||
Glib::ustring method;
|
||||
int temperature;
|
||||
double green;
|
||||
|
||||
@@ -516,7 +516,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
|
||||
DARKFRAME, // EvLensCorrLensfunLens
|
||||
ALLNORAW, // EvTMFattalEnabled
|
||||
HDR, // EvTMFattalThreshold
|
||||
HDR // EvTMFattalAmount
|
||||
|
||||
HDR, // EvTMFattalAmount
|
||||
ALLNORAW // EvWBEnabled
|
||||
};
|
||||
|
||||
|
||||
@@ -944,7 +944,9 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
|
||||
// compute WB multipliers
|
||||
ColorTemp currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method);
|
||||
|
||||
if (params.wb.method == "Camera") {
|
||||
if (!params.wb.enabled) {
|
||||
currWB = ColorTemp();
|
||||
} else if (params.wb.method == "Camera") {
|
||||
//recall colorMatrix is rgb_cam
|
||||
double cam_r = colorMatrix[0][0] * camwbRed + colorMatrix[0][1] * camwbGreen + colorMatrix[0][2] * camwbBlue;
|
||||
double cam_g = colorMatrix[1][0] * camwbRed + colorMatrix[1][1] * camwbGreen + colorMatrix[1][2] * camwbBlue;
|
||||
@@ -954,12 +956,19 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
|
||||
currWB = ColorTemp (autoWBTemp, autoWBGreen, wbEqual, "Custom");
|
||||
}
|
||||
|
||||
double rm, gm, bm;
|
||||
if (currWB.getTemp() < 0) {
|
||||
rm = redMultiplier;
|
||||
gm = greenMultiplier;
|
||||
bm = blueMultiplier;
|
||||
} else {
|
||||
double r, g, b;
|
||||
currWB.getMultipliers (r, g, b);
|
||||
//iColorMatrix is cam_rgb
|
||||
double rm = iColorMatrix[0][0] * r + iColorMatrix[0][1] * g + iColorMatrix[0][2] * b;
|
||||
double gm = iColorMatrix[1][0] * r + iColorMatrix[1][1] * g + iColorMatrix[1][2] * b;
|
||||
double bm = iColorMatrix[2][0] * r + iColorMatrix[2][1] * g + iColorMatrix[2][2] * b;
|
||||
rm = iColorMatrix[0][0] * r + iColorMatrix[0][1] * g + iColorMatrix[0][2] * b;
|
||||
gm = iColorMatrix[1][0] * r + iColorMatrix[1][1] * g + iColorMatrix[1][2] * b;
|
||||
bm = iColorMatrix[2][0] * r + iColorMatrix[2][1] * g + iColorMatrix[2][2] * b;
|
||||
}
|
||||
rm = camwbRed / rm;
|
||||
gm = camwbGreen / gm;
|
||||
bm = camwbBlue / bm;
|
||||
|
||||
@@ -223,7 +223,9 @@ private:
|
||||
// set the color temperature
|
||||
currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method);
|
||||
|
||||
if (params.wb.method == "Camera") {
|
||||
if (!params.wb.enabled) {
|
||||
currWB = ColorTemp();
|
||||
} else if (params.wb.method == "Camera") {
|
||||
currWB = imgsrc->getWB ();
|
||||
} else if (params.wb.method == "Auto") {
|
||||
double rm, gm, bm;
|
||||
|
||||
@@ -219,6 +219,7 @@ void ParamsEdited::set (bool v)
|
||||
//colorBoost.avoidclip = v;
|
||||
//colorBoost.enable_saturationlimiter = v;
|
||||
//colorBoost.saturationlimit = v;
|
||||
wb.enabled = v;
|
||||
wb.method = v;
|
||||
wb.green = v;
|
||||
wb.temperature = v;
|
||||
@@ -758,6 +759,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
|
||||
//colorBoost.avoidclip = colorBoost.avoidclip && p.colorBoost.avoidclip == other.colorBoost.avoidclip;
|
||||
//colorBoost.enable_saturationlimiter = colorBoost.enable_saturationlimiter && p.colorBoost.enable_saturationlimiter == other.colorBoost.enable_saturationlimiter;
|
||||
//colorBoost.saturationlimit = colorBoost.saturationlimit && p.colorBoost.saturationlimit == other.colorBoost.saturationlimit;
|
||||
wb.enabled = wb.enabled && p.wb.enabled == other.wb.enabled;
|
||||
wb.method = wb.method && p.wb.method == other.wb.method;
|
||||
wb.green = wb.green && p.wb.green == other.wb.green;
|
||||
wb.equal = wb.equal && p.wb.equal == other.wb.equal;
|
||||
@@ -1664,6 +1666,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
//if (colorBoost.avoidclip) toEdit.colorBoost.avoidclip = mods.colorBoost.avoidclip;
|
||||
//if (colorBoost.enable_saturationlimiter)toEdit.colorBoost.enable_saturationlimiter = mods.colorBoost.enable_saturationlimiter;
|
||||
//if (colorBoost.saturationlimit) toEdit.colorBoost.saturationlimit = mods.colorBoost.saturationlimit;
|
||||
if (wb.enabled) {
|
||||
toEdit.wb.enabled = mods.wb.enabled;
|
||||
}
|
||||
|
||||
if (wb.method) {
|
||||
toEdit.wb.method = mods.wb.method;
|
||||
}
|
||||
|
||||
@@ -229,6 +229,7 @@ class WBParamsEdited
|
||||
{
|
||||
|
||||
public:
|
||||
bool enabled;
|
||||
bool method;
|
||||
bool temperature;
|
||||
bool green;
|
||||
|
||||
@@ -147,7 +147,7 @@ static double wbTemp2Slider(double temp)
|
||||
return sval;
|
||||
}
|
||||
|
||||
WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WBALANCE_LABEL")), wbp(nullptr), wblistener(nullptr)
|
||||
WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WBALANCE_LABEL"), false, true), wbp(nullptr), wblistener(nullptr)
|
||||
{
|
||||
|
||||
Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox ());
|
||||
@@ -349,9 +349,23 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB
|
||||
spotsize->signal_changed().connect( sigc::mem_fun(*this, &WhiteBalance::spotSizeChanged) );
|
||||
}
|
||||
|
||||
|
||||
void WhiteBalance::enabledChanged()
|
||||
{
|
||||
if (listener) {
|
||||
if (get_inconsistent()) {
|
||||
listener->panelChanged(EvWBEnabled, M("GENERAL_UNCHANGED"));
|
||||
} else if (getEnabled()) {
|
||||
listener->panelChanged(EvWBEnabled, M("GENERAL_ENABLED"));
|
||||
} else {
|
||||
listener->panelChanged(EvWBEnabled, M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WhiteBalance::adjusterChanged (Adjuster* a, double newval)
|
||||
{
|
||||
|
||||
int tVal = (int)temp->getValue();
|
||||
double gVal = green->getValue();
|
||||
double eVal = equal->getValue();
|
||||
@@ -400,7 +414,7 @@ void WhiteBalance::adjusterChanged (Adjuster* a, double newval)
|
||||
|
||||
// Recomputing AutoWB if it's the current method will happen in improccoordinator.cc
|
||||
|
||||
if (listener) {
|
||||
if (listener && getEnabled()) {
|
||||
if (a == temp) {
|
||||
listener->panelChanged (EvWBTemp, Glib::ustring::format ((int)a->getValue()));
|
||||
} else if (a == green) {
|
||||
@@ -415,7 +429,6 @@ void WhiteBalance::adjusterChanged (Adjuster* a, double newval)
|
||||
|
||||
void WhiteBalance::optChanged ()
|
||||
{
|
||||
|
||||
Gtk::TreeModel::Row row = getActiveMethod();
|
||||
|
||||
if (row == refTreeModel->children().end()) {
|
||||
@@ -520,7 +533,7 @@ void WhiteBalance::optChanged ()
|
||||
}
|
||||
}
|
||||
|
||||
if (listener) {
|
||||
if (listener && getEnabled()) {
|
||||
listener->panelChanged (EvWBMethod, row[methodColumns.colLabel]);
|
||||
}
|
||||
}
|
||||
@@ -528,7 +541,6 @@ void WhiteBalance::optChanged ()
|
||||
|
||||
void WhiteBalance::spotPressed ()
|
||||
{
|
||||
|
||||
if (wblistener) {
|
||||
wblistener->spotWBRequested (getSize());
|
||||
}
|
||||
@@ -667,6 +679,11 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
tempBias->set_sensitive(wbValues.type == WBEntry::Type::AUTO);
|
||||
}
|
||||
|
||||
setEnabled(pp->wb.enabled);
|
||||
if (pedited) {
|
||||
set_inconsistent(multiImage && !pedited->wb.enabled);
|
||||
}
|
||||
|
||||
methconn.block (false);
|
||||
enableListener ();
|
||||
}
|
||||
@@ -682,8 +699,11 @@ void WhiteBalance::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
pedited->wb.equal = equal->getEditedState ();
|
||||
pedited->wb.tempBias = tempBias->getEditedState ();
|
||||
pedited->wb.method = row[methodColumns.colLabel] != M("GENERAL_UNCHANGED");
|
||||
pedited->wb.enabled = !get_inconsistent();
|
||||
}
|
||||
|
||||
pp->wb.enabled = getEnabled();
|
||||
|
||||
const std::pair<bool, const WBEntry&> ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI);
|
||||
|
||||
if (ppMethod.first) {
|
||||
@@ -756,6 +776,7 @@ void WhiteBalance::setWB (int vtemp, double vgreen)
|
||||
|
||||
methconn.block(true);
|
||||
const std::pair<bool, const WBEntry&> wbValues = findWBEntry("Custom", WBLT_PP);
|
||||
setEnabled(true);
|
||||
temp->setValue (vtemp);
|
||||
green->setValue (vgreen);
|
||||
opt = setActiveMethod(wbValues.second.GUILabel);
|
||||
@@ -876,6 +897,7 @@ void WhiteBalance::WBChanged(double temperature, double greenVal)
|
||||
{
|
||||
GThreadLock lock;
|
||||
disableListener();
|
||||
setEnabled(true);
|
||||
temp->setValue(temperature);
|
||||
green->setValue(greenVal);
|
||||
temp->setDefault(temperature);
|
||||
|
||||
@@ -119,6 +119,7 @@ public:
|
||||
|
||||
void setAdjusterBehavior (bool tempadd, bool greenadd, bool equaladd, bool tempbiasadd);
|
||||
void trimValues (rtengine::procparams::ProcParams* pp);
|
||||
void enabledChanged();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user