public class Rectangle extends AbstractRectangle implements Serializable
Modifier and Type | Field and Description |
---|---|
float |
height
The height of the rectangle.
|
float |
width
The width of the rectangle.
|
float |
x
The x-coordinate of the rectangle's upper left corner.
|
float |
y
The y-coordinate of the rectangle's upper left corner.
|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
Rectangle()
Constructs a rectangle at (0,0) and with dimensions (0,0).
|
Rectangle(float x,
float y,
float width,
float height)
Constructs a rectangle with the specified upper-left corner and dimensions.
|
Rectangle(IDimension d)
Constructs a rectangle with upper-left corner at (0,0) and the supplied dimensions.
|
Rectangle(IRectangle r)
Constructs a rectangle with bounds equal to the supplied rectangle.
|
Rectangle(XY p)
Constructs a rectangle with the supplied upper-left corner and dimensions (0,0).
|
Rectangle(XY p,
IDimension d)
Constructs a rectangle with upper-left corner at the supplied point and with the supplied
dimensions.
|
Modifier and Type | Method and Description |
---|---|
void |
add(float px,
float py)
Expands the bounds of this rectangle to contain the specified point.
|
void |
add(IRectangle r)
Expands the bounds of this rectangle to contain the supplied rectangle.
|
void |
add(XY p)
Expands the bounds of this rectangle to contain the supplied point.
|
void |
grow(float dx,
float dy)
Grows the bounds of this rectangle by the specified amount (i.e.
|
float |
height()
Returns the height of the framing rectangle.
|
void |
setBounds(float x,
float y,
float width,
float height)
Sets the bounds of this rectangle to the specified bounds.
|
void |
setBounds(IRectangle r)
Sets the bounds of this rectangle to those of the supplied rectangle.
|
void |
setFrame(float x,
float y,
float width,
float height)
Sets the location and size of the framing rectangle of this shape to the specified values.
|
void |
setLocation(float x,
float y)
Sets the upper-left corner of this rectangle to the specified point.
|
void |
setLocation(XY p)
Sets the upper-left corner of this rectangle to the supplied point.
|
void |
setSize(float width,
float height)
Sets the size of this rectangle to the specified dimensions.
|
void |
setSize(IDimension d)
Sets the size of this rectangle to the supplied dimensions.
|
void |
translate(float mx,
float my)
Translates the upper-left corner of this rectangle by the specified amount.
|
float |
width()
Returns the width of the framing rectangle.
|
float |
x()
Returns the x-coordinate of the upper-left corner of the framing rectangle.
|
float |
y()
Returns the y-coordinate of the upper-left corner of the framing rectangle.
|
clone, contains, contains, equals, hashCode, intersection, intersection, intersects, intersectsLine, intersectsLine, location, location, outcode, outcode, pathIterator, pathIterator, size, size, toString, union
bounds, bounds, center, centerX, centerY, contains, contains, frame, frame, intersects, isEmpty, max, maxX, maxY, min, minX, minY, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
public float x
public float y
public float width
public float height
public Rectangle()
public Rectangle(XY p)
public Rectangle(IDimension d)
public Rectangle(XY p, IDimension d)
public Rectangle(float x, float y, float width, float height)
public Rectangle(IRectangle r)
public void setLocation(float x, float y)
public void setLocation(XY p)
public void setSize(float width, float height)
public void setSize(IDimension d)
public void setBounds(float x, float y, float width, float height)
public void setBounds(IRectangle r)
public void grow(float dx, float dy)
public void translate(float mx, float my)
public void add(float px, float py)
public void add(XY p)
public void add(IRectangle r)
public float x()
IRectangularShape
x
in interface IRectangularShape
public float y()
IRectangularShape
y
in interface IRectangularShape
public float width()
IRectangularShape
width
in interface IRectangularShape
public float height()
IRectangularShape
height
in interface IRectangularShape
public void setFrame(float x, float y, float width, float height)
RectangularShape
setFrame
in class RectangularShape
Copyright © 2017. All rights reserved.