An interface for controlling a 1D cubic spline, continuously evaluated and stored in a lookup table.
Forks
Forks pushed to more recently than kylemcdonald/ofxCurvesTool itself, plus any admin-confirmed fork with commits of its own — worth checking if you're hitting issues with the original.
README
ofxCurvesTool is an addon for openFrameworks
ofxCurvesTool provides an interface for controlling a cubic spline that is continuously evaluated and stored in a lookup table.
LUT Access
To get access to the data stored inside the curve, just use the
[] operator. For example, to make a horizontally fading gradient inside a 256x256 image:for(int x = 0; x < 256; x++) { for(int y = 0; y < 256; y++) { img.setColor(x, y, ofColor(curvesTool[x])); } }
Enable/Disable
The interface only listens to mouse and keyboard events when it is drawn. It's a little magical, but if you're interested in the details see the implementation for
ofxCurvesTool::drawEvent().Loading/Saving
ofxCurvesTool stores data in an anonymous list of lists, using a severely simplified YAML representation. Call
ofxCurvesTool::save() or ofxCurvesTool::load() with a .yml extension.Size
By default ofxCurvesTool uses 256 bins, but if you call
ofxCurvesTool::setup(128) (for example) it will use 128 bins instead.Drawing
If you happen to scale or rotate
ofxCurvesTool, it may get confused about where your mouse is clicking, but it's ok to translate it however you like.
ofxAddons