imageprocessing
Interface IImage
- public interface IImage
In addition to the methods listed here, concrete classes
are encouraged to have a constructor which takes one String parameter, the
name of a file to be opened as an image.
In addition, the toString() method should return a string representation
of the image which can be copied and pased into a text editor to be
saved as a ppm/pgm (this means the string must conform to the
standard file format for those files).
getWidth
public int getWidth()
- Returns:
- The width (number of columns) of the image
getHeight
public int getHeight()
- Returns:
- The height (number of rows) of the image
setPixel
public void setPixel(int r,
int c,
int[] values)
throws IndexOutOfBoundsException,
IllegalArgumentException
- Parameters:
r
- The row of the pixel being setc
- The column of the pixel being setvalues
- an array of values to be set at location (r,c)
For color images, for example,
this would be a size three array ([R G B] ordering).
- Throws:
IndexOutOfBoundsException
- thrown if the given row or column is out of bounds
IllegalArgumentException
- thrown if the length of the values parameter is inappropriate for the image.
getPixel
public int[] getPixel(int r,
int c)
throws IndexOutOfBoundsException
- Parameters:
r
- The row of the pixel being setc
- The column of the pixel being set
- Returns:
- an array of values at the given row and column.
For color images, for example,
this would be a size three array ([R G B] ordering).
- Throws:
IndexOutOfBoundsException
- thrown if the given row or column is out of bounds