Here you can find the source of makeTintedCopy(BufferedImage bi, Color tint)
public static BufferedImage makeTintedCopy(BufferedImage bi, Color tint)
//package com.java2s; //License from project: Open Source License import java.awt.*; import java.awt.image.BufferedImage; public class Main { public static BufferedImage makeTintedCopy(BufferedImage bi, Color tint) { GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration(); BufferedImage tinted = gc.createCompatibleImage(bi.getWidth(), bi.getHeight(), Transparency.TRANSLUCENT); for (int y = 0; y < bi.getHeight(); y++) { for (int x = 0; x < bi.getWidth(); x++) { int rgb = bi.getRGB(x, y); if (rgb != 0) tinted.setRGB(x, y, tint.getRGB()); }//from ww w. j av a 2s . c om } return tinted; } }