Yup. You can do this one of two ways.
1) Create a new BufferedImage as you load it which is icy (recommend).
2) On-the-fly overlay some color on the top of your image.
To do 1, it's something like this:
1 2 3 4 5 6 7 8 9 10 11 12
| BufferedImage tintedImage = new BufferedImage(oldImage.getWidth(), oldImage.getHeight(), BufferedImage.TYPE_INT_ARGB); for (int i = 0; i < tintedImage.getRaster().getWidth(); i++) { for (int j = 0; j < tintedImage.getRaster().getHeight(); j++) { int[] data = new int[4]; data = oldImage.getRaster().getPixel(i,j,data); data[2] = Math.min(255,data[2]+50); tintedImage.getRaster().setPixel(i,j,data); } } |
To do 2:
1 2 3
| g.drawImage(oldImage,x,y,width,height,null); g.setColor(new Color(0,0,50,100)); g.fillRect(x,y,width,height); |
#2 will unfortunately leave a haze around the transparent area. You can also just do #1 every single time you draw, but that's slow.