|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavalib.worldimages.AImage
javalib.worldimages.ColoredImage
javalib.worldimages.PolygonImage
class PolygonImage
The class to represent filled Polygon images drawn by the
world when drawing on its Canvas
.
Field Summary | |
---|---|
protected Polygon |
poly
|
protected int[] |
xcoord
|
protected int[] |
ycoord
|
Fields inherited from class javalib.worldimages.ColoredImage |
---|
defaultColor |
Fields inherited from interface javalib.worldimages.WorldImage |
---|
LOOKS_SAME |
Constructor Summary | |
---|---|
protected |
PolygonImage(Color color,
Mode mode,
int[] xcoord,
int[] ycoord)
A protected constructor that takes in arrays of coordinates. |
protected |
PolygonImage(Color color,
Mode mode,
Posn... points)
A full constructor for this Polygon image. |
Method Summary | |
---|---|
void |
draw(Graphics2D g)
Draw this image in the provided Graphics2D context. |
boolean |
equals(Object o)
Is this PolygonImage same as the given object? |
int |
getBottom()
Produce the bottom of the bounding box. |
int |
getLeft()
Getter for the left edge of the bounding box. |
int |
getRight()
Produce the bottom of the bounding box. |
int |
getTop()
Getter for the top of the bounding box. |
int |
hashCode()
The hashCode to match the equals method |
(package private) static PolygonImage |
make(Color color,
Mode mode,
Posn... points)
|
(package private) static PolygonImage |
make(Color color,
Posn... points)
|
(package private) static PolygonImage |
make(IColor color,
Mode mode,
Posn... points)
|
(package private) static PolygonImage |
make(IColor color,
Posn... points)
|
(package private) static PolygonImage |
make(Mode mode,
Posn... points)
|
(package private) static PolygonImage |
make(Posn... points)
|
ColoredImage |
replaceColor(Color newColor)
Functional setter for the color field Define this in all concrete subclasses. |
ColoredImage |
replaceMode(Mode newMode)
Functional setter for the mode field Define this in all concrete subclasses. |
String |
toIndentedString(String indent)
Produce a String that represents this image, indented by the given indent . |
Methods inherited from class javalib.worldimages.ColoredImage |
---|
getColor, getMode, replaceColor |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Polygon poly
protected int[] xcoord
protected int[] ycoord
Constructor Detail |
---|
protected PolygonImage(Color color, Mode mode, int[] xcoord, int[] ycoord)
color
- xcoord
- an array of the x coordinates of the verticesycoord
- an array of the y coordinates of the verticesprotected PolygonImage(Color color, Mode mode, Posn... points)
color
- the color for this imagemode
- either FILLED or OUTLINEDpoints
- the vertices of this PolygonMethod Detail |
---|
public void draw(Graphics2D g)
WorldImage
Graphics2D
context.
g
- the provided Graphics2D
contextpublic boolean equals(Object o)
PolygonImage
same as the given object?
equals
in interface WorldImage
equals
in class ColoredImage
o
- the object to compare with this
public int getBottom()
WorldImage
public int getLeft()
AImage
getLeft
in interface WorldImage
getLeft
in class AImage
public int getRight()
WorldImage
public int getTop()
AImage
getTop
in interface WorldImage
getTop
in class AImage
public int hashCode()
hashCode
in interface WorldImage
hashCode
in class ColoredImage
static PolygonImage make(Color color, Mode mode, Posn... points)
static PolygonImage make(Color color, Posn... points)
static PolygonImage make(IColor color, Mode mode, Posn... points)
static PolygonImage make(IColor color, Posn... points)
static PolygonImage make(Mode mode, Posn... points)
static PolygonImage make(Posn... points)
public ColoredImage replaceColor(Color newColor)
ColoredImage
replaceColor
in class ColoredImage
public ColoredImage replaceMode(Mode newMode)
ColoredImage
replaceMode
in class ColoredImage
public String toIndentedString(String indent)
WorldImage
String
that represents this image, indented by the given indent
.
Define this in all concrete subclasses.
Convention: The result of toIndentedString() will neither begin nor end with a newline; the specified indent will immediately follow each internal newline.
indent
- the given prefix representing the desired indentation
String
representation of this image
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |