public class RectF
extends java.lang.Object
RectF
represents a rectangle.
It holds four float values for a rectangle.
Modifier and Type | Field and Description |
---|---|
float |
bottom
The Y coordinate of the bottom of the rectangle.
|
float |
left
The X coordinate of the left side of the rectangle.
|
float |
right
The X coordinate of the right side of the rectangle.
|
float |
top
The Y coordinate of the top of the rectangle.
|
Constructor and Description |
---|
RectF()
Construct a
RectF object by the default way, and all coordinates are initialized to 0.0f. |
RectF(float left,
float top,
float right,
float bottom)
Construct a
RectF object with the specified coordinates. |
RectF(RectF other)
Construct a
RectF object with the values in the specified
rectangle. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Check whether the specified object is a
RectF |
java.awt.geom.Rectangle2D.Float |
getRectangle()
Convert the current rectangle to
Rectangle2D.Float |
float |
height()
Get the rectangle's height.
|
void |
set(float left,
float top,
float right,
float bottom)
Set the rectangle's coordinates to the specified values.
|
void |
set(RectF src)
Set the coordinates from source rectangle into this rectangle.
|
void |
setEmpty()
Set the rectangle to (0.0f,0.0f,0.0f,0.0f)
|
float |
width()
Get the rectangle's width.
|
public float left
public float top
public float right
public float bottom
public RectF()
RectF
object by the default way, and all coordinates are initialized to 0.0f.public RectF(float left, float top, float right, float bottom)
RectF
object with the specified coordinates.
Note: no range checking is performed.
left
- The specified left side value.top
- The specified top side value.right
- The specified right side value.bottom
- The specified bottom side value.public RectF(RectF other)
RectF
object with the values in the specified
rectangle.
If the specified RectF
object is null, all coordinates will be initialized to 0.0f.
other
- The rectangle whose coordinates are copied into the new
rectangle.public final float width()
public final float height()
public void setEmpty()
public void set(float left, float top, float right, float bottom)
Note: no range checking is performed.
left
- The specified left side value.top
- The specified top side value.right
- The specified right side value.bottom
- The specified bottom side value.public void set(RectF src)
src
- The rectangle whose coordinates are copied into this
rectangle.public java.awt.geom.Rectangle2D.Float getRectangle()
Rectangle2D.Float.
Rectangle2D.Float object.
public boolean equals(java.lang.Object other)
RectF class and its values equal our values.
equals
in class java.lang.Object
other
- The specified object to compare.boolean
value to indicate the result of checking.