import java.awt.image.BufferedImage; import java.awt.Graphics2D;
public static BufferedImage negative(BufferedImage source){ BufferedImage out = new BufferedImage(source.getWidth(), source.getHeight(), source.getType()); for (int i = 0; i < out.getWidth(); i++) { for (int j = 0; j < out.getHeight(); j++) { out.setRGB(i, j, (source.getRGB(i, j) ^ 0xffffff)); } } return out; }
修改前
before

修改後
after

沒有留言 :
張貼留言