Class Image
- java.lang.Object
-
- picasso.parser.language.ExpressionTreeNode
-
- picasso.parser.language.expressions.Image
-
- All Implemented Interfaces:
EvaluatableExpression
public class Image extends ExpressionTreeNode
Represents the Image object in the Picasso language.
-
-
Field Summary
-
Fields inherited from class picasso.parser.language.ExpressionTreeNode
gelementsToValue
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
RGBColor
evaluate(double x, double y)
Returns the RGBColor of an image at a given x,y coordinateColor
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 colorDimension
getSize()
boolean
isInBounds(int x, int y)
Determine if the given (x,y) coordinate is within the bounds of this 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 coordinatey
- 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 coordinatey
- 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 interfaceEvaluatableExpression
- Specified by:
evaluate
in classExpressionTreeNode
- Parameters:
x
- the x coordinate of the imagey
- the y coordinate of the image- Returns:
- the color of the image at given x,y coordinates
-
getSize
public Dimension getSize()
-
-