1 import java.awt.Color;
2
3 public class Negative
4 {
5 public static void main(String[] args)
6 {
7 Picture pic = new Picture();
8 pic.load("queen-mary.png");
9 for (int x = 0; x < pic.getWidth(); x++)
10 for (int y = 0; y < pic.getHeight(); y++)
11 {
12 Color original = pic.getColorAt(x, y);
13 Color negative = new Color(255 - original.getRed(),
14 255 - original.getGreen(),
15 255 - original.getBlue());
16 pic.setColorAt(x, y, negative);
17 }
18 }
19 }