Flat curve editor widget, HSV tool modified to use it.

Usage :
 - click & drag a control point to move it in X&Y direction
 - click & drag a vertical line to move it in horizontal or vertical direction (the very first move will be used to determine the motion direction)
 - click & drag the yellow or blue square handle to modify the tangent of the same color
This commit is contained in:
Hombre
2011-03-24 00:39:48 +01:00
parent e57a56b40f
commit eb4b2d8781
44 changed files with 4778 additions and 2136 deletions

View File

@@ -69,10 +69,11 @@ LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this), brAdd(false), contrAdd
curveEditorG = new CurveEditorGroup ();
curveEditorG->setCurveListener (this);
curveEditorG->setColorProvider (this);
lshape = curveEditorG->addCurve("L");
ashape = curveEditorG->addCurve("a");
bshape = curveEditorG->addCurve("b");
lshape = (DiagonalCurveEditor*)curveEditorG->addCurve(CT_Diagonal, "L");
ashape = (DiagonalCurveEditor*)curveEditorG->addCurve(CT_Diagonal, "a");
bshape = (DiagonalCurveEditor*)curveEditorG->addCurve(CT_Diagonal, "b");
// This will add the reset button at the end of the curveType buttons
curveEditorG->curveListComplete();
@@ -305,6 +306,32 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) {
}*/
void LCurve::colorForValue (double valX, double valY) {
CurveEditor* ce = curveEditorG->getDisplayedCurve();
if (ce == lshape) { // L = f(L)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == ashape) { // a = f(a)
// TODO: To be implemented
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else if (ce == bshape) { // b = f(b)
red = (double)valY;
green = (double)valY;
blue = (double)valY;
}
else {
printf("Error: no curve displayed!\n");
}
}
void LCurve::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);