Color Appearance Model 2002 added (see issue 1572). Credits: JDesmis for the core (and hard work!), Hombre for the GUI tuning

This commit is contained in:
natureh 510
2012-11-07 23:09:16 +01:00
parent 3be23be585
commit a91efaec78
83 changed files with 4783 additions and 880 deletions

View File

@@ -38,7 +38,7 @@ BatchToolPanelCoordinator::BatchToolPanelCoordinator (FilePanel* parent) : ToolP
metadataPanel = 0;
toiM = 0;
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels[i]->setBatchMode (true);
}
@@ -48,7 +48,7 @@ void BatchToolPanelCoordinator::selectionChanged (const std::vector<Thumbnail*>&
closeSession ();
this->selected = selected;
selFileNames.clear ();
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
selFileNames.push_back (selected[i]->getFileName ());
initSession ();
}
@@ -58,18 +58,18 @@ void BatchToolPanelCoordinator::closeSession (bool save) {
pparamsEdited.set (false);
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
selected[i]->removeThumbnailListener (this);
if (somethingChanged && save) {
// read new values from the gui
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels[i]->write (&pparams, &pparamsEdited);
// combine with initial parameters and set
ProcParams newParams;
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
newParams = initialPP[i];
pparamsEdited.combine (newParams, pparams, selected.size()==1);
@@ -80,7 +80,7 @@ void BatchToolPanelCoordinator::closeSession (bool save) {
selected[i]->setProcParams (newParams, NULL, BATCHEDITOR, true);
}
}
for (size_t i=0; i<paramcListeners.size(); i++)
for (size_t i=0; i<paramcListeners.size(); i++)
paramcListeners[i]->clearParamChanges ();
}
@@ -89,7 +89,7 @@ void BatchToolPanelCoordinator::initSession () {
somethingChanged = false;
initialPP.resize (selected.size());
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
initialPP[i] = selected[i]->getProcParams ();
selected[i]->applyAutoExp (initialPP[i]);
selected[i]->addThumbnailListener (this);
@@ -120,11 +120,15 @@ void BatchToolPanelCoordinator::initSession () {
if (selected.size()==1) {
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels.at(i)->setMultiImage(false);
toneCurve->setAdjusterBehavior (false, false, false, false, false, false, false, false);
lcurve->setAdjusterBehavior (false, false, false);
whitebalance->setAdjusterBehavior (false, false);
vibrance->setAdjusterBehavior (false, false, false);
vignetting->setAdjusterBehavior (false, false, false, false);
colorappearance->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false);
rotate->setAdjusterBehavior (false);
distortion->setAdjusterBehavior (false);
perspective->setAdjusterBehavior (false);
@@ -144,10 +148,14 @@ void BatchToolPanelCoordinator::initSession () {
}
else {
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels.at(i)->setMultiImage(true);
toneCurve->setAdjusterBehavior (options.baBehav[ADDSET_TC_EXPCOMP], options.baBehav[ADDSET_TC_HLCOMPAMOUNT],options.baBehav[ADDSET_TC_HLCOMPTHRESH], options.baBehav[ADDSET_TC_BRIGHTNESS], options.baBehav[ADDSET_TC_BLACKLEVEL],options.baBehav[ADDSET_TC_SHCOMP], options.baBehav[ADDSET_TC_CONTRAST], options.baBehav[ADDSET_TC_SATURATION]);
lcurve->setAdjusterBehavior (options.baBehav[ADDSET_LC_BRIGHTNESS], options.baBehav[ADDSET_LC_CONTRAST], options.baBehav[ADDSET_LC_CHROMATICITY]);
whitebalance->setAdjusterBehavior (options.baBehav[ADDSET_WB_TEMPERATURE], options.baBehav[ADDSET_WB_GREEN]);
vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT], options.baBehav[ADDSET_VIGN_RADIUS], options.baBehav[ADDSET_VIGN_STRENGTH], options.baBehav[ADDSET_VIGN_CENTER]);
colorappearance->setAdjusterBehavior (options.baBehav[ADDSET_CAT_DEGREE], options.baBehav[ADDSET_CAT_ADAPTSCENE], options.baBehav[ADDSET_CAT_ADAPTVIEWING], options.baBehav[ADDSET_CAT_LIGHT], options.baBehav[ADDSET_CAT_CHROMA],options.baBehav[ADDSET_CAT_CONTRAST],options.baBehav[ADDSET_CAT_RSTPRO],options.baBehav[ADDSET_CAT_BRIGHT],options.baBehav[ADDSET_CAT_CONTRAST_Q],options.baBehav[ADDSET_CAT_CHROMA_S],options.baBehav[ADDSET_CAT_CHROMA_M],options.baBehav[ADDSET_CAT_HUE]);
rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]);
distortion->setAdjusterBehavior (options.baBehav[ADDSET_DIST_AMOUNT]);
perspective->setAdjusterBehavior (options.baBehav[ADDSET_PERSPECTIVE]);
@@ -196,6 +204,19 @@ void BatchToolPanelCoordinator::initSession () {
if (options.baBehav[ADDSET_VIBRANCE_PASTELS]) pparams.vibrance.pastels = 0;
if (options.baBehav[ADDSET_VIBRANCE_SATURATED]) pparams.vibrance.saturated = 0;
if (options.baBehav[ADDSET_CAT_DEGREE]) pparams.colorappearance.degree = 0;
if (options.baBehav[ADDSET_CAT_ADAPTSCENE]) pparams.colorappearance.adapscen = 0;
if (options.baBehav[ADDSET_CAT_ADAPTVIEWING]) pparams.colorappearance.adaplum = 0;
if (options.baBehav[ADDSET_CAT_LIGHT]) pparams.colorappearance.jlight = 0;
if (options.baBehav[ADDSET_CAT_BRIGHT]) pparams.colorappearance.qbright = 0;
if (options.baBehav[ADDSET_CAT_CHROMA]) pparams.colorappearance.chroma = 0;
if (options.baBehav[ADDSET_CAT_CHROMA_S]) pparams.colorappearance.schroma = 0;
if (options.baBehav[ADDSET_CAT_CHROMA_M]) pparams.colorappearance.mchroma = 0;
if (options.baBehav[ADDSET_CAT_RSTPRO]) pparams.colorappearance.rstprotection = 0;
if (options.baBehav[ADDSET_CAT_CONTRAST]) pparams.colorappearance.contrast = 0;
if (options.baBehav[ADDSET_CAT_CONTRAST_Q]) pparams.colorappearance.qcontrast = 0;
if (options.baBehav[ADDSET_CAT_HUE]) pparams.colorappearance.colorh = 0;
if (options.baBehav[ADDSET_FREE_OUPUT_GAMMA]) pparams.icm.gampos = 0;
if (options.baBehav[ADDSET_FREE_OUTPUT_SLOPE]) pparams.icm.slpos = 0;
@@ -227,14 +248,14 @@ void BatchToolPanelCoordinator::initSession () {
if (options.baBehav[ADDSET_RAWEXPOS_BLACKS]) pparams.raw.blackzero = pparams.raw.blackone = pparams.raw.blacktwo = pparams.raw.blackthree = 0;
}
for (size_t i=0; i<toolPanels.size(); i++) {
for (size_t i=0; i<toolPanels.size(); i++) {
toolPanels[i]->setDefaults (&pparams, &pparamsEdited);
toolPanels[i]->read (&pparams, &pparamsEdited);
// TODO: autoOpenCurve has been disabled because initSession is called on each parameter change from the editor panel,
// if the thumbnail remains selected in the DirectoryBrowser (i.e. always, unless the user think about deselecting it)
//toolPanels[i]->autoOpenCurve();
}
for (size_t i=0; i<paramcListeners.size(); i++)
for (size_t i=0; i<paramcListeners.size(); i++)
// send this initial state to the History
paramcListeners[i]->procParamsChanged (&pparams, rtengine::EvPhotoLoaded, M("BATCH_PROCESSING"), &pparamsEdited);
}
@@ -249,27 +270,27 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G
pparamsEdited.set (false);
// read new values from the gui
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels[i]->write (&pparams, &pparamsEdited);
// TODO: We may update the crop on coarse rotate events here, like in ToolPanelCoordinator::panelChanged
if (event==rtengine::EvAutoExp || event==rtengine::EvClip)
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
initialPP[i].toneCurve.autoexp = pparams.toneCurve.autoexp;
initialPP[i].toneCurve.clip = pparams.toneCurve.clip;
selected[i]->applyAutoExp (initialPP[i]);
}
if (event==rtengine::EvAutoDIST) {
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
initialPP[i].distortion.amount = pparams.distortion.amount;
}
}
// combine with initial parameters and set
ProcParams newParams;
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
newParams = initialPP[i];
// If only one file is selected, slider's addMode has been set to false, and hence the behave
// like in SET mode like in an editor ; that's why we force the combination to the SET mode too
@@ -282,7 +303,7 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G
selected[i]->setProcParams (newParams, NULL, BATCHEDITOR, false);
}
for (size_t i=0; i<paramcListeners.size(); i++)
for (size_t i=0; i<paramcListeners.size(); i++)
paramcListeners[i]->procParamsChanged (&pparams, event, descr, &pparamsEdited);
}
@@ -330,7 +351,7 @@ void BatchToolPanelCoordinator::profileChange (const rtengine::procparams::Part
pparamsEdited = *paramsEdited;
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i=0; i<toolPanels.size(); i++)
// writing the values to the GUI
toolPanels[i]->read (&pparams, &pparamsEdited);
// I guess we don't want to automatically unfold curve editors here...
@@ -338,18 +359,18 @@ void BatchToolPanelCoordinator::profileChange (const rtengine::procparams::Part
somethingChanged = true;
// read new values from the gui
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels[i]->write (&pparams, &pparamsEdited);
// combine with initial parameters of each image and set
ProcParams newParams;
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
newParams = initialPP[i];
pparamsEdited.combine (newParams, pparams, true);
selected[i]->setProcParams (newParams, NULL, BATCHEDITOR, false);
}
for (size_t i=0; i<paramcListeners.size(); i++)
for (size_t i=0; i<paramcListeners.size(); i++)
paramcListeners[i]->procParamsChanged (&pparams, event, descr, &pparamsEdited);
}
@@ -379,7 +400,7 @@ void BatchToolPanelCoordinator::spotWBselected (int x, int y, Thumbnail* thm) {
// toolBar->setTool (TOOL_HAND);
if (x>0 && y>0 && thm) {
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
if (selected[i]==thm) {
double temp;
double green;