public class Rectangle extends Shape
DEFAULT_COLOR
Constructor and Description |
---|
Rectangle(double cx,
double cy,
double w,
double h)
Creates a rectangle centered at the given coordinates with
the given dimensions and default color.
|
Rectangle(Point cen,
double w,
double h)
Creates a rectangle centered at the given point with
the given dimensions and default color.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point point)
Determines if this rectangle contains the given point.
|
void |
draw(android.graphics.Canvas canvas)
Draws this rectangle on the given canvas.
|
Point |
getCenter()
Returns the center of this rectangle.
|
double |
getHeight()
Returns the height of this rectangle.
|
double |
getWidth()
Returns the width of this rectangle.
|
void |
move(double dx,
double dy)
Moves this rectangle by the given displacement.
|
public Rectangle(double cx, double cy, double w, double h)
cx
- the x-coordinate of the rectangle centercy
- the y-coordinate of the rectangle centerw
- the width the rectangleh
- the height of the rectanglepublic Rectangle(Point cen, double w, double h)
cen
- the center of the rectanglew
- the width the rectangleh
- the height of the rectanglepublic boolean contains(Point point)
public void draw(android.graphics.Canvas canvas)
public Point getCenter()
public double getHeight()
public double getWidth()