All Assignments and Labs

All Assignments and - import java.awt import java.io import java.awt.font import java.awt.geom import java.awt.image.BufferedImage import java.text

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.*; import java.io.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.image.BufferedImage; import java.text.*; import java.util.*; import java.util.List; // resolves problem with java.awt.List and java.util.List /** * A class that represents a picture. This class inherits from * SimplePicture and allows the student to add functionality to * the Picture class. * * Copyright Georgia Institute of Technology 2004-2005 * @author Barbara Ericson [email protected] */ public class Picture extends SimplePicture { ///////////////////// constructors ////////////////////////////////// /** * Constructor that takes no arguments */ public Picture () { /* not needed but use it to show students the implicit call to super() * child constructors always call a parent constructor */ super(); } /** * Constructor that takes a file name and creates the picture * @param fileName the name of the file to create the picture from */ public Picture(String fileName) { // let the parent class handle this fileName super(fileName); } /** * Constructor that takes the width and height * @param width the width of the desired picture * @param height the height of the desired picture */ public Picture(int width, int height) { // let the parent class handle this width and height super(width,height); } /** * Constructor that takes a picture and creates a
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
* copy of that picture */ public Picture(Picture copyPicture) { // let the parent class do the copy super(copyPicture); } /** * Constructor that takes a buffered image * @param image the buffered image to use */ public Picture(BufferedImage image) { //super(image); } ////////////////////// methods /////////////////////////////////////// /** * Method to return a string with information about this picture. * @return a string with information about the picture such as fileName, * height and width. */ public String toString() { String output = "Picture, filename " + getFileName() + " height " + getHeight() + " width " + getWidth(); return output; } public void minRed() { //String fileName = "/home1/c/a/acsi201/pub/mediasources/beach- smaller.jpg"; // Picture myPic = new Picture(fileName2); int loopvar = 0; Pixel[] pix = this.getPixels(); Pixel pickle = null; // myPic.show(); //show for 2 seconds (2thousand milsec) then close picture // Thread.sleep(4000); for(loopvar = 0; loopvar <= pix.length-1; loopvar ++) { pickle = pix[loopvar]; pickle.setRed(0); } //myPic.repaint(); this.repaint(); } public void maxBlue() {
Background image of page 2
//Picture myPic = new Picture(fileName2); int loopvar = 0; Pixel[] pix = this.getPixels(); Pixel pickle = null; for(loopvar = 0; loopvar <= pix.length-1; loopvar ++) { pickle = pix[loopvar]; pickle.setBlue(255); } //myPic.repaint(); this.repaint(); } public void minRedMaxBlue() { minRed(); maxBlue(); } public void swapRGB() {//method start //varible declarations here int loopvar = 0; int new_red = 0; int new_green = 0; int new_blue = 0; Pixel[] pix = this.getPixels(); Pixel pickle = null;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/07/2011 for the course CSI 201 taught by Professor Doanne during the Spring '08 term at SUNY Albany.

Page1 / 12

All Assignments and - import java.awt import java.io import java.awt.font import java.awt.geom import java.awt.image.BufferedImage import java.text

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online