diff --git a/rtdata/languages/default b/rtdata/languages/default index 34fab44a9..d975c2ff9 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -895,6 +895,7 @@ HISTORY_MSG_641;Local - Use SH mask HISTORY_MSG_642;Local - radius SH HISTORY_MSG_643;Local - Blur SH HISTORY_MSG_644;Local - inverse SH +HISTORY_MSG_645;Local - balance deltaE HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1969,6 +1970,7 @@ TP_LOCALLAB_ADJ;Equalizer blue-red TP_LOCALLAB_ARTIF;Shape detection TP_LOCALLAB_ARTIF_TOOLTIP;Increase deltaE Weakening improve shape detection, but can reduce the scope of detection.\nThreshold deltaE-scope increase the range of scope-deltaE - high values are for very wide gamut images.\nThreshold structure take into account the structure level of solid areas TP_LOCALLAB_AVOID;Avoid color shift +TP_LOCALLAB_BALAN;Balance deltaE C-L TP_LOCALLAB_BILATERAL;Bilateral filter TP_LOCALLAB_BLENDMASKCOL;Blend TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\nInverse - Inverse blur and noise without scope and whithout enhanced algorithm.\nSymmetric - inverse blur and noise with all settings. Be careful some results may be curious diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 9a26bda3f..c18420383 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -135,6 +135,7 @@ struct local_params { float lxL, lyT; float dxx, dyy; float iterat; + float balance; int cir; float thr; float stru; @@ -378,6 +379,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall double local_dxx = locallab.spots.at(sp).iter / 8000.0; //for proxi = 2==> # 1 pixel double local_dyy = locallab.spots.at(sp).iter / 8000.0; float iterati = (float) locallab.spots.at(sp).iter; + float balanc = (float) locallab.spots.at(sp).balan; if (iterati > 4.f || iterati < 0.2f) {//to avoid artifacts if user does not clear cache with new settings Can be suppressed after iterati = 2.f; @@ -413,9 +415,9 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0 && llSHMask == 0; // Color & Light mask is deactivated if Exposure mask is visible lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0; // Exposure mask is deactivated if Color & Light mask is visible lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0; // SH mask is deactivated if Color & Light mask is visible - // lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0; // Color & Light mask is deactivated if Exposure mask is visible - // lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0; // Exposure mask is deactivated if Color & Light mask is visible - // lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0; // SH mask is deactivated if Color & Light mask is visible +// lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0; // Color & Light mask is deactivated if Exposure mask is visible +// lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0; // Exposure mask is deactivated if Color & Light mask is visible +// lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0; // SH mask is deactivated if Color & Light mask is visible if (locallab.spots.at(sp).blurMethod == "norm") { @@ -584,6 +586,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.shdamp = local_shardamping; lp.shiter = local_shariter; lp.iterat = iterati; + lp.balance = balanc; lp.dxx = w * local_dxx; lp.dyy = h * local_dyy; lp.thr = thre; @@ -1842,6 +1845,16 @@ void ImProcFunctions::addGaNoise(LabImage *lab, LabImage *dst, const float mean, } } +static void balancedeltaE(float kL, float &kab) +{ + float mincurs = 0.3f;//minimum slider balan_ + float maxcurs = 1.7f;//maximum slider balan_ + float maxkab = 1.35;//0.5 * (3 - 0.3) + float minkab = 0.65;//0.5 * (3 - 1.7) + float abal = (maxkab - minkab) / (mincurs - maxcurs); + float bbal = maxkab - mincurs * abal; + kab = abal * kL + bbal; +} void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, int levred, float hueref, float lumaref, float chromaref, LabImage* original, LabImage* transformed, LabImage &tmp1, int cx, int cy, int sk) { @@ -2096,6 +2109,11 @@ void ImProcFunctions::BlurNoise_Local(int call, LabImage * tmp1, LabImage * tmp2 int GH = transformed->H; float refa = chromaref * cos(hueref); float refb = chromaref * sin(hueref); + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); LabImage *origblur = nullptr; @@ -2224,7 +2242,7 @@ void ImProcFunctions::BlurNoise_Local(int call, LabImage * tmp1, LabImage * tmp2 #endif float rL = origblur->L[y][x] / 327.68f; - float dE = sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + float dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); float cli = 0.f; float clc = 0.f; @@ -2370,6 +2388,12 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl float refa = chromaref * cos(hueref); float refb = chromaref * sin(hueref); + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); + LabImage *origblur = nullptr; origblur = new LabImage(GW, GH); @@ -2433,7 +2457,7 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl float rL = origblur->L[y][x] / 327.68f; float reducdE = 0.f; float dE = 0.f; - dE = sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); float mindE = 2.f + minscope * lp.sensh * lp.thr; float maxdE = 5.f + maxscope * lp.sensh * (1 + 0.1f * lp.thr); @@ -2628,6 +2652,7 @@ static void calclight(float lum, float koef, float & lumnew, LUTf & lightCurvel } + static void mean_fab(int begx, int begy, int cx, int cy, int xEn, int yEn, LabImage* bufexporig, LabImage* transformed, LabImage* original, float & fab, float & meanfab) { int nbfab = 0; @@ -2704,6 +2729,7 @@ void ImProcFunctions::blendstruc(int bfw, int bfh, LabImage* bufcolorig, float r for (int i = 0; i < hei; ++i) { tmL[i] = new float[wid]; } + Median medianTypeL = Median::TYPE_3X3_STRONG; Median_Denoise(blend2, blend2, wid, hei, medianTypeL, passes, multiThread, tmL); float sombel = 0.f; @@ -2840,6 +2866,11 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co int GH = transformed->H; float refa = chromaref * cos(hueref); float refb = chromaref * sin(hueref); + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); LabImage *origblur = nullptr; @@ -2911,7 +2942,7 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, co float rL = origblur->L[y][x] / 327.68f; float reducdE = 0.f; float dE = 0.f; - dE = sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); float mindE = 2.f + minscope * lp.senssha * lp.thr; float maxdE = 5.f + maxscope * lp.senssha * (1 + 0.1f * lp.thr); @@ -2979,6 +3010,11 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, int senstype, cons varsens = lp.senslc; } + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); int GW = transformed->W; int GH = transformed->H; @@ -3069,7 +3105,7 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, int senstype, cons #endif float dE = 0.f; float rL = origblur->L[y][x] / 327.68f; - dE = sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); float reducdE = 0.f; float mindE = 2.f + minscope * varsens * lp.thr; @@ -3153,6 +3189,11 @@ void ImProcFunctions::Exclude_Local(int sen, float **deltaso, const float hueref float refa = chromaref * cos(hueref); float refb = chromaref * sin(hueref); + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); //sobel sobelref /= 100.; @@ -3298,7 +3339,7 @@ void ImProcFunctions::Exclude_Local(int sen, float **deltaso, const float hueref } // affsob = 1.f; - dE = sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); // float dEor = affde * sqrt(SQR(refa - original->a[y][x] / 327.68f) + SQR(refb - original->b[y][x] / 327.68f) + SQR(lumaref - rLor)); // cli = (buflight[loy - begy][lox - begx]); @@ -3514,6 +3555,12 @@ void ImProcFunctions::transit_shapedetect(int senstype, LabImage * bufexporig, L radius = (2.f + 0.2f * lp.blurSH) / sk; } + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); + bool usemask = (lp.showmaskexpmet == 2 || lp.enaExpMask) && senstype == 1; bool usemaskcol = (lp.showmaskcolmet == 2 || lp.enaColorMask) && senstype == 0; bool usemaskSH = (lp.showmaskSHmet == 2 || lp.enaSHMask) && senstype == 9; @@ -3643,9 +3690,9 @@ void ImProcFunctions::transit_shapedetect(int senstype, LabImage * bufexporig, L } if (usemask || usemaskcol || usemaskSH) { - dE = rsob + sqrt(SQR(refa - origblurmask->a[y][x] / 327.68f) + SQR(refb - origblurmask->b[y][x] / 327.68f) + SQR(lumaref - origblurmask->L[y][x] / 327.68f)); + dE = rsob + sqrt(kab * SQR(refa - origblurmask->a[y][x] / 327.68f) + kab * SQR(refb - origblurmask->b[y][x] / 327.68f) + kL * SQR(lumaref - origblurmask->L[y][x] / 327.68f)); } else { - dE = rsob + sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + dE = rsob + sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); } float cli = 0.f; @@ -3976,18 +4023,20 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct int GH = transformed->H; float refa = chromaref * cos(hueref); float refb = chromaref * sin(hueref); + if (senstype == 2) { // Shadows highlight temp = new LabImage(GW, GH); #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) + #pragma omp parallel for schedule(dynamic,16) #endif - for (int y = 0; y < transformed->H; y++) { - for (int x = 0; x < transformed->W; x++) { - temp->L[y][x] = original->L[y][x]; - temp->a[y][x] = original->a[y][x]; - temp->b[y][x] = original->b[y][x]; - } + + for (int y = 0; y < transformed->H; y++) { + for (int x = 0; x < transformed->W; x++) { + temp->L[y][x] = original->L[y][x]; + temp->a[y][x] = original->a[y][x]; + temp->b[y][x] = original->b[y][x]; } + } ImProcFunctions::shadowsHighlights(temp, lp.hsena, 1, lp.highlihs, lp.shadowhs, lp.radiushs, sk, lp.hltonalhs, lp.shtonalhs); } @@ -4098,6 +4147,12 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct } + //balance deltaE + float kL = 1.f; + float kab = 1.f; + kL = lp.balance; + balancedeltaE(kL, kab); + LabImage *origblur = nullptr; origblur = new LabImage(GW, GH); @@ -4193,7 +4248,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct } float dE = 0.f; - dE = sqrt(SQR(refa - origblur->a[y][x] / 327.68f) + SQR(refb - origblur->b[y][x] / 327.68f) + SQR(lumaref - rL)); + dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); float reducdE = 0.f; float mindE = 2.f + minscope * varsens * lp.thr; @@ -4314,7 +4369,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct transformed->a[y][x] = CLIPC(original->a[y][x] + difa) ; transformed->b[y][x] = CLIPC(original->b[y][x] + difb); - } + } break; } @@ -4386,7 +4441,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct transformed->L[y][x] = CLIP(original->L[y][x] + diflc); transformed->a[y][x] = CLIPC(original->a[y][x] + difa) ; transformed->b[y][x] = CLIPC(original->b[y][x] + difb); - } + } } } @@ -4398,7 +4453,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct } delete origblur; - if (senstype == 1 || senstype ==2) { + if (senstype == 1 || senstype == 2) { delete temp; } @@ -6987,11 +7042,11 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } else if (lp.invsh && (lp.highlihs > 0.f || lp.shadowhs > 0.f) && call < 3 && lp.hsena) { - + float adjustr = 2.f; InverseColorLight_Local(sp, 2, lp, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk); } - + @@ -7625,41 +7680,6 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o float fab = 0.f; mean_fab(begx, begy, cx, cy, xEn, yEn, bufexporig, transformed, original, fab, meanfab); -//static void meanfab(int begx, int begy, int cx, int cy, int xEn, int yEn, LabImage* bufexporig, LabImage* transformed, LabImage* original, float & fab, float & meanfab) - /* - int nbfab = 0; - - for (int y = 0; y < transformed->H ; y++) //{ - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; - int loy = cy + y; - - if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufexporig->a[loy - begy][lox - begx] = original->a[y][x]; - bufexporig->b[loy - begy][lox - begx] = original->b[y][x]; - meanfab += fabs(bufexporig->a[loy - begy][lox - begx]); - meanfab += fabs(bufexporig->b[loy - begy][lox - begx]); - nbfab++; - } - } - - meanfab = meanfab / (2.f * nbfab); - float stddv = 0.f; - float som = 0.f; - - for (int y = 0; y < transformed->H ; y++) //{ - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; - int loy = cy + y; - - if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - som += SQR(fabs(bufexporig->a[loy - begy][lox - begx]) - meanfab) + SQR(fabs(bufexporig->b[loy - begy][lox - begx]) - meanfab); - } - } - - stddv = sqrt(som / nbfab); - fab = meanfab + 1.5f * stddv; - */ #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif diff --git a/rtengine/procevents.h b/rtengine/procevents.h index e6cba9b15..c37a1407b 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -671,6 +671,7 @@ enum ProcEventCode { EvlocallabradmaskSH = 641, EvlocallabblurSHde = 642, Evlocallabinverssh = 643, + EvLocallabSpotbalan = 644, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index c67e7f817..6c51b343f 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2356,6 +2356,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : transit(60), thresh(2.0), iter(2.0), + balan(1.0), // Color & Light expcolor(false), curvactiv(false), @@ -2524,6 +2525,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && transit == other.transit && thresh == other.thresh && iter == other.iter + && balan == other.balan // Color & Light && expcolor == other.expcolor && curvactiv == other.curvactiv @@ -3648,6 +3650,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).transit, "Locallab", "Transit_" + std::to_string(i), spot.transit, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).thresh, "Locallab", "Thresh_" + std::to_string(i), spot.thresh, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).iter, "Locallab", "Iter_" + std::to_string(i), spot.iter, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).balan, "Locallab", "Balan_" + std::to_string(i), spot.balan, keyFile); // Color & Light saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expcolor, "Locallab", "Expcolor_" + std::to_string(i), spot.expcolor, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).curvactiv, "Locallab", "Curvactiv_" + std::to_string(i), spot.curvactiv, keyFile); @@ -4900,6 +4903,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Transit_" + std::to_string(i), pedited, spot.transit, spotEdited.transit); assignFromKeyfile(keyFile, "Locallab", "Thresh_" + std::to_string(i), pedited, spot.thresh, spotEdited.thresh); assignFromKeyfile(keyFile, "Locallab", "Iter_" + std::to_string(i), pedited, spot.iter, spotEdited.iter); + assignFromKeyfile(keyFile, "Locallab", "Balan_" + std::to_string(i), pedited, spot.balan, spotEdited.balan); // Color & Light assignFromKeyfile(keyFile, "Locallab", "Expcolor_" + std::to_string(i), pedited, spot.expcolor, spotEdited.expcolor); assignFromKeyfile(keyFile, "Locallab", "Curvactiv_" + std::to_string(i), pedited, spot.curvactiv, spotEdited.curvactiv); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index ee13320e8..85aaf6b3a 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -956,6 +956,7 @@ struct LocallabParams { int transit; double thresh; double iter; + double balan; // Color & Light bool expcolor; bool curvactiv; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index dd4751434..05e3cf5b4 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -670,7 +670,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvLocallabEnaSHMask LUMINANCECURVE, //EvlocallabradmaskSH LUMINANCECURVE, //EvlocallabblurSHde - LUMINANCECURVE //Evlocallabinverssh + LUMINANCECURVE, //Evlocallabinverssh + LUMINANCECURVE //EvLocallabSpotbalan }; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index b9b741753..fefba4992 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -59,6 +59,7 @@ ControlSpotPanel::ControlSpotPanel(): transit_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 8.0, 0.1, 2.0))), iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 4.0, 0.1, 2.0))), + balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.3, 1.7, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), lastObject_(-1), lastCoord_(new Coord()), @@ -236,7 +237,9 @@ ControlSpotPanel::ControlSpotPanel(): artifBox->pack_start(*struc_); artifBox->pack_start(*thresh_); artifBox->pack_start(*iter_); + artifBox->pack_start(*balan_); iter_->setAdjusterListener(this); + balan_->setAdjusterListener(this); artifFrame->add(*artifBox); pack_start(*artifFrame); @@ -433,6 +436,7 @@ void ControlSpotPanel::load_ControlSpot_param() transit_->setValue(static_cast(row[spots_.transit])); thresh_->setValue(static_cast(row[spots_.thresh])); iter_->setValue(static_cast(row[spots_.iter])); + balan_->setValue(static_cast(row[spots_.balan])); } void ControlSpotPanel::controlspotChanged() @@ -837,6 +841,15 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) listener->panelChanged(EvLocallabSpotIter, iter_->getTextValue()); } } + + if (a == balan_) { + row[spots_.balan] = balan_->getValue(); + + if (listener) { + listener->panelChanged(EvLocallabSpotbalan, balan_->getTextValue()); + } + } + } void ControlSpotPanel::disableParamlistener(bool cond) @@ -866,6 +879,7 @@ void ControlSpotPanel::disableParamlistener(bool cond) transit_->block(cond); thresh_->block(cond); iter_->block(cond); + balan_->block(cond); } void ControlSpotPanel::setParamEditable(bool cond) @@ -889,6 +903,7 @@ void ControlSpotPanel::setParamEditable(bool cond) transit_->set_sensitive(cond); thresh_->set_sensitive(cond); iter_->set_sensitive(cond); + balan_->set_sensitive(cond); } void ControlSpotPanel::addControlSpotCurve(Gtk::TreeModel::Row row) @@ -1565,6 +1580,7 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(int id) r->transit = row[spots_.transit]; r->thresh = row[spots_.thresh]; r->iter = row[spots_.iter]; + r->balan = row[spots_.balan]; return r; } @@ -1684,6 +1700,7 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.transit] = newSpot->transit; row[spots_.thresh] = newSpot->thresh; row[spots_.iter] = newSpot->iter; + row[spots_.balan] = newSpot->balan; updateParamVisibility(); disableParamlistener(false); @@ -1726,6 +1743,7 @@ int ControlSpotPanel::updateControlSpot(SpotRow* spot) row[spots_.transit] = spot->transit; row[spots_.thresh] = spot->thresh; row[spots_.iter] = spot->iter; + row[spots_.balan] = spot->balan; updateControlSpotCurve(row); updateParamVisibility(); @@ -1814,6 +1832,7 @@ ControlSpotPanel::SpotEdited* ControlSpotPanel::getEditedStates() se->transit = transit_->getEditedState(); se->thresh = thresh_->getEditedState(); se->iter = iter_->getEditedState(); + se->balan = balan_->getEditedState(); return se; } @@ -1879,6 +1898,7 @@ void ControlSpotPanel::setEditedStates(SpotEdited* se) transit_->setEditedState(se->transit ? Edited : UnEdited); thresh_->setEditedState(se->thresh ? Edited : UnEdited); iter_->setEditedState(se->iter ? Edited : UnEdited); + balan_->setEditedState(se->balan ? Edited : UnEdited); // Update Control Spot GUI according to widgets edited states updateParamVisibility(); @@ -1919,8 +1939,8 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi circrad_->setDefault((double)defSpot->circrad); transit_->setDefault((double)defSpot->transit); thresh_->setDefault(defSpot->thresh); - // iter_->setDefault((double)defSpot->iter); iter_->setDefault(defSpot->iter); + balan_->setDefault(defSpot->balan); // Set default edited states for adjusters if (!pedited) { @@ -1937,6 +1957,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi transit_->setDefaultEditedState(Irrelevant); thresh_->setDefaultEditedState(Irrelevant); iter_->setDefaultEditedState(Irrelevant); + balan_->setDefaultEditedState(Irrelevant); } else { const LocallabParamsEdited::LocallabSpotEdited* defSpotState = new LocallabParamsEdited::LocallabSpotEdited(true); @@ -1957,6 +1978,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi transit_->setDefaultEditedState(defSpotState->transit ? Edited : UnEdited); thresh_->setDefaultEditedState(defSpotState->thresh ? Edited : UnEdited); iter_->setDefaultEditedState(defSpotState->iter ? Edited : UnEdited); + balan_->setDefaultEditedState(defSpotState->balan ? Edited : UnEdited); } } @@ -1978,6 +2000,7 @@ void ControlSpotPanel::setBatchMode(bool batchMode) transit_->showEditedCB(); thresh_->showEditedCB(); iter_->showEditedCB(); + balan_->showEditedCB(); // Set batch mode for comboBoxText shape_->append(M("GENERAL_UNCHANGED")); @@ -2013,6 +2036,7 @@ ControlSpotPanel::ControlSpots::ControlSpots() add(transit); add(thresh); add(iter); + add(balan); } //----------------------------------------------------------------------------- diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index c555071a8..ba3906df2 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -62,6 +62,7 @@ public: int transit; double thresh; double iter; + double balan; }; /** @@ -89,6 +90,7 @@ public: bool transit; bool thresh; bool iter; + bool balan; }; // Constructor and management functions @@ -274,6 +276,7 @@ private: Gtk::TreeModelColumn transit; Gtk::TreeModelColumn thresh; Gtk::TreeModelColumn iter; + Gtk::TreeModelColumn balan; }; class RenameDialog: @@ -329,6 +332,7 @@ private: Adjuster* const transit_; Adjuster* const thresh_; Adjuster* const iter_; + Adjuster* const balan_; // Internal variables int lastObject_; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index b605c98f5..fb7575c36 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -1268,6 +1268,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) r->transit = pp->locallab.spots.at(i).transit; r->thresh = pp->locallab.spots.at(i).thresh; r->iter = pp->locallab.spots.at(i).iter; + r->balan = pp->locallab.spots.at(i).balan; expsettings->addControlSpot(r); } @@ -1367,6 +1368,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) r->transit = newSpot->transit; r->thresh = newSpot->thresh; r->iter = newSpot->iter; + r->balan = newSpot->balan; expsettings->addControlSpot(r); // ProcParams update @@ -1552,6 +1554,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) r->transit = newSpot->transit; r->thresh = newSpot->thresh; r->iter = newSpot->iter; + r->balan = newSpot->balan; expsettings->addControlSpot(r); // ProcParams update @@ -1639,6 +1642,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).transit = r->transit; pp->locallab.spots.at(pp->locallab.selspot).thresh = r->thresh; pp->locallab.spots.at(pp->locallab.selspot).iter = r->iter; + pp->locallab.spots.at(pp->locallab.selspot).balan = r->balan; // Color & Light pp->locallab.spots.at(pp->locallab.selspot).expcolor = expcolor->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).curvactiv = curvactiv->get_active(); @@ -1837,6 +1841,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).transit = pe->locallab.spots.at(pp->locallab.selspot).transit || se->transit; pe->locallab.spots.at(pp->locallab.selspot).thresh = pe->locallab.spots.at(pp->locallab.selspot).thresh || se->thresh; pe->locallab.spots.at(pp->locallab.selspot).iter = pe->locallab.spots.at(pp->locallab.selspot).iter || se->iter; + pe->locallab.spots.at(pp->locallab.selspot).balan = pe->locallab.spots.at(pp->locallab.selspot).balan || se->balan; // Color & Light pe->locallab.spots.at(pp->locallab.selspot).expcolor = pe->locallab.spots.at(pp->locallab.selspot).expcolor || !expcolor->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).curvactiv = pe->locallab.spots.at(pp->locallab.selspot).curvactiv || !curvactiv->get_inconsistent(); @@ -2007,6 +2012,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).transit = pedited->locallab.spots.at(pp->locallab.selspot).transit || se->transit; pedited->locallab.spots.at(pp->locallab.selspot).thresh = pedited->locallab.spots.at(pp->locallab.selspot).thresh || se->thresh; pedited->locallab.spots.at(pp->locallab.selspot).iter = pedited->locallab.spots.at(pp->locallab.selspot).iter || se->iter; + pedited->locallab.spots.at(pp->locallab.selspot).balan = pedited->locallab.spots.at(pp->locallab.selspot).balan || se->balan; // Color & Light pedited->locallab.spots.at(pp->locallab.selspot).expcolor = pedited->locallab.spots.at(pp->locallab.selspot).expcolor || !expcolor->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).curvactiv = pedited->locallab.spots.at(pp->locallab.selspot).curvactiv || !curvactiv->get_inconsistent(); @@ -4371,6 +4377,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con se->transit = spotState->transit; se->thresh = spotState->thresh; se->iter = spotState->iter; + se->balan = spotState->balan; expsettings->setEditedStates(se); // Color & Light diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index ccb60a0a0..035165b16 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -946,6 +946,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).transit = locallab.spots.at(j).transit && pSpot.transit == otherSpot.transit; locallab.spots.at(j).thresh = locallab.spots.at(j).thresh && pSpot.thresh == otherSpot.thresh; locallab.spots.at(j).iter = locallab.spots.at(j).iter && pSpot.iter == otherSpot.iter; + locallab.spots.at(j).balan = locallab.spots.at(j).balan && pSpot.balan == otherSpot.balan; // Color & Light locallab.spots.at(j).expcolor = locallab.spots.at(j).expcolor && pSpot.expcolor == otherSpot.expcolor; locallab.spots.at(j).curvactiv = locallab.spots.at(j).curvactiv && pSpot.curvactiv == otherSpot.curvactiv; @@ -2591,6 +2592,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).iter = mods.locallab.spots.at(i).iter; } + if (locallab.spots.at(i).balan) { + toEdit.locallab.spots.at(i).balan = mods.locallab.spots.at(i).balan; + } + // Color & Light if (locallab.spots.at(i).expcolor) { toEdit.locallab.spots.at(i).expcolor = mods.locallab.spots.at(i).expcolor; @@ -4071,6 +4076,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : transit(v), thresh(v), iter(v), + balan(v), // Color & Light expcolor(v), curvactiv(v), @@ -4235,6 +4241,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) transit = v; thresh = v; iter = v; + balan = v; // Color & Light expcolor = v; curvactiv = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 6997fabc7..bcde7edf7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -373,6 +373,7 @@ public: bool transit; bool thresh; bool iter; + bool balan; // Color & Light bool expcolor; bool curvactiv;