Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 113 A February 23 - 27, 2009.

Similar presentations


Presentation on theme: "CSE 113 A February 23 - 27, 2009."— Presentation transcript:

1 CSE 113 A February , 2009

2 Announcements 2/25: In class exercise on loops
2/27: Go over Exam 2 Review Sheet 2/27: Lab 2 due by 11:59:59pm 3/2: Exam 2 3/4: Go over Exam 2 3/6: Exam 2 Makeup

3 Remove all the red from a picture
public void removeRed() { for(int x = 0; x < _p.getWidth(); x++) { for(int y = 0; y < _p.getHeight(); y++) { Pixel pixel = _p.getPixel(x, y); // Simply set the red component of each // pixel to 0. pixel.setRed(0); }

4 Create the negative of a picture
public void createNegative() { for(int x = 0; x < _p.getWidth(); x++) { for(int y = 0; y < _p.getHeight(); y++) { Pixel pixel = _p.getPixel(x, y); // Create a new red value that is // current red value int redValue = pixel.getRed(); // Create a new green value that is // current green value int greenValue = pixel.getGreen(); // Create a new blue value that is // current blue value int blueValue = pixel.getBlue();

5 Create the negative of a picture (cont.)
// Create a new color based on our new red, green, // and blue values java.awt.Color newColor = new java.awt.Color (redValue,greenValue,blueValue); // Set the color of the pixel to that new color pixel.setColor(newColor); }

6 Wednesday & Friday Class
Wednesday: In-class exercise on loops Friday: Go over Exam 2 Review Sheet (Answers posted online)


Download ppt "CSE 113 A February 23 - 27, 2009."

Similar presentations


Ads by Google