CS 40 - Lecture 13

Typical Java Program

public class MyPicture1 extends Picture
{
  public void decreaseRed()
  {
    for (Pixel pix : getPixels())
    {
      int red = pix.getRed();
      red = red / 2;
      pix.setRed(red);
    }
  }  
}