Update background with luma and chroma ref for L C curves Color and Light

This commit is contained in:
Desmis 2020-07-15 11:38:03 +02:00
parent af0b83be81
commit 7ce4d0eb52
5 changed files with 75 additions and 1 deletions

View File

@ -399,6 +399,25 @@ DiagonalCurveEditor* DiagonalCurveEditorSubGroup::addCurve(Glib::ustring curveLa
return newCE;
}
void DiagonalCurveEditorSubGroup::updateLocallabBackground(CurveEditor* ce)
{
if (ce == parent->displayedCurve) {
paramCurve->updateLocallabBackground(ce->locallabRef);
customCurve->updateLocallabBackground(ce->locallabRef);
NURBSCurve->updateLocallabBackground(ce->locallabRef);
}
}
void DiagonalCurveEditorSubGroup::restoreLocallabBackground()
{
if (parent->displayedCurve) {
paramCurve->updateLocallabBackground(parent->displayedCurve->locallabRef);
customCurve->updateLocallabBackground(parent->displayedCurve->locallabRef);
NURBSCurve->updateLocallabBackground(parent->displayedCurve->locallabRef);
}
}
/*
* Switch off the edit button
*/

View File

@ -95,6 +95,7 @@ public:
void pipetteDrag(EditDataProvider *provider, int modifierKey) override;
void showCoordinateAdjuster(CoordinateProvider *provider) override;
void stopNumericalAdjustment() override;
void updateLocallabBackground(CurveEditor* ce) override;
bool curveReset (CurveEditor *ce) override;
@ -102,6 +103,7 @@ protected:
void storeCurveValues (CurveEditor* ce, const std::vector<double>& p) override;
void storeDisplayedCurve () override;
void restoreDisplayedHistogram () override;
void restoreLocallabBackground() override;
void savePressed ();
void loadPressed ();
void copyPressed ();

View File

@ -1873,6 +1873,11 @@ void LocallabColor::updateMaskBackground(const double normChromar, const double
HHshape->updateLocallabBackground(normHuer);
CHshape->updateLocallabBackground(normHuer);
LHshape->updateLocallabBackground(normHuer);
llshape->updateLocallabBackground(normLumar);
ccshape->updateLocallabBackground(normChromar);
clshape->updateLocallabBackground(normLumar);
lcshape->updateLocallabBackground(normChromar);
return false;
}
);

View File

@ -39,7 +39,9 @@ MyDiagonalCurve::MyDiagonalCurve () :
ugpX(0.0),
ugpY(0.0),
activeParam(-1),
bghistvalid(false)
bghistvalid(false),
locallabRef(0.0)
{
grab_point = -1;
@ -129,6 +131,36 @@ std::vector<double> MyDiagonalCurve::get_vector (int veclen)
return vector;
}
void MyDiagonalCurve::updateLocallabBackground(double ref)
{
locallabRef = ref;
mcih->pending++;
idle_register.add(
[this]() -> bool
{
if (mcih->destroyed) {
if (mcih->pending == 1) {
delete mcih;
} else {
--mcih->pending;
}
return false;
}
mcih->clearPixmap();
mcih->myCurve->queue_draw();
--mcih->pending;
return false;
}
);
}
void MyDiagonalCurve::get_LUT (LUTf &lut)
{
@ -260,6 +292,20 @@ void MyDiagonalCurve::draw (int handle)
cr->set_line_width (1.0 * s);
// Draw Locallab reference value in the background
if (locallabRef > 0.0) {
cr->set_line_width(1.0);
cr->move_to(double(graphX + 1), double(graphY - 1));
c = style->get_color(state);
cr->set_source_rgba(c.get_red(), c.get_green(), c.get_blue(), 0.2);
cr->line_to(double(graphX + 1), double(graphY - 1) - double(graphH - 2));
cr->line_to(double(graphX) + 1.5 + locallabRef*double(graphW -2), double(graphY - 1) - double(graphH - 2));
cr->line_to(double(graphX) + 1.5 + locallabRef*double(graphW -2), double(graphY - 1));
cr->close_path();
cr->fill();
cr->stroke();
}
// draw the left colored bar
if (leftBar) {
// first the background

View File

@ -62,6 +62,7 @@ protected:
int activeParam;
unsigned int* bghist; // histogram values
bool bghistvalid;
double locallabRef; // Locallab reference value to display in the background
void draw (int handle);
void interpolate ();
@ -91,6 +92,7 @@ public:
bool pipetteButton1Pressed(EditDataProvider *provider, int modifierKey) override;
void pipetteButton1Released(EditDataProvider *provider) override;
void pipetteDrag(EditDataProvider *provider, int modifierKey) override;
void updateLocallabBackground(double ref);
void setPos(double pos, int chanIdx) override;
void stopNumericalAdjustment() override;