/** * Simple Picture manipulation * * @author Pat Troy: troy AT uic DOT edu */ // Note the name of the class in the following line MUST // match the name of the file. This is stored in a file // named: Template.java public class Lect1004a { public static void main (String[] args) { System.out.println("Begin Java Exection"); System.out.println(""); // put your Java Program here // Access and open the picture String filename = FileChooser.pickAFile (); Picture p = new Picture (filename); // get the width and height of the picture int width = p.getWidth(); int height = p.getHeight(); System.out.println ("Width: " + width + ", Height: " + height); // Set up a loop to access all the X position int xPos; int yPos; //xPos = 0; //while ( xPos < width) //{ //// do something //System.out.println ("xPos: " + xPos); //xPos = xPos + 1; //} for ( xPos = 0 ; xPos < width ; xPos = xPos + 1 ) { for ( yPos = 0 ; yPos < height ; yPos = yPos + 1 ) { // do something //System.out.println ("xPos: " + xPos + ", yPos: " + yPos); Pixel pix; pix = p.getPixel (xPos, yPos); pix.setGreen (255); } } // explore (display) the p;icture p.explore(); System.out.println(""); System.out.println("End Java Exection"); } } // end of Template class