Sorry I didn’t get back to you.
Loosely ripped from the javadoc examples. The filter might look like this:
class HueFilter extends RGBImageFilter {
private int red;
private int green;
private int blue;
public HueFilter(int red,int green,int blue) {
canFilterIndexColorModel = true;
this.red = red;
this.green = green;
this.blue = blue;
}
public int filterRGB(int x, int y, int rgb) {
int originalAlpha = (rgb & 0xFF000000) >> 24;
int originalRed = (rgb & 0x00FF0000) >> 16;
int originalGreen = (rgb & 0x0000FF00) >> 8;
int originalBlue = (rgb & 0x000000FF);
// mod colours here
originalRed += red;
originalGreen += green;
originalBlue += blue;
return (originalAlpha << 24) | (originalRed << 16) | (originalGreen << 8) | originalBlue;
}
}
Then using it might look something like this (to increase red in this case).
Image src = getImage("sourceimagehere");
ImageFilter colorfilter = new HueFilter(25,0,0);
Image img = createImage(new FilteredImageSource(src.getSource(),colorfilter));
I haven’t compiled this code, it just typed so excuse any little errors. In addition you might want to add clamping to prevent values going up over 255 which would screw the whole thing up.
You could also do this by just running through the raster of the image yourself but since the image filtering stuff already exists I thought it might be nice to use.
Again, apologies for the slow response.
Kev