Solving issue 2341: "Pipette and flat curves - no line colors"
This commit is contained in:
@@ -277,6 +277,17 @@ void CurveEditorGroup::curveChanged () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Listener called when the user has modified the curve
|
||||||
|
*/
|
||||||
|
float CurveEditorGroup::blendPipetteValues (float chan1, float chan2, float chan3) {
|
||||||
|
|
||||||
|
if (cl)
|
||||||
|
return cl->blendPipetteValues(chan1, chan2, chan3);
|
||||||
|
|
||||||
|
return -1.f;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call back method when the reset button is pressed :
|
* Call back method when the reset button is pressed :
|
||||||
* reset the currently toggled on curve editor
|
* reset the currently toggled on curve editor
|
||||||
|
@@ -89,6 +89,7 @@ protected:
|
|||||||
void updateGUI (CurveEditor* ce);
|
void updateGUI (CurveEditor* ce);
|
||||||
void curveResetPressed ();
|
void curveResetPressed ();
|
||||||
void curveChanged ();
|
void curveChanged ();
|
||||||
|
float blendPipetteValues(float chan1, float chan2, float chan3);
|
||||||
void setUnChanged (bool uc, CurveEditor* ce);
|
void setUnChanged (bool uc, CurveEditor* ce);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -26,11 +26,40 @@ class CurveListener {
|
|||||||
private:
|
private:
|
||||||
bool multi;
|
bool multi;
|
||||||
public:
|
public:
|
||||||
|
CurveListener() : multi(false) {}
|
||||||
|
virtual ~CurveListener() {}
|
||||||
virtual void curveChanged () {}
|
virtual void curveChanged () {}
|
||||||
virtual void curveChanged (CurveEditor* ce) {}
|
virtual void curveChanged (CurveEditor* ce) {}
|
||||||
void setMulti(bool value) { multi = value; }
|
void setMulti(bool value) { multi = value; }
|
||||||
bool isMulti() { return multi; }
|
bool isMulti() { return multi; }
|
||||||
CurveListener() : multi(false) {}
|
|
||||||
|
/** @brief Blend pipette values from its different channels into a single value
|
||||||
|
If the buffer has more than one channel and one channel, this method will blend them together.
|
||||||
|
@param chan1 first channel's value
|
||||||
|
@param chan2 second channel's value
|
||||||
|
@param chan3 third channel's value
|
||||||
|
@return the blended value */
|
||||||
|
virtual float blendPipetteValues(float chan1, float chan2, float chan3) {
|
||||||
|
float retVal = 0.f;
|
||||||
|
int n = 0;
|
||||||
|
if (chan1 != -1.f) {
|
||||||
|
retVal += chan1;
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
if (chan2 != -1.f) {
|
||||||
|
retVal += chan2;
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
if (chan3 != -1.f) {
|
||||||
|
retVal += chan3;
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
if (n>1)
|
||||||
|
retVal /= n;
|
||||||
|
else if (!n)
|
||||||
|
retVal = -1.f;
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -40,7 +40,7 @@ Gradient::Gradient () : FoldableToolPanel(this), EditSubscriber(ET_OBJECTS), las
|
|||||||
centerY->set_tooltip_text (M("TP_GRADIENT_CENTER_Y_TOOLTIP"));
|
centerY->set_tooltip_text (M("TP_GRADIENT_CENTER_Y_TOOLTIP"));
|
||||||
centerY->setAdjusterListener (this);
|
centerY->setAdjusterListener (this);
|
||||||
|
|
||||||
Gtk::HBox* enaBox = Gtk::manage (new Gtk::HBox());
|
enaBox = Gtk::manage (new Gtk::HBox());
|
||||||
enaBox->pack_start(*enabled);
|
enaBox->pack_start(*enabled);
|
||||||
enaBox->pack_end(*edit, false, false, 0);
|
enaBox->pack_end(*edit, false, false, 0);
|
||||||
pack_start(*enaBox);
|
pack_start(*enaBox);
|
||||||
@@ -289,6 +289,7 @@ void Gradient::trimValues (rtengine::procparams::ProcParams* pp)
|
|||||||
|
|
||||||
void Gradient::setBatchMode (bool batchMode)
|
void Gradient::setBatchMode (bool batchMode)
|
||||||
{
|
{
|
||||||
|
removeIfThere(enaBox, edit, false);
|
||||||
ToolPanel::setBatchMode (batchMode);
|
ToolPanel::setBatchMode (batchMode);
|
||||||
degree->showEditedCB ();
|
degree->showEditedCB ();
|
||||||
feather->showEditedCB ();
|
feather->showEditedCB ();
|
||||||
|
@@ -13,6 +13,7 @@ class Gradient : public ToolParamBlock, public AdjusterListener, public Foldable
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int lastObject;
|
int lastObject;
|
||||||
|
Gtk::HBox* enaBox;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gtk::CheckButton* enabled;
|
Gtk::CheckButton* enabled;
|
||||||
|
@@ -681,6 +681,9 @@ void MyDiagonalCurve::pipetteMouseOver (EditDataProvider *provider, int modifier
|
|||||||
pipetteG = provider->pipetteVal[1];
|
pipetteG = provider->pipetteVal[1];
|
||||||
pipetteB = provider->pipetteVal[2];
|
pipetteB = provider->pipetteVal[2];
|
||||||
pipetteVal = 0.f;
|
pipetteVal = 0.f;
|
||||||
|
if (listener)
|
||||||
|
pipetteVal = listener->blendPipetteValues(pipetteR, pipetteG, pipetteB);
|
||||||
|
else {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
if (pipetteR != -1.f) {
|
if (pipetteR != -1.f) {
|
||||||
pipetteVal += pipetteR;
|
pipetteVal += pipetteR;
|
||||||
@@ -698,8 +701,7 @@ void MyDiagonalCurve::pipetteMouseOver (EditDataProvider *provider, int modifier
|
|||||||
pipetteVal /= n;
|
pipetteVal /= n;
|
||||||
else if (!n)
|
else if (!n)
|
||||||
pipetteVal = -1.f;
|
pipetteVal = -1.f;
|
||||||
|
}
|
||||||
int num = (int)curve.x.size();
|
|
||||||
|
|
||||||
/* graphW and graphH are the size of the graph */
|
/* graphW and graphH are the size of the graph */
|
||||||
calcDimensions();
|
calcDimensions();
|
||||||
@@ -708,7 +710,6 @@ void MyDiagonalCurve::pipetteMouseOver (EditDataProvider *provider, int modifier
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
double minDistanceX = double(MIN_DISTANCE) / double(graphW-1);
|
double minDistanceX = double(MIN_DISTANCE) / double(graphW-1);
|
||||||
double minDistanceY = double(MIN_DISTANCE) / double(graphH-1);
|
|
||||||
|
|
||||||
if (curve.type == DCT_Linear || curve.type == DCT_Spline || curve.type == DCT_NURBS) {
|
if (curve.type == DCT_Linear || curve.type == DCT_Spline || curve.type == DCT_NURBS) {
|
||||||
// get the pointer position
|
// get the pointer position
|
||||||
|
@@ -205,8 +205,9 @@ void MyFlatCurve::draw () {
|
|||||||
cr->set_line_width (1.);
|
cr->set_line_width (1.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the color feedback of the control points
|
// draw the color feedback of the control points
|
||||||
else if (colorProvider) {
|
if (colorProvider) {
|
||||||
|
|
||||||
//if (curve.type!=FCT_Parametric)
|
//if (curve.type!=FCT_Parametric)
|
||||||
for (int i=0; i<(int)curve.x.size(); ++i) {
|
for (int i=0; i<(int)curve.x.size(); ++i) {
|
||||||
@@ -919,6 +920,9 @@ void MyFlatCurve::pipetteMouseOver (EditDataProvider *provider, int modifierKey)
|
|||||||
pipetteG = provider->pipetteVal[1];
|
pipetteG = provider->pipetteVal[1];
|
||||||
pipetteB = provider->pipetteVal[2];
|
pipetteB = provider->pipetteVal[2];
|
||||||
pipetteVal = 0.f;
|
pipetteVal = 0.f;
|
||||||
|
if (listener)
|
||||||
|
pipetteVal = listener->blendPipetteValues(pipetteR, pipetteG, pipetteB);
|
||||||
|
else {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
if (pipetteR != -1.f) {
|
if (pipetteR != -1.f) {
|
||||||
pipetteVal += pipetteR;
|
pipetteVal += pipetteR;
|
||||||
@@ -936,6 +940,7 @@ void MyFlatCurve::pipetteMouseOver (EditDataProvider *provider, int modifierKey)
|
|||||||
pipetteVal /= n;
|
pipetteVal /= n;
|
||||||
else if (!n)
|
else if (!n)
|
||||||
pipetteVal = -1.f;
|
pipetteVal = -1.f;
|
||||||
|
}
|
||||||
|
|
||||||
snapToElmt = -100;
|
snapToElmt = -100;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user