This will ultimately be used on the iPhone, but this is a general question that can answer the language in an agnostic way.
How to apply a tuning curve (for example, in Photoshop) to an image for saturation, contrast, etc.
After looking at some c, java, and actionscript libraries, I figured out how to implement linear correction, saturation, and brightness using a 5x5 matrix:
1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
Where I loop over each pixel and change r, g, b, the value of this pixel is based on the above matrix, but how would I translate a 5-point Bezier curve, say, using the Photoshop interface to change r, g, b, a for contrast , saturation, etc. It looks like maybe something like:
valueWithCGAffineTransform
can be used?
EDIT: for further reflection, the idea is that, given the 5-point Bezier curve on the 0-255 axis, how can you calculate the X value for any given Y value on the way? Then you can use this information to convert the values โโof r, g, b, values โโfor the image.