/** * Class for creating a template for a simple Java program * * @author Pat Troy: troy AT uic DOT edu */ import java.awt.Color; // Note the name of the class in the following line MUST // match the name of the file. public class Lect34e { public static void main (String[] args) { String fname = FileChooser.pickAFile(); //System.out.println (fname); Picture pict = new Picture (fname); Picture newlyCreatedPicture ; // call method redEyeReduction(pict); pict.explore(); //newlyCreatedPicture.show(); } public static void redEyeReduction (Picture pict) { // create the new picture int xPos, yPos; // local variables int redAmount, greenAmount, blueAmount, grayAmount; Pixel p, p3; Color c1; Color c2 = new Color (190, 28, 41); // create the "red-eye" color // modify each pixel in the picture for (xPos = 121 ; xPos < 193; xPos++) { for (yPos = 91 ; yPos < 107; yPos++) { // get the pixel information from the original picture //int testValue = 0; p = pict.getPixel(xPos, yPos); c1 = p.getColor(); if (p.colorDistance(c2) < 50.0) p.setColor( new Color (61, 41, 30)); } } // end of for loop } // end of method } // end of class