Class Image

java.lang.Object
  extended byImage
All Implemented Interfaces:
Picture

public class Image
extends java.lang.Object
implements Picture

ImagePicture - A picture created from an image.

Author:
Ben Bederson, Bill Pugh Copyright (C) 2003 University of Maryland
See Also:
Picture, PictureColor, PictureUtil

Constructor Summary
Image(java.lang.String imageLocation)
          Constructs a new picture from image at specified location
Image(java.lang.String imageLocation, PictureColor backgroundColor)
          Constructs a new picture from image at specified location with a given background color
 
Method Summary
 PictureColor getBackgroundColor()
          Specifies the background color of the picture.
 PictureColor getColor(int x, int y)
          This specifies the content of a picture by returning the color of the picture at each pixel (i.e., position).
 int getHeight()
           
 int getWidth()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Image

public Image(java.lang.String imageLocation)
Constructs a new picture from image at specified location

Parameters:
imageLocation - Can be URL or local filename of GIF, JPG, or PNG image

Image

public Image(java.lang.String imageLocation,
             PictureColor backgroundColor)
Constructs a new picture from image at specified location with a given background color

Parameters:
imageLocation - Can be URL or local filename of GIF, JPG, or PNG image
backgroundColor - Specifies color of image outside of input image bounds
Method Detail

getColor

public PictureColor getColor(int x,
                             int y)
Description copied from interface: Picture
This specifies the content of a picture by returning the color of the picture at each pixel (i.e., position).

Specified by:
getColor in interface Picture
Parameters:
x - The column within the picture
y - The row within the picture
Returns:
The color of the picture at the specified location
See Also:
Picture.getColor(int, int)

getWidth

public int getWidth()
Specified by:
getWidth in interface Picture
See Also:
Picture.getWidth()

getHeight

public int getHeight()
Specified by:
getHeight in interface Picture
See Also:
Picture.getHeight()

getBackgroundColor

public PictureColor getBackgroundColor()
Specifies the background color of the picture. That is, the color returned past the boundaries of the picture.

Returns:
the bacground color of the picture