/*
  Author: Philip Chan

  Description: Given a photo, reduce the red eye effect
 */

import java.awt.*;
import java.util.*;

public class RedEye
{
    //  Reducing the red eye effect:
    //  check each pixel in the picture (a 2D table of pixels)
    //    red intensity is red divided by the average of green and blue
    //       (beware of division by zero; also, don't use integer division)
    //    if red intensity is greater than 2.0 (or 1.5), replace the color with 
    //       red = average of green and blue, green and blue remain the same
    public static void reduceRedEye(Picture pic)
    {
	/*
	Color color = pic.get(x, y);   // get the color of a pixel at x,y
	int   red = color.getRed(),    // get the red value of color
	      green = color.getGreen(),// get the green value of color
	      blue = color.getBlue();  // get the blue value of color

        Color newColor = new Color(red, green, blue); // create a new color
        pic.set(x, y, newColor);       // set newColor at pixel x,y
	*/

	int width = pic.width(),       // length of the x axis
	    height = pic.height();     // length of the y axis
	System.out.println("width = " +  width + ", height = " + height); 

	//  start your instructions
	//  hint: to check every pixel, the loop structure is similar to drawing
	//        a rectangle two days ago
	double redIntensity; //beware of division by zero; also, don't use integer division







	



	// extra: change the picture to black and white



    }


    public static void main (String[] args) throws InterruptedException
    {
	//Picture pic = new Picture(args[0]);
	Picture pic = new Picture("redeye.jpg");
	pic.setOriginLowerLeft();  // so we can use the regular x,y coordinates	
	pic.show();

	System.out.print("Thinking... ");
	reduceRedEye(pic);
	Thread.sleep(1000);  // delay the display of the new image by 1 second
	pic.show();
	System.out.println("Finished");
    }
}
