From 7671edbca7a68781a5df3f172b02d07038e0081a Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 30 Jan 2018 16:28:47 +0100 Subject: [PATCH] Add duplicated Spot --- rtdata/languages/default | 2 + rtengine/improccoordinator.cc | 235 +++++++++++++++++++++++++++++++--- rtengine/improccoordinator.h | 2 +- rtengine/procparams.cc | 7 +- rtengine/procparams.h | 3 +- rtengine/rtengine.h | 2 +- rtgui/locallab.cc | 90 ++++++++++++- rtgui/locallab.h | 15 ++- rtgui/paramsedited.cc | 7 + rtgui/paramsedited.h | 2 +- 10 files changed, 336 insertions(+), 29 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 430c888cd..1e42863b6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1921,6 +1921,8 @@ TP_LOCALLAB_SENSIH;Hue Scope TP_LOCALLAB_SENSIH_TOOLTIP;Adjust scope of action:\nSmall values limit action to colors very similar to those under the center spot.\nHigh values let the tool act upon a wider range of colors.\nValues smaller than 20 lead to a better algorithm. TP_LOCALLAB_SHAPETYPE;Shape RT-spot area TP_LOCALLAB_SHAPE_TOOLTIP;Rectangle is only in normal mode. +TP_LOCALLAB_SPOTDUPLI;Duplicate Current Spot +TP_LOCALLAB_SPOTDUPLI_TOOLTIP;If check, a copy of all datas will be done, except center X=200 and centerY=200\nto show it is a duplicated spot.\nYou must first increase Control spot.\nIf the spot (current) is not empty, datas will be crushed. TP_LOCALLAB_ELI;Elipse TP_LOCALLAB_RECT;Rectangle TP_LOCALLAB_SHARP;Sharpening diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 09aa8ae41..e6bd3980a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -28,6 +28,7 @@ #include #include "../rtgui/md5helper.h" #include "../rtgui/thresholdselector.h" +#include #include "iccstore.h" #ifdef _OPENMP @@ -222,13 +223,13 @@ ImProcCoordinator::ImProcCoordinator() chromarefs(500, -100000.f), lumarefs(500, -100000.f), sobelrefs(500, -100000.f), - huer(0), huerblu(0), chromar(0), lumar(0), sobeler(0), - colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), + colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), lastspotdup(false), + retistrsav(nullptr) /* ======= @@ -596,6 +597,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) aeListener->autoExpChanged(params.toneCurve.expcomp, params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.hrenabled); } + if (params.toneCurve.histmatching) { imgsrc->getAutoMatchedToneCurve(params.toneCurve.curve); @@ -813,9 +815,20 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - * 2017 Jacques Desmis + * 2017 2018 Jacques Desmis */ + + //********************************************************* + //advertissment + //we can probably put all these function outside main process + // but for now, I think it s mode readable + // we have similar process in dcrop. and simpleprocess.cc + // see rawpedia for all "fantaisies" + // all this code is probably not optimal...but actually it run :) + //there are probably errors... + //*********************************************************** + bool isascii = true; std::string mdfive = getMD5(imgsrc->getFileName()); @@ -868,7 +881,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) versionmip = 0; // int maxdat; int sca = 1; - //string delim ==> delimiter to separate integer in a string, 70 is lagely enough for curves : noramlly 3 to 21 must be suffisant + //string delim ==> delimiter to separate integer in a string, 70 is largely enough for curves : noramlly 3 to 21 must be suffisant + //curious method, but I am a poor informatic scientist... std::string delim[69] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "&", "#", "{", "[", "]", "}", "$", "*", "?", ">", "!", ";", "<", "(", ")", "+", "-" @@ -916,7 +930,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) if (fic) { - //initilize newues when first utilisation of Locallab. Prepare creation of Mip files + //*************************************************************************************** + //initialize new values when first utilisation of Locallab. Prepare creation of Mip files + //**************************************************************************************** for (int sp = 1; sp < maxspot; sp++) { // spots default int t_sp = sp; int t_mipversion = 10024;//new value for each change @@ -1185,9 +1201,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) fic << "curveskin=" << t_curvskin << '@' << endl; fic << "pthres=" << t_psthres << '@' << endl; fic << "curveex=" << t_curvex << '@' << endl; - - - fic << endl; } @@ -1201,6 +1214,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) } + //*************************************************************************************** + //End initialize new values when first utilisation of Locallab. Prepare creation of Mip files + //**************************************************************************************** + int realspot = params.locallab.nbspot; @@ -1227,7 +1244,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) pthstr = new std::string[maxspot]; exstr = new std::string[maxspot]; - + //****************************************************************** + //initialize data[xx][0] and Lut cache with params + //****************************************************************** { sps[0] = 0; dataspot[2][0] = circrads[0] = params.locallab.circrad;//copy params in dataspot and in LUTi @@ -1687,12 +1706,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) locallutili = false; } + //****************************************************************** + //end initialize data[xx][0] and cache with params + //****************************************************************** - - //end save - - + //******************************************************************** + //read mip file + //******************************************************************** int ns = 0; // int realsp = params.locallab.nbspot; bool excurvret = true; @@ -2082,8 +2103,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) } } - //here we change the number of spot - + //************************************************************** + //here we change the number of spot if change in options + //************************************************************** if (ns < (maxspot - 1)) { ofstream fic(datal, ios::out | ios::app); // ouverture en écriture avec effacement du fichier ouvert @@ -2434,7 +2456,157 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) } + //************************************************************************** + //end change number of spots + //************************************************************************** + + //************************************************************************************************ + //duplicated spot + //************************************************************************************************ + int spottodupli = dataspot[16][0];//current value + + if (params.locallab.spotduplicated) { + lastspotdup = true;//probably unused + } + + if (params.locallab.spotduplicated && spottodupli > 1) { + //perhaps some datas are redondant..to verify + circrads[0] = circrads[spottodupli] = dataspot[2][0] = dataspot[2][spottodupli] = dataspot[2][spottodupli - 1]; + locx[0] = locx[spottodupli] = dataspot[3][0] = dataspot[3][spottodupli] = dataspot[3][spottodupli - 1]; + locy[0] = locy[spottodupli] = dataspot[4][0] = dataspot[4][spottodupli] = dataspot[4][spottodupli - 1]; + locyt[0] = locyt[spottodupli] = dataspot[5][0] = dataspot[5][spottodupli] = dataspot[5][spottodupli - 1]; + locxl[0] = locxl[spottodupli] = dataspot[6][0] = dataspot[6][spottodupli] = dataspot[6][spottodupli - 1]; + //change only center position to 200 200 to see changes + centerx[0] = centerx[spottodupli] = dataspot[7][0] = dataspot[7][spottodupli] = 200; //not to center + centery[0] = centery[spottodupli] = dataspot[8][0] = dataspot[8][spottodupli] = 200;//not to center to see it is a duplicated spot + // + lights[0] = lights[spottodupli] = dataspot[9][0] = dataspot[9][spottodupli] = dataspot[9][spottodupli - 1]; + contrs[0] = contrs[spottodupli] = dataspot[10][0] = dataspot[10][spottodupli] = dataspot[10][spottodupli - 1]; + chroms[0] = chroms[spottodupli] = dataspot[11][0] = dataspot[11][spottodupli] = dataspot[11][spottodupli - 1]; + sensis[0] = sensis[spottodupli] = dataspot[12][0] = dataspot[12][spottodupli] = dataspot[12][spottodupli - 1]; + transits[0] = transits[spottodupli] = dataspot[13][0] = dataspot[13][spottodupli] = dataspot[13][spottodupli - 1]; + inverss[0] = inverss[spottodupli] = dataspot[14][0] = dataspot[14][spottodupli] = dataspot[14][spottodupli - 1]; + smeths[0] = smeths[spottodupli] = dataspot[15][0] = dataspot[15][spottodupli] = dataspot[15][spottodupli - 1]; + //no chnage to spot current value 16 + radiuss[0] = radiuss[spottodupli] = dataspot[17][0] = dataspot[17][spottodupli] = dataspot[17][spottodupli - 1]; + strengths[0] = strengths[spottodupli] = dataspot[18][0] = dataspot[18][spottodupli] = dataspot[18][spottodupli - 1]; + sensibns[0] = sensibns[spottodupli] = dataspot[19][0] = dataspot[19][spottodupli] = dataspot[19][spottodupli - 1]; + inversrads[0] = inversrads[spottodupli] = dataspot[20][0] = dataspot[20][spottodupli] = dataspot[20][spottodupli - 1]; + strs[0] = strs[spottodupli] = dataspot[21][0] = dataspot[21][spottodupli] = dataspot[21][spottodupli - 1]; + chrrts[0] = chrrts[spottodupli] = dataspot[22][0] = dataspot[22][spottodupli] = dataspot[22][spottodupli - 1]; + neighs[0] = neighs[spottodupli] = dataspot[23][0] = dataspot[23][spottodupli] = dataspot[23][spottodupli - 1]; + varts[0] = varts[spottodupli] = dataspot[24][0] = dataspot[24][spottodupli] = dataspot[24][spottodupli - 1]; + sensihs[0] = sensihs[spottodupli] = dataspot[25][0] = dataspot[25][spottodupli] = dataspot[25][spottodupli - 1]; + inversrets[0] = inversrets[spottodupli] = dataspot[26][0] = dataspot[26][spottodupli] = dataspot[26][spottodupli - 1]; + retinexs[0] = retinexs[spottodupli] = dataspot[27][0] = dataspot[27][spottodupli] = dataspot[27][spottodupli - 1]; + sharradiuss[0] = sharradiuss[spottodupli] = dataspot[28][0] = dataspot[28][spottodupli] = dataspot[28][spottodupli - 1]; + sharamounts[0] = sharamounts[spottodupli] = dataspot[29][0] = dataspot[29][spottodupli] = dataspot[29][spottodupli - 1]; + shardampings[0] = shardampings[spottodupli] = dataspot[30][0] = dataspot[30][spottodupli] = dataspot[30][spottodupli - 1]; + shariters[0] = shariters[spottodupli] = dataspot[31][0] = dataspot[31][spottodupli] = dataspot[31][spottodupli - 1]; + sensishas[0] = sensishas[spottodupli] = dataspot[32][0] = dataspot[32][spottodupli] = dataspot[32][spottodupli - 1]; + inversshas[0] = inversshas[spottodupli] = dataspot[33][0] = dataspot[33][spottodupli] = dataspot[33][spottodupli - 1]; + qualitys[0] = qualitys[spottodupli] = dataspot[34][0] = dataspot[34][spottodupli] = dataspot[34][spottodupli - 1]; + thress[0] = thress[spottodupli] = dataspot[35][0] = dataspot[35][spottodupli] = dataspot[35][spottodupli - 1]; + proxis[0] = proxis[spottodupli] = dataspot[36][0] = dataspot[36][spottodupli] = dataspot[36][spottodupli - 1]; + noiselumfs[0] = noiselumfs[spottodupli] = dataspot[37][0] = dataspot[37][spottodupli] = dataspot[37][spottodupli - 1]; + noiselumcs[0] = noiselumcs[spottodupli] = dataspot[38][0] = dataspot[38][spottodupli] = dataspot[38][spottodupli - 1]; + noisechrofs[0] = noisechrofs[spottodupli] = dataspot[39][0] = dataspot[39][spottodupli] = dataspot[39][spottodupli - 1]; + noisechrocs[0] = noisechrocs[spottodupli] = dataspot[40][0] = dataspot[40][spottodupli] = dataspot[40][spottodupli - 1]; + mult0s[0] = mult0s[spottodupli] = dataspot[41][0] = dataspot[41][spottodupli] = dataspot[41][spottodupli - 1]; + mult1s[0] = mult1s[spottodupli] = dataspot[42][0] = dataspot[42][spottodupli] = dataspot[42][spottodupli - 1]; + mult2s[0] = mult2s[spottodupli] = dataspot[43][0] = dataspot[43][spottodupli] = dataspot[43][spottodupli - 1]; + mult3s[0] = mult3s[spottodupli] = dataspot[44][0] = dataspot[44][spottodupli] = dataspot[44][spottodupli - 1]; + mult4s[0] = mult4s[spottodupli] = dataspot[45][0] = dataspot[45][spottodupli] = dataspot[45][spottodupli - 1]; + thresholds[0] = thresholds[spottodupli] = dataspot[46][0] = dataspot[46][spottodupli] = dataspot[46][spottodupli - 1]; + sensicbs[0] = sensicbs[spottodupli] = dataspot[47][0] = dataspot[47][spottodupli] = dataspot[47][spottodupli - 1]; + activlums[0] = activlums[spottodupli] = dataspot[48][0] = dataspot[48][spottodupli] = dataspot[48][spottodupli - 1]; + strens[0] = strens[spottodupli] = dataspot[49][0] = dataspot[49][spottodupli] = dataspot[49][spottodupli - 1]; + gammas[0] = gammas[spottodupli] = dataspot[50][0] = dataspot[50][spottodupli] = dataspot[50][spottodupli - 1]; + estops[0] = estops[spottodupli] = dataspot[51][0] = dataspot[51][spottodupli] = dataspot[51][spottodupli - 1]; + scaltms[0] = scaltms[spottodupli] = dataspot[52][0] = dataspot[52][spottodupli] = dataspot[52][spottodupli - 1]; + reweis[0] = reweis[spottodupli] = dataspot[53][0] = dataspot[53][spottodupli] = dataspot[53][spottodupli - 1]; + sensitms[0] = sensitms[spottodupli] = dataspot[54][0] = dataspot[54][spottodupli] = dataspot[54][spottodupli - 1]; + retrabs[0] = retrabs[spottodupli] = dataspot[55][0] = dataspot[55][spottodupli] = dataspot[55][spottodupli - 1]; + curvactivs[0] = curvactivs[spottodupli] = dataspot[56][0] = dataspot[56][spottodupli] = dataspot[56][spottodupli - 1]; + qualitycurves[0] = qualitycurves[spottodupli] = dataspot[57][0] = dataspot[57][spottodupli] = dataspot[57][spottodupli - 1]; + sensivs[0] = sensivs[spottodupli] = dataspot[58][0] = dataspot[58][spottodupli] = dataspot[58][spottodupli - 1]; + pastels[0] = pastels[spottodupli] = dataspot[59][0] = dataspot[59][spottodupli] = dataspot[59][spottodupli - 1]; + saturateds[0] = saturateds[spottodupli] = dataspot[60][0] = dataspot[60][spottodupli] = dataspot[60][spottodupli - 1]; + protectskinss[0] = protectskinss[spottodupli] = dataspot[61][0] = dataspot[61][spottodupli] = dataspot[61][spottodupli - 1]; + avoidcolorshifts[0] = avoidcolorshifts[spottodupli] = dataspot[62][0] = dataspot[62][spottodupli] = dataspot[62][spottodupli - 1]; + pastsattogs[0] = pastsattogs[spottodupli] = dataspot[63][0] = dataspot[63][spottodupli] = dataspot[63][spottodupli - 1]; + expcomps[0] = expcomps[spottodupli] = dataspot[64][0] = dataspot[64][spottodupli] = dataspot[64][spottodupli - 1]; + blacks[0] = blacks[spottodupli] = dataspot[65][0] = dataspot[65][spottodupli] = dataspot[65][spottodupli - 1]; + hlcomprs[0] = hlcomprs[spottodupli] = dataspot[66][0] = dataspot[66][spottodupli] = dataspot[66][spottodupli - 1]; + hlcomprthreshs[0] = hlcomprthreshs[spottodupli] = dataspot[67][0] = dataspot[67][spottodupli] = dataspot[67][spottodupli - 1]; + shcomprs[0] = shcomprs[spottodupli] = dataspot[68][0] = dataspot[68][spottodupli] = dataspot[68][spottodupli - 1]; + sensiexs[0] = sensiexs[spottodupli] = dataspot[69][0] = dataspot[69][spottodupli] = dataspot[69][spottodupli - 1]; + centerxbufs[0] = centerxbufs[spottodupli] = dataspot[70][0] = dataspot[70][spottodupli] = dataspot[70][spottodupli - 1]; + centerybufs[0] = centerybufs[spottodupli] = dataspot[71][0] = dataspot[71][spottodupli] = dataspot[71][spottodupli - 1]; + adjblurs[0] = adjblurs[spottodupli] = dataspot[72][0] = dataspot[72][spottodupli] = dataspot[72][spottodupli - 1]; + cutpasts[0] = cutpasts[spottodupli] = dataspot[73][0] = dataspot[73][spottodupli] = dataspot[73][spottodupli - 1]; + chromacbdls[0] = chromacbdls[spottodupli] = dataspot[74][0] = dataspot[74][spottodupli] = dataspot[74][spottodupli - 1]; + lastdusts[0] = lastdusts[spottodupli] = dataspot[75][0] = dataspot[75][spottodupli] = dataspot[75][spottodupli - 1]; + blurmets[0] = blurmets[spottodupli] = dataspot[76][0] = dataspot[76][spottodupli] = dataspot[76][spottodupli - 1]; + dustmets[0] = dustmets[spottodupli] = dataspot[77][0] = dataspot[77][spottodupli] = dataspot[77][spottodupli - 1]; + exclumets[0] = exclumets[spottodupli] = dataspot[78][0] = dataspot[78][spottodupli] = dataspot[78][spottodupli - 1]; + sensiexclus[0] = sensiexclus[spottodupli] = dataspot[79][0] = dataspot[79][spottodupli] = dataspot[79][spottodupli - 1]; + strucs[0] = strucs[spottodupli] = dataspot[80][0] = dataspot[80][spottodupli] = dataspot[80][spottodupli - 1]; + warms[0] = warms[spottodupli] = dataspot[81][0] = dataspot[81][spottodupli] = dataspot[81][spottodupli - 1]; + noiselumdetails[0] = noiselumdetails[spottodupli] = dataspot[82][0] = dataspot[82][spottodupli] = dataspot[82][spottodupli - 1]; + noisechrodetails[0] = noisechrodetails[spottodupli] = dataspot[83][0] = dataspot[83][spottodupli] = dataspot[83][spottodupli - 1]; + sensidens[0] = sensidens[spottodupli] = dataspot[84][0] = dataspot[84][spottodupli] = dataspot[84][spottodupli - 1]; + expdenois[0] = expdenois[spottodupli] = dataspot[85][0] = dataspot[85][spottodupli] = dataspot[85][spottodupli - 1]; + expcolors[0] = expcolors[spottodupli] = dataspot[86][0] = dataspot[86][spottodupli] = dataspot[86][spottodupli - 1]; + expvibrances[0] = expvibrances[spottodupli] = dataspot[87][0] = dataspot[87][spottodupli] = dataspot[87][spottodupli - 1]; + expblurs[0] = expblurs[spottodupli] = dataspot[88][0] = dataspot[88][spottodupli] = dataspot[88][spottodupli - 1]; + exptonemaps[0] = exptonemaps[spottodupli] = dataspot[89][0] = dataspot[89][spottodupli] = dataspot[89][spottodupli - 1]; + expretis[0] = expretis[spottodupli] = dataspot[90][0] = dataspot[90][spottodupli] = dataspot[90][spottodupli - 1]; + expsharps[0] = expsharps[spottodupli] = dataspot[91][0] = dataspot[91][spottodupli] = dataspot[91][spottodupli - 1]; + expcbdls[0] = expcbdls[spottodupli] = dataspot[92][0] = dataspot[92][spottodupli] = dataspot[92][spottodupli - 1]; + expexposes[0] = expexposes[spottodupli] = dataspot[93][0] = dataspot[93][spottodupli] = dataspot[93][spottodupli - 1]; + bilaterals[0] = bilaterals[spottodupli] = dataspot[94][0] = dataspot[94][spottodupli] = dataspot[94][spottodupli - 1]; + noiselequals[0] = noiselequals[spottodupli] = dataspot[95][0] = dataspot[95][spottodupli] = dataspot[95][spottodupli - 1]; + shapemets[0] = shapemets[spottodupli] = dataspot[96][0] = dataspot[96][spottodupli] = dataspot[96][spottodupli - 1]; + + //datas for end ... references hue, etc. + huerefblurs[0] = huerefblurs[spottodupli] = dataspot[maxdata - 5][0] = dataspot[maxdata - 5][spottodupli] = dataspot[maxdata - 5][spottodupli - 1]; + huerefs[0] = huerefs[spottodupli] = dataspot[maxdata - 4][0] = dataspot[maxdata - 4][spottodupli] = dataspot[maxdata - 4][spottodupli - 1]; + chromarefs[0] = chromarefs[spottodupli] = dataspot[maxdata - 3][0] = dataspot[maxdata - 3][spottodupli] = dataspot[maxdata - 3][spottodupli - 1]; + lumarefs[0] = lumarefs[spottodupli] = dataspot[maxdata - 2][0] = dataspot[maxdata - 2][spottodupli] = dataspot[maxdata - 2][spottodupli - 1]; + sobelrefs[0] = sobelrefs[spottodupli] = dataspot[maxdata - 1][0] = dataspot[maxdata - 1][spottodupli] = dataspot[maxdata - 1][spottodupli - 1]; + + //perhaps not good after ?? to verify and to complete ?? difficult but "only" curves + retistr[spottodupli] = retistr[spottodupli - 1]; + llstr[spottodupli] = llstr[spottodupli - 1]; + lhstr[spottodupli] = lhstr[spottodupli - 1]; + ccstr[spottodupli] = ccstr[spottodupli - 1]; + hhstr[spottodupli] = hhstr[spottodupli - 1]; + skinstr[spottodupli] = skinstr[spottodupli - 1]; + pthstr[spottodupli] = pthstr[spottodupli - 1]; + exstr[spottodupli] = exstr[spottodupli - 1]; + + + if (aloListener && params.locallab.spotduplicated) { + //update GUI and MIP + int sp = spottodupli; + int maxreal = 1; + aloListener->localChanged(dataspot, retistr[sp], llstr[sp], lhstr[sp], ccstr[sp], hhstr[sp], skinstr[sp], pthstr[sp], exstr[sp], sp, maxreal); + aloListener->spotdupChanged(false);//put checkbox to false, and spotduplicated to false + params.locallab.spotduplicated = false; + + } + + } + + //************************************************ + //end duplicated spot + //************************************************ + + //************************************************************************* //main algorithm for all spots + //************************************************************************* + for (int sp = 1; sp < maxspot; sp++) { //spots default params.locallab.huerefblur = dataspot[maxdata - 5][sp] / 100.; params.locallab.hueref = dataspot[maxdata - 4][sp] / 100.; @@ -2481,7 +2653,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) strengths[sp] = dataspot[18][sp]; params.locallab.radius = dataspot[17][sp]; params.locallab.strength = dataspot[18][sp]; - params.locallab.sensibn = dataspot[19][sp]; + params.locallab.sensibn = sensibns[sp] = dataspot[19][sp]; if (dataspot[20][sp] == 0) { inversrads[sp] = 0; @@ -3010,19 +3182,27 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) } + //*********************************************************** + //end main algoritm + //*********************************************************** int sp ; sp = realspot; //now for current spot int maxreal = 1; + //************************************************************* //update GUI and Mip files + //************************************************************* if (aloListener && realspot != dataspot[16][0]) { //update GUI and MIP aloListener->localChanged(dataspot, retistr[sp], llstr[sp], lhstr[sp], ccstr[sp], hhstr[sp], skinstr[sp], pthstr[sp], exstr[sp], sp, maxreal); } + //**************************************************************** + //now works on current spot + //**************************************************************** params.locallab.huerefblur = INFINITY; params.locallab.hueref = INFINITY; params.locallab.chromaref = INFINITY; @@ -3653,7 +3833,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) sklocalcurve.clear(); exlocalcurve.clear(); + //******************************************************* + //end current spot + //******************************************************* + + //******************************************************* //write mip file in real time + //******************************************************* + ofstream fou(datal, ios::out | ios::trunc); if (fou) @@ -3911,8 +4098,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) fou.close(); } + //******************************************************** + //end write mip file + //********************************************************* - + //clean all for (int i = 0; i < maxdata; i++) { delete [] dataspot[i]; } @@ -3930,6 +4120,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) } + //************************************************************* + // end locallab + //************************************************************* histCCurve.clear(); histLCurve.clear(); @@ -4575,15 +4768,15 @@ void ImProcCoordinator::saveInputICCReference(const Glib::ustring & fname, bool double tmpScale = ipf.resizeScale(¶ms, fW, fH, imw, imh); if (tmpScale != 1.0) { - Imagefloat* tempImage = new Imagefloat (imw, imh); - ipf.resize (im, tempImage, tmpScale); + Imagefloat* tempImage = new Imagefloat(imw, imh); + ipf.resize(im, tempImage, tmpScale); delete im; im = tempImage; } - im->setMetadata (imgsrc->getMetaData()->getRootExifData ()); + im->setMetadata(imgsrc->getMetaData()->getRootExifData()); - im->saveTIFF (fname, 16, true); + im->saveTIFF(fname, 16, true); delete im; if (plistener) { diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 2cfd33c11..3bf5a25d9 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -382,7 +382,7 @@ protected: void process(); float colourToningSatLimit; float colourToningSatLimitOpacity; - + bool lastspotdup; public: ImProcCoordinator(); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8f135e26e..eaf68eed8 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2472,16 +2472,19 @@ expsharp(false), expcbdl(false), expdenoi(false), threshold(20), -chromacbdl(0) +chromacbdl(0), +spotduplicated(false) { } bool LocallabParams::operator ==(const LocallabParams& other) const { + return enabled == other.enabled && avoid == other.avoid && invers == other.invers + && spotduplicated == other.spotduplicated && cutpast == other.cutpast && lastdust == other.lastdust && curvactiv == other.curvactiv @@ -3604,6 +3607,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.estop, "Locallab", "Estop", locallab.estop, keyFile); saveToKeyfile(!pedited || pedited->locallab.scaltm, "Locallab", "Scaltm", locallab.scaltm, keyFile); saveToKeyfile(!pedited || pedited->locallab.rewei, "Locallab", "Rewei", locallab.rewei, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spotduplicated, "Locallab", "Spotduplicated", locallab.spotduplicated, keyFile); @@ -4742,6 +4746,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Threshold", pedited, locallab.threshold, pedited->locallab.threshold); assignFromKeyfile(keyFile, "Locallab", "Chromacbdl", pedited, locallab.chromacbdl, pedited->locallab.chromacbdl); + assignFromKeyfile(keyFile, "Locallab", "Spotduplicated", pedited, locallab.spotduplicated, pedited->locallab.spotduplicated); } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 9c8bfb3a1..cd68a0f83 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1007,7 +1007,8 @@ struct LocallabParams { bool expdenoi; double threshold; int chromacbdl; - + bool spotduplicated; + LocallabParams(); bool operator ==(const LocallabParams& other) const; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index e7b9efe4e..a4ee0c690 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -348,7 +348,7 @@ public : virtual ~localListener() {} virtual void localChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) {} virtual void localretChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) {} - + virtual void spotdupChanged(bool spotchan) {}; }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index a0c91fd36..1d276e7a3 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -448,7 +448,8 @@ Locallab::Locallab(): Evlocallabbilateral = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_LOCBILATERAL");// = 598, Evlocallabnoiselequal = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_LOCNOISELEQUAL");// = 599, Evlocallabshapemethod = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_LOCSHAPEMETH");// = 600, - + Evlocallabspotduplicated = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_LOCSPOTDUP"); + editHBox = Gtk::manage(new Gtk::HBox()); edit = Gtk::manage(new Gtk::ToggleButton()); edit->add(*Gtk::manage(new RTImage("editmodehand.png"))); @@ -569,6 +570,11 @@ Locallab::Locallab(): circrad->setAdjusterListener(this); + spotduplicated = Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SPOTDUPLI"))); + spotduplicated->set_active(false); + spotduplicatedConn = spotduplicated->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::spotduplicatedChanged)); + spotduplicated->set_tooltip_markup(M("TP_LOCALLAB_SPOTDUPLI_TOOLTIP")); + // labspotdup = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_SPOTDUP_ENA"))); qualityMethod->append(M("TP_LOCALLAB_STD")); qualityMethod->append(M("TP_LOCALLAB_ENH")); @@ -844,6 +850,8 @@ Locallab::Locallab(): shapeBox->pack_start(*centerX); shapeBox->pack_start(*centerY); shapeBox->pack_start(*circrad); + shapeBox->pack_start(*spotduplicated); + //shapeBox->pack_start (*labspotdup); qualbox->pack_start(*labqual, Gtk::PACK_SHRINK, 4); qualbox->pack_start(*qualityMethod); shapeBox->pack_start(*qualbox); @@ -2017,6 +2025,7 @@ bool Locallab::localComputed_() } else if (nextdatasp[15] == 3) { Smethod->set_active(3); } + //nbspot->setValue(nextdatasp[16]); //sliders blurr radius->setValue(nextdatasp[17]); @@ -2707,6 +2716,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) pastSatTog->set_inconsistent(!pedited->locallab.pastsattog); skinTonesCurve->setUnChanged(!pedited->locallab.skintonescurve); sensiv->setEditedState(pedited->locallab.sensiv ? Edited : UnEdited); + spotduplicated->set_inconsistent(!pedited->locallab.spotduplicated); for (int i = 0; i < 5; i++) { multiplier[i]->setEditedState(pedited->locallab.mult[i] ? Edited : UnEdited); @@ -2934,6 +2944,13 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) ashiftconn.block(false); lastAvoidColorShift = pp->locallab.avoidcolorshift; + + spotduplicatedConn.block(true); + spotduplicated->set_active(pp->locallab.spotduplicated); + spotduplicatedConn.block(false); + lastspotduplicated = pp->locallab.spotduplicated; + + pastsattogconn.block(true); pastSatTog->set_active(pp->locallab.pastsattog); pastsattogconn.block(false); @@ -3437,6 +3454,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.pastsattog = pastSatTog->get_active(); pp->locallab.skintonescurve = skinTonesCurve->getCurve(); pp->locallab.sensiv = sensiv->getIntValue(); + pp->locallab.spotduplicated = spotduplicated->get_active(); if (pedited) { @@ -3555,7 +3573,9 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.pastsattog = !pastSatTog->get_inconsistent(); pedited->locallab.skintonescurve = !skinTonesCurve->isUnChanged(); pedited->locallab.sensiv = sensiv->getEditedState(); + pedited->locallab.spotduplicated = !spotduplicated->get_inconsistent(); + } if (retinexMethod->get_active_row_number() == 0) { @@ -3690,6 +3710,74 @@ void Locallab::avoidcolorshift_toggled() } } + +void Locallab::spotdupChanged(bool spotchan) +{ + nextspotdup = spotchan; + + const auto func = [](gpointer data) -> gboolean { + static_cast(data)->spotdupComputed_(); + return FALSE; + }; + + idle_register.add(func, this); +} + +bool Locallab::spotdupComputed_() +{ + + disableListener(); + spotduplicated->set_active(nextspotdup); + if(nextspotdup){ + //labspotdup->show(); + //usleep(4000000); + } + else { + //labspotdup->hide(); + } + enableListener(); + + return false; +} + + +/* +void Locallab::spotdupChanged(bool spotchan) +{ + GThreadLock lock; + disableListener(); + spotduplicated->set_active(spotchan); + enableListener(); +} +*/ + +void Locallab::spotduplicatedChanged() +{ + if (batchMode) { + if (spotduplicated->get_inconsistent()) { + spotduplicated->set_inconsistent(false); + spotduplicatedConn.block(true); + spotduplicated->set_active(false); + spotduplicatedConn.block(false); + } else if (lastspotduplicated) { + spotduplicated->set_inconsistent(true); + } + + lastspotduplicated = spotduplicated->get_active(); + } + + if (listener && getEnabled()) { + + if (spotduplicated->get_active()) { + listener->panelChanged(Evlocallabspotduplicated, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallabspotduplicated, M("GENERAL_DISABLED")); + } + } +} + + + void Locallab::pastsattog_toggled() { if (batchMode) { diff --git a/rtgui/locallab.h b/rtgui/locallab.h index ae1e9d673..ffd89684c 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -140,7 +140,10 @@ private: rtengine::ProcEvent Evlocallabbilateral;// = 598, rtengine::ProcEvent Evlocallabnoiselequal;// = 599, rtengine::ProcEvent Evlocallabshapemethod;// = 600, + rtengine::ProcEvent Evlocallabspotduplicated; + IdleRegister idle_register; + int lastObject; void foldAllButMe(GdkEventButton* event, MyExpander *expander); void enableToggled(MyExpander *expander); @@ -295,6 +298,9 @@ private: Gtk::CheckButton* const cutpast; Gtk::CheckButton* const lastdust; + Gtk::CheckButton* spotduplicated; + Gtk::Label* labspotdup; + Gtk::Button* neutral; Gtk::HBox* neutrHBox; Gtk::Button* neutral1; @@ -348,17 +354,19 @@ private: sigc::connection enableretiConn, enablesharpConn, enablecbdlConn; sigc::connection enabledenoiConn; sigc::connection editConn, avoidConn, inversConn, cutpastConn, lastdustConn, curvactivConn, activlumConn, inversradConn, inversretConn, inversshaConn, neutralconn, neutralconn1; - sigc::connection Smethodconn, shapemethodconn, Exclumethodconn; + sigc::connection Smethodconn, shapemethodconn, Exclumethodconn, spotduplicatedConn; sigc::connection retinexMethodConn; sigc::connection qualityMethodConn; sigc::connection qualitycurveMethodConn; sigc::connection blurMethodConn; sigc::connection dustMethodConn; + bool lastspotduplicated; int nextdatasp[102]; int nextlength; + bool nextspotdup; std::string nextstr; std::string nextstr2; std::string nextll_str; @@ -422,7 +430,10 @@ public: void inversshaChanged(); void cutpastChanged(); void lastdustChanged(); - + void spotduplicatedChanged(); + bool spotdupComputed_(); + + void spotdupChanged(bool spotchan); void curveChanged(CurveEditor* ce); void autoOpenCurve(); void localChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 3fc82cfb5..89c3ab302 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -435,6 +435,7 @@ void ParamsEdited::set(bool v) locallab.pastsattog = v; locallab.skintonescurve = v; locallab.sensiv = v; + locallab.spotduplicated = v; pcvignette.enabled = v; @@ -1114,7 +1115,9 @@ void ParamsEdited::initFrom(const std::vector& locallab.pastsattog = locallab.pastsattog && p.locallab.pastsattog == other.locallab.pastsattog; locallab.skintonescurve = locallab.skintonescurve && p.locallab.skintonescurve == other.locallab.skintonescurve; locallab.sensiv = locallab.sensiv && p.locallab.sensiv == other.locallab.sensiv; + locallab.spotduplicated = locallab.spotduplicated && p.locallab.spotduplicated == other.locallab.spotduplicated; + pcvignette.enabled = pcvignette.enabled && p.pcvignette.enabled == other.pcvignette.enabled; pcvignette.strength = pcvignette.strength && p.pcvignette.strength == other.pcvignette.strength; pcvignette.feather = pcvignette.feather && p.pcvignette.feather == other.pcvignette.feather; @@ -2690,6 +2693,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.sensiv = mods.locallab.sensiv; } + if (locallab.spotduplicated) { + toEdit.locallab.spotduplicated = mods.locallab.spotduplicated; + } + if (locallab.sensiex) { toEdit.locallab.sensiex = mods.locallab.sensiex; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index b147a8d68..861998326 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -564,7 +564,7 @@ public: bool pastsattog; bool skintonescurve; bool sensiv; - + bool spotduplicated; };