img
Interface AbstractDigitalPicture

All Known Implementing Classes:
DigitalPicture

public interface AbstractDigitalPicture

This interface provisions for the basic methods that are needed when dealing with a digital picture. A digital picture can be created in three ways: from a file name, from another image, or from a width and height specification. A digital picture has accessor and mutator methods for its pixels. A digital picture can be displayed graphically. A digital picture has an associated string which serves as the picture's title. A digital picture has a rectangular grid of pixels.


Method Summary
 int getBasicPixel(int x, int y)
          Returns the colour information about the specified pixel, as encoded in an int value.
 java.awt.image.BufferedImage getBufferedImage()
          Returns the BufferedImage from the picture
 java.lang.String getFileName()
          Get the name of the file associated with this digital picture, if one exists.
 int getHeight()
          Returns the height of this picture in pixels.
 java.awt.Image getImage()
          Returns the Image from the picture
 Pixel getPixel(int x, int y)
          Returns the Pixel object at the specified (x,y) coordinate.
 java.lang.String getTitle()
          Get the string that encapsulates the title that is associated with this digital picture.
 int getWidth()
          Returns the width of this picture in pixels.
 void load(java.awt.Image image)
           
 void load(java.lang.String fileName)
          Reads the image from the passed filename and construct a corresponding digital picture.
 void setBasicPixel(int x, int y, int rgb)
          Sets the colour of the specified pixel, as encoded in the passed int value.
 void setTitle(java.lang.String title)
          Set the string that encapsulates the title that is associated with this digital picture.
 void show()
          Invokes functionality to show this picture on the graphical display.
 

Method Detail

getFileName

java.lang.String getFileName()
Get the name of the file associated with this digital picture, if one exists. The digital picture may not have been created from a file, in which case this method returns null.

Returns:
as described above

getTitle

java.lang.String getTitle()
Get the string that encapsulates the title that is associated with this digital picture.

Returns:
as described above

setTitle

void setTitle(java.lang.String title)
Set the string that encapsulates the title that is associated with this digital picture.


getWidth

int getWidth()
Returns the width of this picture in pixels.

Returns:
as described above.

getHeight

int getHeight()
Returns the height of this picture in pixels.

Returns:
as described above.

getImage

java.awt.Image getImage()
Returns the Image from the picture

Returns:
as described above.

getBufferedImage

java.awt.image.BufferedImage getBufferedImage()
Returns the BufferedImage from the picture

Returns:
as described above.

getBasicPixel

int getBasicPixel(int x,
                  int y)
Returns the colour information about the specified pixel, as encoded in an int value.

Parameters:
x - the x position of the pixel
y - the y position of the pixel
Returns:
as described above

setBasicPixel

void setBasicPixel(int x,
                   int y,
                   int rgb)
Sets the colour of the specified pixel, as encoded in the passed int value.

Parameters:
x - the x position of the pixel
y - the y position of the pixel

getPixel

Pixel getPixel(int x,
               int y)
Returns the Pixel object at the specified (x,y) coordinate.

Parameters:
x - the x position of the pixel
y - the y position of the pixel
Returns:
as descibed above

load

void load(java.awt.Image image)

load

void load(java.lang.String fileName)
          throws java.lang.Exception
Reads the image from the passed filename and construct a corresponding digital picture.

Parameters:
fileName - as described above
Throws:
java.lang.Exception - if the contents of the passed filename cannot be understood as a image.

show

void show()
Invokes functionality to show this picture on the graphical display.