img
Class PictureX

java.lang.Object
  extended by img.DigitalPicture
      extended by img.PictureX
All Implemented Interfaces:
AbstractDigitalPicture

public class PictureX
extends DigitalPicture

This class encapsulates a picture. A picture has a width and a height (given in pixels). The number of pixels in the picture is determined by the width and height of the picture. This class is based on the Picture class from Guzdial and Ericson, with explanatory comments and modifications provided by various contributors: sdc@cs.albany.edu, ericson@cc.gatech.edu. mb@cse.yorku.ca This class extends SimplePicture (which provisions for the addition of specific functionality)


Constructor Summary
PictureX()
          Default constructor.
PictureX(int width, int height)
          Constructs a picture with the width and height as specified by the passed parameter values.
PictureX(PictureX copyPicture)
          Constructs a picture that is a copy of the specified picture.
PictureX(java.lang.String fileName)
          Constructs a picture from the filename that is passed as parameter.
 
Method Summary
 void blacken(int row)
          The method causes all of the pixels in the specified row to be changed to a black colour.
 java.lang.String toString()
          Return a string representation of this Picture.
 
Methods inherited from class img.DigitalPicture
addMessage, copyPicture, createGraphics, explore, getBasicPixel, getBufferedImage, getExtension, getFileName, getGraphics, getGraphics2D, getHeight, getImage, getPictureFrame, getPictureWithHeight, getPixel, getPixels, getTitle, getTranslationEnclosingRectangle, getWidth, load, load, loadPictureAndShowIt, repaint, setAllPixelsToAColor, setBasicPixel, setPictureFrame, setTitle, show, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PictureX

public PictureX()
Default constructor. A default constructor is, by definition, one that takes no arguments.


PictureX

public PictureX(java.lang.String fileName)
Constructs a picture from the filename that is passed as parameter. The width and height of the picture will be determined by the images that is contained in the file.

Parameters:
fileName - the name of the file to create the picture from

PictureX

public PictureX(int width,
                int height)
Constructs a picture with the width and height as specified by the passed parameter values.

Parameters:
width - the width of the desired picture
height - the height of the desired picture

PictureX

public PictureX(PictureX copyPicture)
Constructs a picture that is a copy of the specified picture.

Method Detail

toString

public java.lang.String toString()
Return a string representation of this Picture. The string contains the height and width of the image.

Overrides:
toString in class DigitalPicture
Returns:
as described above.

blacken

public void blacken(int row)
The method causes all of the pixels in the specified row to be changed to a black colour.

Parameters:
row -