Modifier and Type | Field and Description |
---|---|
protected Rect |
bounds |
int |
numPoints |
int[] |
xPoints |
int[] |
yPoints |
Constructor and Description |
---|
Polygon(int[] xPoints,
int[] yPoints,
int numPoints) |
Polygon(Polygon other,
int dx,
int dy)
Create a new Polygon which is a (possibly) translated version of the original.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics g,
int x,
int y,
boolean fill)
Draw the polygon onto a Graphics object.
|
Polygon |
getCopy() |
Rect |
getRect(Rect dest)
Get the bounding rectangle of the area.
|
boolean |
intersects(Area other)
See if this Area intersects another.
|
boolean |
isIn(int x,
int y)
Check if the point is in the area.
|
void |
paint(Graphics g,
int x,
int y) |
void |
paint(Graphics g,
int x,
int y,
boolean useBrush,
boolean usePen) |
Image |
toImage()
Convert this Polygon to a black and white Image which fits exactly around the bounding Rect for the polygon.
|
Image |
toImage(Color polyColor,
Color backColor) |
Mask |
toMask()
Convert this Polygon to a Mask which fits exactly around the bounding Rect for the polygon.
|
Polygon |
translate(Polygon other,
int dx,
int dy)
Turn this polygon into a translation of the other polygon, by the specified
dx and dy values.
|
public int[] xPoints
public int[] yPoints
public int numPoints
protected Rect bounds
public Polygon(int[] xPoints, int[] yPoints, int numPoints)
public Polygon(Polygon other, int dx, int dy)
public Polygon getCopy()
public Rect getRect(Rect dest)
Area
public boolean isIn(int x, int y)
Area
public boolean intersects(Area other)
Area
intersects
in interface Area
public Polygon translate(Polygon other, int dx, int dy)
other
- The other polygon.dx
- The x translation.dy
- The y translation.public void draw(Graphics g, int x, int y, boolean fill)
public void paint(Graphics g, int x, int y, boolean useBrush, boolean usePen)
public void paint(Graphics g, int x, int y)
public Image toImage()
public Mask toMask()