From 4ff81092c4528f0afbe413b484603cfd9ebf6bf9 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 23 Nov 2019 14:50:34 +0100 Subject: [PATCH] Graduated filter hue for color and light Merge file --- rtdata/languages/default | 5 +- rtengine/iplocallab.cc | 170 ++++++++++++++++++++++++++------------- rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 + rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 +- rtgui/locallab.cc | 47 +++++++---- rtgui/locallab.h | 1 + rtgui/paramsedited.cc | 7 ++ rtgui/paramsedited.h | 1 + 10 files changed, 170 insertions(+), 70 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 1ca590f77..2fe9458a9 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1070,6 +1070,7 @@ HISTORY_MSG_830;Local - Color gradient strength L HISTORY_MSG_831;Local - Color gradient angle HISTORY_MSG_832;Local - Color gradient strength C HISTORY_MSG_833;Local - Gradient feather +HISTORY_MSG_834;Local - Color gradient strength H HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2301,8 +2302,9 @@ TP_LOCALLAB_EXPOSE;Exposure TP_LOCALLAB_GRADFRA;Graduated Filter TP_LOCALLAB_FEATH_TOOLTIP;Gradient width in percent of the Spot diagonal\n.Disabled for negatives chrominance. TP_LOCALLAB_GRADSTR_TOOLTIP;Filter strength in stops -TP_LOCALLAB_GRADANG_TOOLTIP;Rotation angle in degrees -90 0 +90 +TP_LOCALLAB_GRADANG_TOOLTIP;Rotation angle in degrees : -180 0 +180 TP_LOCALLAB_GRADSTRAB_TOOLTIP;Filter chroma strength +TP_LOCALLAB_GRADSTRHUE_TOOLTIP;Filter Hue strength TP_LOCALLAB_ENABLE_MASKAFT;Use all algorithms Exposure TP_LOCALLAB_EXPOSURE_TOOLTIP;In some cases (strong shadows ..) you can use the module "Shadows Highlights" TP_LOCALLAB_EXPCHROMA;Chroma compensation @@ -2343,6 +2345,7 @@ TP_LOCALLAB_GRADANG;Gradient angle TP_LOCALLAB_GRADSTR;Gradient strength TP_LOCALLAB_GRADSTRLUM;Gradient strength Luminance TP_LOCALLAB_GRADSTRCHRO;Gradient strength Chrominance +TP_LOCALLAB_GRADSTRHUE;Gradient strength Hue (merge file) TP_LOCALLAB_GAMFRA;Tone response curve (TRC) TP_LOCALLAB_GAMSH;Gamma TP_LOCALLAB_SLOSH;Slope diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index fd0f10953..c41500382 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -218,6 +218,7 @@ struct local_params { float angSH; float strcol; float strcolab; + float strcolh; float angcol; float softradiusexp; float softradiuscol; @@ -748,6 +749,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float angSH = ((float) locallab.spots.at(sp).angSH); float strcol = ((float) locallab.spots.at(sp).strcol); float strcolab = ((float) locallab.spots.at(sp).strcolab); + float strcolh = ((float) locallab.spots.at(sp).strcolh); float angcol = ((float) locallab.spots.at(sp).angcol); float softradiusexpo = ((float) locallab.spots.at(sp).softradiusexp); float softradiuscolor = ((float) locallab.spots.at(sp).softradiuscol); @@ -861,6 +863,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.angSH = angSH; lp.strcol = strcol; lp.strcolab = strcolab; + lp.strcolh = strcolh; lp.angcol = angcol; lp.softradiusexp = softradiusexpo; lp.softradiuscol = softradiuscolor; @@ -2618,9 +2621,12 @@ void calclocalGradientParams(const struct local_params& lp, struct grad_params& } else if (indic == 4) { stops = lp.strcolab; angs = lp.angcol; + } else if (indic == 5) { + stops = lp.strcolh; + angs = lp.angcol; } - //printf("Indic=%d strex=%f stop=%f\n", indic, lp.strexp, stops); + printf("Indic=%d strcol=%f stop=%f\n", indic, lp.strcolh, stops); double gradient_stops = stops; double gradient_center_x = LIM01((lp.xc - xstart) / bfw); @@ -2632,7 +2638,7 @@ void calclocalGradientParams(const struct local_params& lp, struct grad_params& varfeath = 1.f; } - // printf("xstart=%f ysta=%f lpxc=%f lpyc=%f stop=%f bb=%f cc=%f ang=%f ff=%d gg=%d\n", xstart, ystart, lp.xc, lp.yc, gradient_stops, gradient_center_x, gradient_center_y, gradient_angle, w, h); + printf("xstart=%f ysta=%f lpxc=%f lpyc=%f stop=%f bb=%f cc=%f ang=%f ff=%d gg=%d\n", xstart, ystart, lp.xc, lp.yc, gradient_stops, gradient_center_x, gradient_center_y, gradient_angle, w, h); // make 0.0 <= gradient_angle < 2 * rtengine::RT_PI gradient_angle = fmod(gradient_angle, 2 * rtengine::RT_PI); @@ -12735,45 +12741,130 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } } - - //test for write text , now it compile... but does nothing - // why ?? is arial found (I tried others) or I missed something +// test for write text with Cairo November 2019 /* - locImage = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, bfw, bfh); - Cairo::RefPtr cr = Cairo::Context::create(locImage); + //test for write text , it compile... but does nothing + // why ?? is arial or Purisa found (I tried others) or I missed something or poke ?? or tmImageorig or ?? - cr->set_source_rgb(0.1, 0.1, 0.1); - cr->select_font_face("Arial", Cairo::FontSlant::FONT_SLANT_NORMAL, Cairo::FontWeight::FONT_WEIGHT_BOLD); - cr->set_font_size(20); - cr->move_to(20, 20); + locImage = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, bfw, bfh); + Cairo::RefPtr cr = Cairo::Context::create(locImage); + cr->set_source_rgb(0.9, 0.9, 0.9);//white + cr->paint(); + cr->select_font_face("Purisa", Cairo::FontSlant::FONT_SLANT_NORMAL, Cairo::FontWeight::FONT_WEIGHT_BOLD); + cr->set_font_size(50); + cr->set_source_rgb(0.3, 0.3, 0.3);//grey + + cr->move_to(0, 0); cr->show_text("Coucou"); Imagefloat *tmpImageorig = nullptr; tmpImageorig = new Imagefloat(bfw, bfh); - lab2rgb(*bufcolfin, *tmpImageorig, params->icm.workingProfile); - tmpImageorig->normalizeFloatTo1(); + lab2rgb(*bufcolreserv, *tmpImageorig, params->icm.workingProfile); + // tmpImageorig->normalizeFloatTo1(); + locImage->flush(); + unsigned char *locData = locImage->get_data(); + for (int y = 0; y < bfh ; y++) { - unsigned char *dst = locImage->get_data() + (y * bfw + x) * 4; for (int x = 0; x < bfw; x++) { - float r = tmpImageorig->r(y, x); - float g = tmpImageorig->g(y, x); - float b = tmpImageorig->b(y, x); - poke01_d(dst, r, g, b); - tmpImageorig->r(y, x) = r; - tmpImageorig->g(y, x) = g; - tmpImageorig->b(y, x) = b; + unsigned char *dst = locData + (y * bfw + x) * 4;//why 4 ? + // printf("dst=%d ", *dst); + double r = tmpImageorig->r(y, x); + double g = tmpImageorig->g(y, x); + double b = tmpImageorig->b(y, x); + + //perhaps that or whithout 255 or ?? + *(dst++) = (unsigned char)(r); + tmpImageorig->r(y, x) = 255.f * *dst; + *(dst++) = (unsigned char)(g); + tmpImageorig->g(y, x) = 255.f * *dst; + *(dst++) = (unsigned char)(b); + tmpImageorig->b(y, x) = 255.f * *dst; + + //perhaps ?? + // rtengine::poke01_d(dst, r, g, b); + // tmpImageorig->r(y, x) = *(dst++); + // tmpImageorig->g(y, x) = *(dst++); + // tmpImageorig->b(y, x) = *(dst++); } } locImage->mark_dirty(); - - - tmpImageorig->normalizeFloatTo65535(); - rgb2lab(*tmpImageorig, *bufcolfin, params->icm.workingProfile); + // tmpImageorig->normalizeFloatTo65535(); + rgb2lab(*tmpImageorig, *bufcolreserv, params->icm.workingProfile); delete tmpImageorig; */ + + if (lp.strcol != 0.f) { + struct grad_params gp; + calclocalGradientParams(lp, gp, ystart, xstart, bfw, bfh, 3); +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + double factor = 1.0; + factor = ImProcFunctions::calcGradientFactor(gp, jr, ir); + bufcolfin->L[ir][jr] *= factor; + } + } + + if (lp.strcolab != 0.f) { + struct grad_params gpab; + calclocalGradientParams(lp, gpab, ystart, xstart, bfw, bfh, 4); +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + double factor = 1.0; + factor = ImProcFunctions::calcGradientFactor(gpab, jr, ir); + bufcolfin->a[ir][jr] *= factor; + bufcolfin->b[ir][jr] *= factor; + } + } + + if (lp.strcolh != 0.f) { + struct grad_params gph; + calclocalGradientParams(lp, gph, ystart, xstart, bfw, bfh, 5); +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + double factor = 1.0; + factor = ImProcFunctions::calcGradientFactor(gph, jr, ir); + float aa = bufcolfin->a[ir][jr]; + float bb = bufcolfin->b[ir][jr]; + float chrm = sqrt(SQR(aa) + SQR(bb)); + float HH = xatan2f(bb, aa); + + float newhr = 0.f; + float cor = 0.f; + if(factor < 1.f) { + cor = - 2.5f * (1.f - factor); + } else if(factor > 1.f) { + cor = 0.03f * (factor - 1.f); + } + + newhr = HH + cor; + + if (newhr > rtengine::RT_PI_F) { + newhr -= 2 * rtengine::RT_PI_F; + } else if (newhr < -rtengine::RT_PI_F) { + newhr += 2 * rtengine::RT_PI_F; + } + + float2 sincosval = xsincosf(newhr); + bufcolfin->a[ir][jr] = CLIPC(chrm * sincosval.y); + bufcolfin->b[ir][jr] = CLIPC(chrm * sincosval.x); + } + } + JaggedArray blend(bfw, bfh); buildBlendMask(lumreserv, blend, bfw, bfh, conthr, 1.f); float rm = 20.f / sk; @@ -13361,36 +13452,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o softproc(bufcolreserv.get(), bufcolfin.get(), lp.softradiuscol, bfh, bfw, 0.0001, 0.00001, 0.1f, sk, multiThread, 0); } - if (lp.strcol != 0.f) { - struct grad_params gp; - calclocalGradientParams(lp, gp, ystart, xstart, bfw, bfh, 3); -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - double factor = 1.0; - factor = ImProcFunctions::calcGradientFactor(gp, jr, ir); - bufcolfin->L[ir][jr] *= factor; - } - } - - if (lp.strcolab != 0.f) { - struct grad_params gpab; - calclocalGradientParams(lp, gpab, ystart, xstart, bfw, bfh, 4); -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - double factor = 1.0; - factor = ImProcFunctions::calcGradientFactor(gpab, jr, ir); - bufcolfin->a[ir][jr] *= factor; - bufcolfin->b[ir][jr] *= factor; - } - } if (nottransit) { //special only transition diff --git a/rtengine/procevents.h b/rtengine/procevents.h index f54e544ae..25236d210 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -857,6 +857,7 @@ enum ProcEventCode { Evlocallabangcol = 830, Evlocallabstrcolab = 831, EvLocallabSpotfeather = 832, + Evlocallabstrcolh = 833, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 4a2053d31..db855ad70 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2465,6 +2465,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : structcol(0), strcol(0.), strcolab(0.), + strcolh(0.), angcol(0.), blurcolde(5), blendmaskcol(0), @@ -2815,6 +2816,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && structcol == other.structcol && strcol == other.strcol && strcolab == other.strcolab + && strcolh == other.strcolh && angcol == other.angcol && blendmaskcol == other.blendmaskcol && radmaskcol == other.radmaskcol @@ -4159,6 +4161,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).structcol, "Locallab", "Structcol_" + std::to_string(i), spot.structcol, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strcol, "Locallab", "Strcol_" + std::to_string(i), spot.strcol, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strcolab, "Locallab", "Strcolab_" + std::to_string(i), spot.strcolab, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strcolh, "Locallab", "Strcolh_" + std::to_string(i), spot.strcolh, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).angcol, "Locallab", "Angcol_" + std::to_string(i), spot.angcol, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurcolde, "Locallab", "Blurcolde_" + std::to_string(i), spot.blurcolde, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskcol, "Locallab", "Blendmaskcol_" + std::to_string(i), spot.blendmaskcol, keyFile); @@ -5611,6 +5614,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Structcol_" + std::to_string(i), pedited, spot.structcol, spotEdited.structcol); assignFromKeyfile(keyFile, "Locallab", "Strcol_" + std::to_string(i), pedited, spot.strcol, spotEdited.strcol); assignFromKeyfile(keyFile, "Locallab", "Strcolab_" + std::to_string(i), pedited, spot.strcolab, spotEdited.strcolab); + assignFromKeyfile(keyFile, "Locallab", "Strcolh_" + std::to_string(i), pedited, spot.strcolh, spotEdited.strcolh); assignFromKeyfile(keyFile, "Locallab", "Angcol_" + std::to_string(i), pedited, spot.angcol, spotEdited.angcol); assignFromKeyfile(keyFile, "Locallab", "Blurcolde_" + std::to_string(i), pedited, spot.blurcolde, spotEdited.blurcolde); assignFromKeyfile(keyFile, "Locallab", "Blendmaskcol_" + std::to_string(i), pedited, spot.blendmaskcol, spotEdited.blendmaskcol); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index f94e37a8b..2eef8238c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1008,6 +1008,7 @@ struct LocallabParams { int structcol; double strcol; double strcolab; + double strcolh; double angcol; int blurcolde; int blendmaskcol; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 245db4fe9..ab8229422 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -860,7 +860,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabstrcol LUMINANCECURVE, // Evlocallabangcol LUMINANCECURVE, // Evlocallabstrcolab - LUMINANCECURVE // EvLocallabSpotfeather + LUMINANCECURVE, // EvLocallabSpotfeather + LUMINANCECURVE // Evlocallabstrcolh }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index b5a48e669..c8d9d3ce0 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -268,7 +268,8 @@ Locallab::Locallab(): blurcolde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), strcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTRLUM"), -4., 4., 0.05, 0.))), strcolab(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTRCHRO"), -6., 6., 0.05, 0.))), - angcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -90, 90, 0.1, 0.))), + strcolh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTRHUE"), -6., 6., 0.05, 0.))), + angcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.))), blendmaskcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), radmaskcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), chromaskcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), @@ -295,7 +296,7 @@ Locallab::Locallab(): structexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), blurexpde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), strexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -4., 4., 0.05, 0.))), - angexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -90, 90, 0.1, 0.))), + angexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.))), blendmaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), radmaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), chromaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), @@ -311,7 +312,7 @@ Locallab::Locallab(): fatdetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATDETAIL"), -100., 300., 1., 0.))), fatanchor(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 1., 100., 1., 50., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), strmaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -2., 2., 0.05, 0.))), - angmaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -90., 90., 0.1, 0.))), + angmaskexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180., 180., 0.1, 0.))), fatlevel(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATLEVEL"), 0, 3, 1, 2))), multipliersh( [this]() -> std::array @@ -346,7 +347,7 @@ blendmaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1 radmaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 0.))), blurSHde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), strSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -4., 4., 0.05, 0.))), -angSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -90, 90, 0.1, 0.))), +angSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.))), chromaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), gammaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.25, 4.0, 0.01, 1.))), slomaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), @@ -684,6 +685,7 @@ pe(nullptr) strcol->setAdjusterListener(this); angcol->setAdjusterListener(this); strcolab->setAdjusterListener(this); + strcolh->setAdjusterListener(this); blendmaskcol->setAdjusterListener(this); radmaskcol->setAdjusterListener(this); @@ -708,6 +710,7 @@ pe(nullptr) if (showtooltip) { strcol->set_tooltip_text(M("TP_LOCALLAB_GRADSTR_TOOLTIP")); strcolab->set_tooltip_text(M("TP_LOCALLAB_GRADSTRAB_TOOLTIP")); + strcolh->set_tooltip_text(M("TP_LOCALLAB_GRADSTRHUE_TOOLTIP")); angcol->set_tooltip_text(M("TP_LOCALLAB_GRADANG_TOOLTIP")); } @@ -977,6 +980,7 @@ pe(nullptr) ToolParamBlock* const gradcolBox = Gtk::manage(new ToolParamBlock()); gradcolBox->pack_start(*strcol); gradcolBox->pack_start(*strcolab); + gradcolBox->pack_start(*strcolh); gradcolBox->pack_start(*angcol); gradcolFrame->add(*gradcolBox); @@ -3889,6 +3893,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).strcol = strcol->getValue(); pp->locallab.spots.at(pp->locallab.selspot).angcol = angcol->getValue(); pp->locallab.spots.at(pp->locallab.selspot).strcolab = strcolab->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).strcolh = strcolh->getValue(); if (qualitycurveMethod->get_active_row_number() == 0) { pp->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod = "none"; @@ -4385,6 +4390,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pe->locallab.spots.at(pp->locallab.selspot).structcol = pe->locallab.spots.at(pp->locallab.selspot).structcol || structcol->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).strcol = pe->locallab.spots.at(pp->locallab.selspot).strcol || strcol->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).strcolab = pe->locallab.spots.at(pp->locallab.selspot).strcolab || strcolab->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).strcolh = pe->locallab.spots.at(pp->locallab.selspot).strcolh || strcolh->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).angcol = pe->locallab.spots.at(pp->locallab.selspot).angcol || angcol->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod = pe->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod || qualitycurveMethod->get_active_text() != M("GENERAL_UNCHANGED"); pe->locallab.spots.at(pp->locallab.selspot).gridMethod = pe->locallab.spots.at(pp->locallab.selspot).gridMethod || gridMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -4739,6 +4745,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pedited->locallab.spots.at(pp->locallab.selspot).structcol = pedited->locallab.spots.at(pp->locallab.selspot).structcol || structcol->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).strcol = pedited->locallab.spots.at(pp->locallab.selspot).strcol || strcol->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).strcolab = pedited->locallab.spots.at(pp->locallab.selspot).strcolab || strcolab->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).strcolh = pedited->locallab.spots.at(pp->locallab.selspot).strcolh || strcolh->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).angcol = pedited->locallab.spots.at(pp->locallab.selspot).angcol || angcol->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod = pedited->locallab.spots.at(pp->locallab.selspot).qualitycurveMethod || qualitycurveMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.spots.at(pp->locallab.selspot).gridMethod = pedited->locallab.spots.at(pp->locallab.selspot).gridMethod || gridMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -5636,7 +5643,7 @@ void Locallab::merMethodChanged() blurcolde->set_sensitive(true); H2CurveEditorG->set_sensitive(true); rgbCurveEditorG->set_sensitive(true); - // strcolab->set_sensitive(false); + strcolh->set_sensitive(false); special->set_sensitive(true); invers->set_sensitive(true); gridmerFrame->hide(); @@ -5649,7 +5656,7 @@ void Locallab::merMethodChanged() rgbCurveEditorG->set_sensitive(true); special->set_sensitive(true); invers->set_sensitive(true); -// strcolab->set_sensitive(false); + strcolh->set_sensitive(false); conthrcol->hide(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 2) { @@ -5661,7 +5668,7 @@ void Locallab::merMethodChanged() rgbCurveEditorG->set_sensitive(false); special->set_sensitive(false); invers->set_sensitive(false); - strcolab->set_sensitive(true); + strcolh->set_sensitive(true); conthrcol->show(); gridmerFrame->hide(); } else if (merMethod->get_active_row_number() == 3) { @@ -5672,7 +5679,7 @@ void Locallab::merMethodChanged() rgbCurveEditorG->set_sensitive(false); special->set_sensitive(false); invers->set_sensitive(false); - strcolab->set_sensitive(true); + strcolh->set_sensitive(true); mask7->show(); conthrcol->show(); gridmerFrame->hide(); @@ -5686,7 +5693,7 @@ void Locallab::merMethodChanged() rgbCurveEditorG->set_sensitive(false); special->set_sensitive(false); invers->set_sensitive(false); - strcolab->set_sensitive(true); + strcolh->set_sensitive(true); gridmerFrame->show(); } @@ -7092,6 +7099,7 @@ void Locallab::setDefaults(const rtengine::procparams::ProcParams * defParams, c structcol->setDefault((double)defSpot->structcol); strcol->setDefault((double)defSpot->strcol); strcolab->setDefault((double)defSpot->strcolab); + strcolh->setDefault((double)defSpot->strcolh); angcol->setDefault((double)defSpot->angcol); blurcolde->setDefault((double)defSpot->blurcolde); blendmaskcol->setDefault((double)defSpot->blendmaskcol); @@ -7305,6 +7313,7 @@ void Locallab::setDefaults(const rtengine::procparams::ProcParams * defParams, c structcol->setDefaultEditedState(Irrelevant); strcol->setDefaultEditedState(Irrelevant); strcolab->setDefaultEditedState(Irrelevant); + strcolh->setDefaultEditedState(Irrelevant); angcol->setDefaultEditedState(Irrelevant); strengthgrid->setDefault((double)defSpot->strengthgrid); blurcolde->setDefaultEditedState(Irrelevant); @@ -7523,6 +7532,7 @@ void Locallab::setDefaults(const rtengine::procparams::ProcParams * defParams, c structcol->setDefaultEditedState(defSpotState->structcol ? Edited : UnEdited); strcol->setDefaultEditedState(defSpotState->strcol ? Edited : UnEdited); strcolab->setDefaultEditedState(defSpotState->strcolab ? Edited : UnEdited); + strcolh->setDefaultEditedState(defSpotState->strcolh ? Edited : UnEdited); angcol->setDefaultEditedState(defSpotState->angcol ? Edited : UnEdited); strengthgrid->setDefaultEditedState(defSpotState->strengthgrid ? Edited : UnEdited); blurcolde->setDefaultEditedState(defSpotState->blurcolde ? Edited : UnEdited); @@ -7840,6 +7850,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == strcolh) { + if (listener) { + listener->panelChanged(Evlocallabstrcolh, strcolh->getTextValue()); + } + } + if (a == angcol) { if (listener) { listener->panelChanged(Evlocallabangcol, angcol->getTextValue()); @@ -9028,6 +9044,7 @@ void Locallab::setBatchMode(bool batchMode) structcol->showEditedCB(); strcol->showEditedCB(); strcolab->showEditedCB(); + strcolh->showEditedCB(); angcol->showEditedCB(); strengthgrid->showEditedCB(); blurcolde->showEditedCB(); @@ -9591,6 +9608,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con strcol->setValue(pp->locallab.spots.at(index).strcol); angcol->setValue(pp->locallab.spots.at(index).angcol); strcolab->setValue(pp->locallab.spots.at(index).strcolab); + strcolh->setValue(pp->locallab.spots.at(index).strcolh); if (pp->locallab.spots.at(index).qualitycurveMethod == "none") { qualitycurveMethod->set_active(0); @@ -10116,6 +10134,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con structcol->setEditedState(spotState->structcol ? Edited : UnEdited); strcol->setEditedState(spotState->strcol ? Edited : UnEdited); strcolab->setEditedState(spotState->strcolab ? Edited : UnEdited); + strcolh->setEditedState(spotState->strcolh ? Edited : UnEdited); angcol->setEditedState(spotState->angcol ? Edited : UnEdited); labgrid->setEdited(spotState->labgridALow || spotState->labgridBLow || spotState->labgridAHigh || spotState->labgridBHigh); labgridmerg->setEdited(spotState->labgridALowmerg || spotState->labgridBLowmerg || spotState->labgridAHighmerg || spotState->labgridBHighmerg); @@ -10535,7 +10554,7 @@ void Locallab::updateSpecificGUIState() mask7->hide(); conthrcol->hide(); structcol->set_sensitive(true); -// strcolab->set_sensitive(false); + strcolh->set_sensitive(false); sensi->set_sensitive(true); blurcolde->set_sensitive(true); H2CurveEditorG->set_sensitive(true); @@ -10546,7 +10565,7 @@ void Locallab::updateSpecificGUIState() } else if (merMethod->get_active_row_number() == 1) { mask7->hide(); structcol->set_sensitive(true); - // strcolab->set_sensitive(false); + strcolh->set_sensitive(false); sensi->set_sensitive(true); blurcolde->set_sensitive(true); H2CurveEditorG->set_sensitive(true); @@ -10558,7 +10577,7 @@ void Locallab::updateSpecificGUIState() } else if (merMethod->get_active_row_number() == 2) { mask7->show(); structcol->set_sensitive(false); - // strcolab->set_sensitive(true); + strcolh->set_sensitive(true); sensi->set_sensitive(false); blurcolde->set_sensitive(false); H2CurveEditorG->set_sensitive(false); @@ -10572,7 +10591,7 @@ void Locallab::updateSpecificGUIState() structcol->set_sensitive(false); sensi->set_sensitive(false); blurcolde->set_sensitive(false); - strcolab->set_sensitive(true); + strcolh->set_sensitive(true); H2CurveEditorG->set_sensitive(false); rgbCurveEditorG->set_sensitive(false); special->set_sensitive(false); @@ -10582,7 +10601,7 @@ void Locallab::updateSpecificGUIState() } else if (merMethod->get_active_row_number() == 3) { mask7->show(); structcol->set_sensitive(false); - strcolab->set_sensitive(true); + strcolh->set_sensitive(true); sensi->set_sensitive(false); blurcolde->set_sensitive(false); H2CurveEditorG->set_sensitive(false); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index ee361d7f9..d50b1b105 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -171,6 +171,7 @@ private: Adjuster* const blurcolde; Adjuster* const strcol; Adjuster* const strcolab; + Adjuster* const strcolh; Adjuster* const angcol; Adjuster* const blendmaskcol; Adjuster* const radmaskcol; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 9d0e7bf08..3ee2b9dbe 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1001,6 +1001,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).structcol = locallab.spots.at(j).structcol && pSpot.structcol == otherSpot.structcol; locallab.spots.at(j).strcol = locallab.spots.at(j).strcol && pSpot.strcol == otherSpot.strcol; locallab.spots.at(j).strcolab = locallab.spots.at(j).strcolab && pSpot.strcolab == otherSpot.strcolab; + locallab.spots.at(j).strcolh = locallab.spots.at(j).strcolh && pSpot.strcolh == otherSpot.strcolh; locallab.spots.at(j).angcol = locallab.spots.at(j).angcol && pSpot.angcol == otherSpot.angcol; locallab.spots.at(j).blurcolde = locallab.spots.at(j).blurcolde && pSpot.blurcolde == otherSpot.blurcolde; locallab.spots.at(j).blendmaskcol = locallab.spots.at(j).blendmaskcol && pSpot.blendmaskcol == otherSpot.blendmaskcol; @@ -2964,6 +2965,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).strcolab = mods.locallab.spots.at(i).strcolab; } + if (locallab.spots.at(i).strcolh) { + toEdit.locallab.spots.at(i).strcolh = mods.locallab.spots.at(i).strcolh; + } + if (locallab.spots.at(i).angcol) { toEdit.locallab.spots.at(i).angcol = mods.locallab.spots.at(i).angcol; } @@ -5108,6 +5113,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : structcol(v), strcol(v), strcolab(v), + strcolh(v), angcol(v), blurcolde(v), blendmaskcol(v), @@ -5454,6 +5460,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) structcol = v; strcol = v; strcolab = v; + strcolh = v; angcol = v; blurcolde = v; blendmaskcol = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 5ebc50faa..9b7b9f8b1 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -435,6 +435,7 @@ public: bool structcol; bool strcol; bool strcolab; + bool strcolh; bool angcol; bool blurcolde; bool blendmaskcol;