public class Rect extends Object
A rectangle area is represented by the abscissa and ordinate of the upper-left point, width and height.
SystemCapability.Multimedia#IMAGE| 限定符和类型 | 字段 | 说明 |
|---|---|---|
int |
height |
Indicates the height of a rectangle.
|
int |
minX |
Indicates the minimum abscissa value of a rectangle, which is the abscissa of the upper left point.
|
int |
minY |
Indicates the minimum ordinate value of a rectangle, which is the ordinate of the upper left point.
|
int |
width |
Indicates the width of a rectangle.
|
| 构造器 | 说明 |
|---|---|
Rect() |
A constructor used to create a
Rect instance,
with the abscissa and coordinate of the upper-left point, width, and height set to 0. |
Rect(int minX,
int minY,
int width,
int height) |
A constructor used to create a
Rect instance. |
Rect(Rect rect) |
A constructor used to create a
Rect instance with another one as the input parameter. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
cropRect(int minX,
int minY,
int width,
int height) |
Crops a rectangle area.
|
boolean |
equals(Object obj) |
Checks whether the
Rect object is the same as the one
passed through the input parameter. |
int |
hashCode() |
Generates a hash code value based on the
Rect object. |
void |
setEmpty() |
Sets the abscissa, coordinate, width, and height to
0. |
String |
toString() |
Obtains the string representation of the
Rect object. |
public int height
public int minX
public int minY
public int width
public Rect()
Rect instance,
with the abscissa and coordinate of the upper-left point, width, and height set to 0.public Rect(int minX,
int minY,
int width,
int height)
Rect instance.
The abscissa and coordinate of the upper-left point, and the width and height of the rectangle are used as input parameters.
public boolean equals(Object obj)
Rect object is the same as the one
passed through the input parameter.
This method overrides the equals method.
public int hashCode()
Rect object.hashCode 在类中 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public void setEmpty()
0.
Sets the abscissa and coordinate of the upper-left point, width, and height to 0.
public boolean cropRect(int minX,
int minY,
int width,
int height)
The intersection area of the original rectangle and the input rectangle is cropped to adjust the original rectangle area.
minX - Indicates the upper-left point abscissa of the input rectangle.minY - Indicates the upper-left point ordinate of the input rectangle.width - Indicates the width of the input rectangle.height - Indicates the height of the input rectangle.true if the original rectangle area is cropped; returns false otherwise.