I want to dynamically recolor images that are in red into any color the user wants (except black and white). This will allow me to reduce the amount of work graphics artist has to do. Typically I do this by applying iOS hue shift filter. This requires entering a number in the 0-1.0 range to specify by how much the hue should be shifted.
Here's how my hue shift control looks currently:
I'm trying to make the process simpler by allowing the user to pick the "final" color instead of entering a hue shift number.
For example:
I have a base image in red colors, the user wants this image to be recolored in blue. The user would pick blue, and the code will calculate the hue shift offset from red to blue, and then apply a hue shift filter to the red image, producing the blue one.
-(float)hueShiftFromColor:(UIColor*)originalColor toDesiredColor:(UIColor*)desiredColor;
-OR- if I can use my code to sample a pixel at some point and find it's color, then only the desired color is needed:
-(void)applyHueShiftFilterToBaseImage:(UIImage*)baseImage desiredColor:(UIColor*)desiredColor;
How can I calculate the hue shift difference between two colors (assuming saturation and brightness are kept the same as original color)?