Class Image

    • Constructor Detail

      • Image

        public Image​(String filename)
        Create a image ETN that takes as a parameter the filename
        Parameters:
        filename - the name of the file
    • Method Detail

      • isInBounds

        public boolean isInBounds​(int x,
                                  int y)
        Determine if the given (x,y) coordinate is within the bounds of this image.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        Returns:
        true if the given (x,y) coordinate is within the bounds of this image.
      • getColor

        public Color getColor​(int x,
                              int y)
        Returns the color of the pixel at the given (x,y) coordinate if the coordinate is within the bounds of the image; otherwise returns the default color
        Parameters:
        x - the x coordinate
        y - the y coordinate
        Returns:
        the color of the pixel at the given (x,y) coordinate if the coordinate is within the bounds of the image; otherwise returns the default color
      • evaluate

        public RGBColor evaluate​(double x,
                                 double y)
        Returns the RGBColor of an image at a given x,y coordinate
        Specified by:
        evaluate in interface EvaluatableExpression
        Specified by:
        evaluate in class ExpressionTreeNode
        Parameters:
        x - the x coordinate of the image
        y - the y coordinate of the image
        Returns:
        the color of the image at given x,y coordinates