RectangleF

Inheritance: java.lang.Object, com.aspose.ms.System.ValueType, com.aspose.ms.lang.Struct

public class RectangleF extends Struct<RectangleF>

存储表示矩形位置和大小的四个浮点数。

构造函数

构造函数描述
RectangleF()
RectangleF(float x, float y, float width, float height)使用指定的位置和大小初始化 com.aspose.imaging.RectangleF 结构的新实例。
RectangleF(PointF location, SizeF size)使用指定的位置和大小初始化 com.aspose.imaging.RectangleF 结构的新实例。

方法

方法描述
getEmpty()获取一个新的 com.aspose.imaging.RectangleF 结构实例,其 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 的值均为零。
getLocation()获取或设置此 com.aspose.imaging.RectangleF 结构左上角的坐标。
setLocation(PointF value)获取或设置此 com.aspose.imaging.RectangleF 结构左上角的坐标。
getSize()获取或设置此 com.aspose.imaging.RectangleF 的大小。
setSize(SizeF value)获取或设置此 com.aspose.imaging.RectangleF 的大小。
getX()获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 X 坐标。
setX(float value)获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 X 坐标。
getY()获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 Y 坐标。
setY(float value)获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 Y 坐标。
getWidth()获取或设置此 com.aspose.imaging.RectangleF 结构的宽度。
setWidth(float value)获取或设置此 com.aspose.imaging.RectangleF 结构的宽度。
getHeight()获取或设置此 com.aspose.imaging.RectangleF 结构的高度。
setHeight(float value)获取或设置此 com.aspose.imaging.RectangleF 结构的高度。
getLeft()获取或设置此 com.aspose.imaging.RectangleF 结构左边缘的 X 坐标。
setLeft(float value)获取或设置此 com.aspose.imaging.RectangleF 结构左边缘的 X 坐标。
getTop()获取或设置此 com.aspose.imaging.RectangleF 结构顶部边缘的 Y 坐标。
setTop(float value)获取或设置此 com.aspose.imaging.RectangleF 结构顶部边缘的 Y 坐标。
getRight()获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Width 的和所对应的 X 坐标。
setRight(float value)获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Width 的和所对应的 X 坐标。
getBottom()获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Height 的和所对应的 Y 坐标。
setBottom(float value)获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Height 的和所对应的 Y 坐标。
isEmpty()获取一个值,指示此 com.aspose.imaging.RectangleFcom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 属性是否为零。
fromPoints(PointF point1, PointF point2)根据指定的两个点创建一个新的 Rectangle
inflate(RectangleF rect, float x, float y)创建并返回指定的 com.aspose.imaging.RectangleF 结构的膨胀副本。
intersect(RectangleF a, RectangleF b)返回一个表示两个矩形交集的 com.aspose.imaging.RectangleF 结构。
union(RectangleF a, RectangleF b)创建能够包含两个矩形(形成并集)的最小可能的第三个矩形。
op_Equality(RectangleF left, RectangleF right)测试两个 com.aspose.imaging.RectangleF 结构的位置信息和大小是否相等。
op_Inequality(RectangleF left, RectangleF right)测试两个 com.aspose.imaging.RectangleF 结构的位置信息或大小是否不同。
op_Multiply(RectangleF rectangle, float multiplier)实现运算符 \*。
op_Division(RectangleF rectangle, float divider)实现运算符 /。
to_RectangleF(Rectangle rect)将指定的 com.aspose.imaging.Rectangle 结构转换为 com.aspose.imaging.RectangleF 结构。
fromLeftTopRightBottom(float left, float top, float right, float bottom)使用指定位置的左上角和右下角创建一个 com.aspose.imaging.RectangleF 结构。
normalize()通过使宽度和高度为正、左侧小于右侧、顶部小于底部来规范化矩形。
contains(float x, float y)确定指定的点是否位于此 com.aspose.imaging.RectangleF 结构内部。
contains(PointF point)确定指定的点是否位于此 com.aspose.imaging.RectangleF 结构内部。
contains(RectangleF rect)确定由 rect 表示的矩形区域是否完全包含在此 com.aspose.imaging.RectangleF 结构中。
inflate(float x, float y)按指定量膨胀此 com.aspose.imaging.RectangleF 结构。
inflate(SizeF size)按指定量膨胀此 com.aspose.imaging.RectangleF
intersect(RectangleF rect)用自身与指定的 com.aspose.imaging.RectangleF 结构的交集替换此 com.aspose.imaging.RectangleF 结构。
intersectsWith(RectangleF rect)确定此矩形是否与 rect 相交。
offset(PointF pos)按指定量调整此矩形的位置。
offset(float x, float y)按指定量调整此矩形的位置。
equals(Object obj)测试 obj 是否为具有与此 com.aspose.imaging.RectangleF 相同位置和大小的 com.aspose.imaging.RectangleF
hashCode()获取此 com.aspose.imaging.RectangleF 结构的哈希码。
toString()将此 com.aspose.imaging.RectangleF 的属性转换为可读的字符串。
CloneTo(RectangleF that)
Clone()
isEquals(RectangleF obj1, RectangleF obj2)

RectangleF()

public RectangleF()

RectangleF(float x, float y, float width, float height)

public RectangleF(float x, float y, float width, float height)

使用指定的位置和大小初始化 com.aspose.imaging.RectangleF 结构的新实例。

Parameters:

参数类型描述
xfloat矩形左上角的 x 坐标。
yfloat矩形左上角的 y 坐标。
宽度float矩形的宽度。
高度float矩形的高度。

RectangleF(PointF location, SizeF size)

public RectangleF(PointF location, SizeF size)

使用指定的位置和大小初始化 com.aspose.imaging.RectangleF 结构的新实例。

Parameters:

参数类型描述
locationPointF一个表示矩形区域左上角的 com.aspose.imaging.PointF
sizeSizeF一个表示矩形区域宽度和高度的 com.aspose.imaging.SizeF

getEmpty()

public static RectangleF getEmpty()

获取一个新的 com.aspose.imaging.RectangleF 结构实例,其 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 的值均为零。

Returns: RectangleF

getLocation()

public PointF getLocation()

获取或设置此 com.aspose.imaging.RectangleF 结构左上角的坐标。

Returns: PointF - A com.aspose.imaging.PointF that represents the upper-left corner of this com.aspose.imaging.RectangleF structure.

setLocation(PointF value)

public void setLocation(PointF value)

获取或设置此 com.aspose.imaging.RectangleF 结构左上角的坐标。

Parameters:

参数类型描述
valuePointF

getSize()

public SizeF getSize()

获取或设置此 com.aspose.imaging.RectangleF 的大小。

Returns: SizeF - A com.aspose.imaging.SizeF that represents the width and height of this com.aspose.imaging.RectangleF structure.

setSize(SizeF value)

public void setSize(SizeF value)

获取或设置此 com.aspose.imaging.RectangleF 的大小。

Parameters:

参数类型描述
valueSizeF

getX()

public float getX()

获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 X 坐标。

Returns: float - 此 com.aspose.imaging.RectangleF 结构左上角的 x 坐标。

setX(float value)

public void setX(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 X 坐标。

Parameters:

参数类型描述
valuefloat

getY()

public float getY()

获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 Y 坐标。

Returns: float - 此 com.aspose.imaging.RectangleF 结构左上角的 y 坐标。

setY(float value)

public void setY(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构左上角的 Y 坐标。

Parameters:

参数类型描述
valuefloat

getWidth()

public float getWidth()

获取或设置此 com.aspose.imaging.RectangleF 结构的宽度。

Returns: float - 此 com.aspose.imaging.RectangleF 结构的宽度。

setWidth(float value)

public void setWidth(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构的宽度。

Parameters:

参数类型描述
valuefloat

getHeight()

public float getHeight()

获取或设置此 com.aspose.imaging.RectangleF 结构的高度。

Returns: float - 此 com.aspose.imaging.RectangleF 结构的高度。

setHeight(float value)

public void setHeight(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构的高度。

Parameters:

参数类型描述
valuefloat

getLeft()

public float getLeft()

获取或设置此 com.aspose.imaging.RectangleF 结构左边缘的 X 坐标。

Returns: float - 此 com.aspose.imaging.RectangleF 结构左边缘的 x 坐标。

setLeft(float value)

public void setLeft(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构左边缘的 X 坐标。

Parameters:

参数类型描述
valuefloat

getTop()

public float getTop()

获取或设置此 com.aspose.imaging.RectangleF 结构顶部边缘的 Y 坐标。

Returns: float - 此 com.aspose.imaging.RectangleF 结构上边缘的 y 坐标。

setTop(float value)

public void setTop(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构顶部边缘的 Y 坐标。

Parameters:

参数类型描述
valuefloat

getRight()

public float getRight()

获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Width 的和所对应的 X 坐标。

Returns: float - 此 com.aspose.imaging.RectangleF 结构的 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Width 的和对应的 x 坐标。

setRight(float value)

public void setRight(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Width 的和所对应的 X 坐标。

Parameters:

参数类型描述
valuefloat

getBottom()

public float getBottom()

获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Height 的和所对应的 Y 坐标。

Returns: float - 此 com.aspose.imaging.RectangleF 结构的 com.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Height 的和对应的 y 坐标。

setBottom(float value)

public void setBottom(float value)

获取或设置此 com.aspose.imaging.RectangleF 结构中 com.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Height 的和所对应的 Y 坐标。

Parameters:

参数类型描述
valuefloat

isEmpty()

public boolean isEmpty()

获取一个值,指示此 com.aspose.imaging.RectangleFcom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 属性是否为零。

Returns: boolean - 如果此 com.aspose.imaging.RectangleFcom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 属性的值为零,则此属性返回 true;否则返回 false。

fromPoints(PointF point1, PointF point2)

public static RectangleF fromPoints(PointF point1, PointF point2)

从指定的两个点创建一个新的 Rectangle。创建的 Rectangle 的两个顶点将等于传入的 point1point2。这些通常是相对的顶点。

Parameters:

参数类型描述
point1PointF新矩形的第一个 Point
point2PointF新矩形的第二个 Point

Returns: RectangleF - A newly created Rectangle.

inflate(RectangleF rect, float x, float y)

public static RectangleF inflate(RectangleF rect, float x, float y)

创建并返回指定 com.aspose.imaging.RectangleF 结构的膨胀副本。副本按指定的量进行膨胀。原始矩形保持不变。

Parameters:

参数类型描述
rectRectangleF要复制的 com.aspose.imaging.RectangleF。此矩形不会被修改。
xfloat水平膨胀矩形副本的量。
yfloat垂直膨胀矩形副本的量。

Returns: RectangleF - The inflated com.aspose.imaging.RectangleF.

intersect(RectangleF a, RectangleF b)

public static RectangleF intersect(RectangleF a, RectangleF b)

返回表示两个矩形交集的 com.aspose.imaging.RectangleF 结构。如果没有交集,则返回一个空的 com.aspose.imaging.RectangleF

Parameters:

参数类型描述
aRectangleF第一个用于交集的矩形。
bRectangleF第二个用于交集的矩形。

Returns: RectangleF - A third com.aspose.imaging.RectangleF structure the size of which represents the overlapped area of the two specified rectangles.

union(RectangleF a, RectangleF b)

public static RectangleF union(RectangleF a, RectangleF b)

创建能够包含两个矩形(形成并集)的最小可能的第三个矩形。

Parameters:

参数类型描述
aRectangleF第一个用于并集的矩形。
bRectangleF第二个用于并集的矩形。

Returns: RectangleF - A third com.aspose.imaging.RectangleF structure that contains both of the two rectangles that form the union.

op_Equality(RectangleF left, RectangleF right)

public static boolean op_Equality(RectangleF left, RectangleF right)

测试两个 com.aspose.imaging.RectangleF 结构的位置信息和大小是否相等。

Parameters:

参数类型描述
leftRectangleF等号运算符左侧的 com.aspose.imaging.RectangleF 结构。
rightRectangleF等号运算符右侧的 com.aspose.imaging.RectangleF 结构。

Returns: boolean - 如果两个指定的 com.aspose.imaging.RectangleF 结构的 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 属性相等,则此运算符返回 true。

op_Inequality(RectangleF left, RectangleF right)

public static boolean op_Inequality(RectangleF left, RectangleF right)

测试两个 com.aspose.imaging.RectangleF 结构的位置信息或大小是否不同。

Parameters:

参数类型描述
leftRectangleF不等号运算符左侧的 com.aspose.imaging.RectangleF 结构。
rightRectangleF不等号运算符右侧的 com.aspose.imaging.RectangleF 结构。

Returns: boolean - 如果两个 com.aspose.imaging.RectangleF 结构的 com.aspose.imaging.RectangleF.Xcom.aspose.imaging.RectangleF.Ycom.aspose.imaging.RectangleF.Widthcom.aspose.imaging.RectangleF.Height 属性中任意一个不相等,则此运算符返回 true;否则返回 false。

op_Multiply(RectangleF rectangle, float multiplier)

public static RectangleF op_Multiply(RectangleF rectangle, float multiplier)

实现运算符 \*。

Parameters:

参数类型描述
rectangleRectangleF矩形。
乘数float乘数。

Returns: RectangleF - The result of the operator.

op_Division(RectangleF rectangle, float divider)

public static RectangleF op_Division(RectangleF rectangle, float divider)

实现运算符 /。

Parameters:

参数类型描述
rectangleRectangleF矩形。
除数float除数。

Returns: RectangleF - The result of the operator.

to_RectangleF(Rectangle rect)

public static RectangleF to_RectangleF(Rectangle rect)

将指定的 com.aspose.imaging.Rectangle 结构转换为 com.aspose.imaging.RectangleF 结构。

Parameters:

参数类型描述
rectRectangle要转换的 com.aspose.imaging.Rectangle 结构。

Returns: RectangleF - The com.aspose.imaging.RectangleF structure that is converted from the specified com.aspose.imaging.Rectangle structure.

fromLeftTopRightBottom(float left, float top, float right, float bottom)

public static RectangleF fromLeftTopRightBottom(float left, float top, float right, float bottom)

使用指定位置的左上角和右下角创建一个 com.aspose.imaging.RectangleF 结构。

Parameters:

参数类型描述
float矩形区域左上角的 x 坐标。
float矩形区域左上角的 y 坐标。
float矩形区域右下角的 x 坐标。
float矩形区域右下角的 y 坐标。

Returns: RectangleF - The new com.aspose.imaging.RectangleF that this method creates.

normalize()

public void normalize()

通过使宽度和高度为正、左侧小于右侧、顶部小于底部来规范化矩形。

contains(float x, float y)

public boolean contains(float x, float y)

确定指定的点是否位于此 com.aspose.imaging.RectangleF 结构内部。

Parameters:

参数类型描述
xfloat要测试的点的 x 坐标。
yfloat要测试的点的 y 坐标。

Returns: boolean - 此方法返回 true,如果由 xy 定义的点位于此 com.aspose.imaging.RectangleF 结构内;否则返回 false。

contains(PointF point)

public boolean contains(PointF point)

确定指定的点是否位于此 com.aspose.imaging.RectangleF 结构内部。

Parameters:

参数类型描述
pointPointF要测试的 com.aspose.imaging.PointF

Returns: boolean - 此方法返回 true,如果 point 参数表示的点位于此 com.aspose.imaging.RectangleF 结构内;否则返回 false。

contains(RectangleF rect)

public boolean contains(RectangleF rect)

确定由 rect 表示的矩形区域是否完全包含在此 com.aspose.imaging.RectangleF 结构中。

Parameters:

参数类型描述
rectRectangleF要测试的 com.aspose.imaging.RectangleF

Returns: boolean - 此方法返回 true,如果 rect 表示的矩形区域完全位于此 com.aspose.imaging.RectangleF 表示的矩形区域内;否则返回 false。

inflate(float x, float y)

public void inflate(float x, float y)

按指定量膨胀此 com.aspose.imaging.RectangleF 结构。

Parameters:

参数类型描述
xfloat水平膨胀此 com.aspose.imaging.RectangleF 结构的量。
yfloat垂直膨胀此 com.aspose.imaging.RectangleF 结构的量。

inflate(SizeF size)

public void inflate(SizeF size)

按指定量膨胀此 com.aspose.imaging.RectangleF

Parameters:

参数类型描述
sizeSizeF膨胀此矩形的量。

intersect(RectangleF rect)

public void intersect(RectangleF rect)

用自身与指定的 com.aspose.imaging.RectangleF 结构的交集替换此 com.aspose.imaging.RectangleF 结构。

Parameters:

参数类型描述
rectRectangleF要相交的矩形。

intersectsWith(RectangleF rect)

public boolean intersectsWith(RectangleF rect)

确定此矩形是否与 rect 相交。

Parameters:

参数类型描述
rectRectangleF要测试的矩形。

Returns: boolean - 此方法返回 true,如果存在任何交集。

offset(PointF pos)

public void offset(PointF pos)

按指定量调整此矩形的位置。

Parameters:

参数类型描述
posPointF位移位置的量。

offset(float x, float y)

public void offset(float x, float y)

按指定量调整此矩形的位置。

Parameters:

参数类型描述
xfloat水平偏移位置的量。
yfloat垂直偏移位置的量。

equals(Object obj)

public boolean equals(Object obj)

测试 obj 是否为具有与此 com.aspose.imaging.RectangleF 相同位置和大小的 com.aspose.imaging.RectangleF

Parameters:

参数类型描述
objjava.lang.Object用于测试的 System.Object

Returns: boolean - 如果 objcom.aspose.imaging.RectangleF,并且其 X、Y、Width 和 Height 属性等于此 com.aspose.imaging.RectangleF 的相应属性,则此方法返回 true;否则返回 false。

hashCode()

public int hashCode()

获取此 com.aspose.imaging.RectangleF 结构的哈希码。

Returns: int - 此 com.aspose.imaging.RectangleF 的哈希码。

toString()

public String toString()

将此 com.aspose.imaging.RectangleF 的属性转换为可读的字符串。

Returns: java.lang.String - 包含此 com.aspose.imaging.RectangleF 结构的位置、宽度和高度的字符串。

CloneTo(RectangleF that)

public void CloneTo(RectangleF that)

Parameters:

参数类型描述
thatRectangleF

Clone()

public RectangleF Clone()

Returns: RectangleF

isEquals(RectangleF obj1, RectangleF obj2)

public static boolean isEquals(RectangleF obj1, RectangleF obj2)

Parameters:

参数类型描述
obj1RectangleF
obj2RectangleF

Returns: boolean