Changing the hue/saturation of a PImage object
in
Programming Questions
•
1 year ago
What's the best way to change the hue of a PImage object?
Basically the stage has a background on it and on top of the background are a number of smaller PImage objects. I'm trying to be able to dynamically change the color of the overlaying PImage, however this is done based on the change in the user's mouse location (moving along the x axis changes hue, the y axis changes saturation). There doesn't seem to be a way to fill the PImage object with a solid color based on the old hue before the mouse moved.
Basically I'm trying to do this (if it were possible):
PImage img = (some image);
public void change(PImage img, int x_dif, int y_dif){
img.hue += x_dif;
img.saturation += y_dif;
}
Is there an easy way to do this? I've already set the color mode of the document up to HSB and so forth. I looked into looping through all the pixels but its just an integer array which I'd assume refers to the hue, and therefore doesn't allow changes to saturation as well. Any help would be greatly appreciated, thanks!
1