1 2 | import java.awt.image.BufferedImage; import java.awt.Graphics2D; |
1 2 3 4 5 6 7 8 9 | 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

沒有留言 :
張貼留言