Package edu.wustl.cse231s.pixel
Class BufferedImageMutablePixels
java.lang.Object
edu.wustl.cse231s.pixel.BufferedImageMutablePixels
- All Implemented Interfaces:
MutablePixels
- Author:
- Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColor(int x, int y)Gets the Color of the pixel at the given coordinates.intintgetWidth()booleanisInBounds(int x, int y)Checks to see whether this image contains a pixel at the given coordinates.voidSets the pixel at the given coordinates to a replacement color.toString()
-
Constructor Details
-
BufferedImageMutablePixels
-
-
Method Details
-
isInBounds
public boolean isInBounds(int x, int y)Description copied from interface:MutablePixelsChecks to see whether this image contains a pixel at the given coordinates.- Specified by:
isInBoundsin interfaceMutablePixels- Parameters:
x- The x-coordinate of the desired pixel.y- The y-coordinate of the desired pixel.- Returns:
- true if the given pixel coordinates are within the bounds of the image, otherwise false.
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceMutablePixels
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceMutablePixels
-
getColor
Description copied from interface:MutablePixelsGets the Color of the pixel at the given coordinates.- Specified by:
getColorin interfaceMutablePixels- Parameters:
x- The x-coordinate of the desired pixel.y- The y-coordinate of the desired pixel.- Returns:
- The color of the image at the given pixel.
-
setColor
Description copied from interface:MutablePixelsSets the pixel at the given coordinates to a replacement color.- Specified by:
setColorin interfaceMutablePixels- Parameters:
x- The x-coordinate of the desired pixel.y- The y-coordinate of the desired pixel.color- The new color for the pixel.
-
toString
-