Hi, I couldn't find it anywhere. And I was kind of bored, so I thought why couldn't I help you? So I wrote simple function which does all the job for you.
Please note that this function will not work at real time, well MAYBE it would work if the bitmap would be very small, and your phone super fast. If you would like to do this in real time, then I think you should look into OpenGL. But don't take my word for it, because I didn't use Canvas for android in a LONG time, maybe you can change it in real time.
Here it is:
/**
* @param bitmap which bitmap to convert
* @param hue any value from 0 to 360.
* @return bitmap with new hue values
*/
public Bitmap setHue(Bitmap bitmap, float hue){
Bitmap newBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
int width = newBitmap.getWidth();
int height = newBitmap.getHeight();
float [] hvs = new float[3];
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
int pixel = newBitmap.getPixel(x,y);
Color.colorToHSV(pixel,hvs);
hvs[0] = hue;
newBitmap.setPixel(x,y,Color.HSVToColor(Color.alpha(pixel),hvs));
}
}
return newBitmap;
}
Here are the hue values:
Just pass your bitmap, and any value from 0 to 360 in this function, and it will return new, processed bitmap.