Class BufferedImageMutablePixels

java.lang.Object
edu.wustl.cse231s.pixel.BufferedImageMutablePixels
All Implemented Interfaces:
MutablePixels

public class BufferedImageMutablePixels extends Object implements MutablePixels
Author:
Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
  • Constructor Details

    • BufferedImageMutablePixels

      public BufferedImageMutablePixels​(BufferedImage bufferedImage)
  • Method Details

    • isInBounds

      public boolean isInBounds​(int x, int y)
      Description copied from interface: MutablePixels
      Checks to see whether this image contains a pixel at the given coordinates.
      Specified by:
      isInBounds in interface MutablePixels
      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:
      getWidth in interface MutablePixels
    • getHeight

      public int getHeight()
      Specified by:
      getHeight in interface MutablePixels
    • getColor

      public Color getColor​(int x, int y)
      Description copied from interface: MutablePixels
      Gets the Color of the pixel at the given coordinates.
      Specified by:
      getColor in interface MutablePixels
      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

      public void setColor​(int x, int y, Color color)
      Description copied from interface: MutablePixels
      Sets the pixel at the given coordinates to a replacement color.
      Specified by:
      setColor in interface MutablePixels
      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

      public String toString()
      Overrides:
      toString in class Object