Rectangle 类

Summary: Stores a set of four integers that represent the location and size of a rectangle.

Module: aspose.imaging

Full Name: aspose.imaging.Rectangle

Constructors

Name描述
Rectangle()初始化 Rectangle 类的新实例
Rectangle(location, size)使用指定的位置和大小初始化 Rectangle 结构的新实例。
Rectangle(x, y, width, height)使用指定的位置和大小初始化 Rectangle 结构的新实例。

Properties

NameTypeAccess描述
bottomintr/w获取或设置此 Rectangle 结构的 y 坐标,该坐标为 Rectangle.yRectangle.height 属性值之和。
empty [static]Rectangler获取一个新的 Rectangle 结构实例,其 Rectangle.xRectangle.yRectangle.widthRectangle.height 的值均为零。
heightintr/w获取或设置此 Rectangle 结构的高度。
is_emptyboolr获取一个值,指示此 Rectangle 的所有数值属性是否全部为零。
leftintr/w获取或设置此 Rectangle 结构左边缘的 x 坐标。
locationPointr/w获取或设置此 Rectangle 结构左上角的坐标。
rightintr/w获取或设置此 Rectangle 结构的 x 坐标,该坐标为 Rectangle.xRectangle.width 属性值之和。
sizeSizer/w获取或设置此 Rectangle 的大小。
topintr/w获取或设置此 Rectangle 结构顶部边缘的 y 坐标。
widthintr/w获取或设置此 Rectangle 结构的宽度。
xintr/w获取或设置此 Rectangle 结构左上角的 x 坐标。
yintr/w获取或设置此 Rectangle 结构左上角的 y 坐标。

Methods

Name描述
ceiling(value)将指定的 RectangleF 结构转换为 Rectangle 结构,方法是将 RectangleF 的值向上取整为下一个整数。
contains(point)确定指定的点是否位于此 Rectangle 结构内部。
contains(rect)确定由 rect 表示的矩形区域是否完全包含在此 Rectangle 结构中。
contains(x, y)确定指定的点是否位于此 Rectangle 结构内部。
contains_point(point)确定指定的点是否位于此 Rectangle 结构内部。
contains_rect(rect)确定由 rect 表示的矩形区域是否完全包含在此 Rectangle 结构中。
from_left_top_right_bottom(left, top, right, bottom)使用指定的边缘位置创建一个 Rectangle 结构。
from_points(point1, point2)根据指定的两个点创建一个新的 Rectangle。创建的 Rectangle 的两个顶点将等于传入的 point1point2,通常它们是相对的顶点。
inflate(rect, x, y)创建并返回指定的 Rectangle 结构的膨胀副本。该副本按指定的量进行膨胀,原始的 Rectangle 结构保持不变。
inflate(size)按指定的量膨胀此 Rectangle
inflate(width, height)按指定的量膨胀此 Rectangle
inflate_rect(rect, x, y)创建并返回指定的 Rectangle 结构的膨胀副本。该副本按指定的量进行膨胀,原始的 Rectangle 结构保持不变。
intersect(a, b)返回一个第三个 Rectangle 结构,表示另外两个 Rectangle 结构的交集。如果没有交集,则返回一个空的 Rectangle
intersect(rect)用自身与指定的 Rectangle 的交集替换此 Rectangle
intersect_rects(a, b)返回一个第三个 Rectangle 结构,表示另外两个 Rectangle 结构的交集。如果没有交集,则返回一个空的 Rectangle
intersects_with(rect)确定此矩形是否与 rect 相交。
normalize()通过使宽度和高度为正、左侧小于右侧、顶部小于底部来规范化矩形。
offset(pos)按指定量调整此矩形的位置。
offset(x, y)按指定量调整此矩形的位置。
round(value)将指定的 RectangleF 转换为 Rectangle,方法是将 RectangleF 的值四舍五入到最近的整数。
truncate(value)将指定的 RectangleF 转换为 Rectangle,方法是截断 RectangleF 的值。
union(a, b)获取一个包含两个 Rectangle 结构并集的 Rectangle 结构。

Constructor: Rectangle()

 Rectangle() 

初始化 Rectangle 类的新实例

Constructor: Rectangle(location, size)

 Rectangle(location, size) 

使用指定的位置和大小初始化 Rectangle 结构的新实例。

Parameters:

参数TypeDescription
locationPoint表示矩形区域左上角的 Point
sizeSize表示矩形区域宽度和高度的 Size

Constructor: Rectangle(x, y, width, height)

 Rectangle(x, y, width, height) 

使用指定的位置和大小初始化 Rectangle 结构的新实例。

Parameters:

参数TypeDescription
xint矩形左上角的 x 坐标。
yint矩形左上角的 y 坐标。
widthint矩形的宽度。
heightint矩形的高度。

Method: ceiling(value) [static]

 ceiling(value) 

将指定的 RectangleF 结构转换为 Rectangle 结构,方法是将 RectangleF 的值向上取整为下一个整数。

Parameters:

参数TypeDescription
valueRectangleF待转换的 RectangleF 结构。

Returns

TypeDescription
Rectangle返回一个 Rectangle

Method: contains(point)

 contains(point) 

确定指定的点是否位于此 Rectangle 结构内部。

Parameters:

参数TypeDescription
pointPoint待测试的 Point

Returns

TypeDescription
bool如果由 point 表示的点位于此 Rectangle 结构内部,则此方法返回 true;否则返回 false。

Method: contains(rect)

 contains(rect) 

确定由 rect 表示的矩形区域是否完全包含在此 Rectangle 结构中。

Parameters:

参数TypeDescription
rectRectangle要测试的 Rectangle

Returns

TypeDescription
bool如果由 rect 表示的矩形区域完全位于此 Rectangle 结构内部,则此方法返回 true;否则返回 false。

Method: contains(x, y)

 contains(x, y) 

确定指定的点是否位于此 Rectangle 结构内部。

Parameters:

参数TypeDescription
xint要测试的点的 x 坐标。
yint要测试的点的 y 坐标。

Returns

TypeDescription
bool如果由 xy 定义的点位于此 Rectangle 结构内部,则此方法返回 true;否则返回 false。

Method: contains_point(point)

 contains_point(point) 

确定指定的点是否位于此 Rectangle 结构内部。

Parameters:

参数TypeDescription
pointPoint待测试的 Point

Returns

TypeDescription
bool如果由 point 表示的点位于此 Rectangle 结构内部,则此方法返回 true;否则返回 false。

Method: contains_rect(rect)

 contains_rect(rect) 

确定由 rect 表示的矩形区域是否完全包含在此 Rectangle 结构中。

Parameters:

参数TypeDescription
rectRectangle要测试的 Rectangle

Returns

TypeDescription
bool如果由 rect 表示的矩形区域完全位于此 Rectangle 结构内部,则此方法返回 true;否则返回 false。

Method: from_left_top_right_bottom(left, top, right, bottom) [static]

 from_left_top_right_bottom(left, top, right, bottom) 

使用指定的边缘位置创建一个 Rectangle 结构。

Parameters:

参数TypeDescription
leftintRectangle 结构左上角的 x 坐标。
topintRectangle 结构左上角的 y 坐标。
rightintRectangle 结构右下角的 x 坐标。
bottomintRectangle 结构右下角的 y 坐标。

Returns

TypeDescription
Rectangle此方法创建的新 Rectangle

Method: from_points(point1, point2) [static]

 from_points(point1, point2) 

根据指定的两个点创建一个新的 Rectangle。创建的 Rectangle 的两个顶点将等于传入的 point1point2,通常它们是相对的顶点。

Parameters:

参数TypeDescription
point1Point新矩形的第一个 Point
point2Point新矩形的第二个 Point

Returns

TypeDescription
Rectangle新创建的 Rectangle

Method: inflate(rect, x, y) [static]

 inflate(rect, x, y) 

创建并返回指定的 Rectangle 结构的膨胀副本。该副本按指定的量进行膨胀,原始的 Rectangle 结构保持不变。

Parameters:

参数TypeDescription
rectRectangle用于开始的 Rectangle。此矩形不会被修改。
xint水平膨胀此 Rectangle 的量。
yint垂直膨胀此 Rectangle 的量。

Returns

TypeDescription
Rectangle膨胀后的 Rectangle

Method: inflate(size)

 inflate(size) 

按指定的量膨胀此 Rectangle

Parameters:

参数TypeDescription
sizeSize膨胀此矩形的量。

Method: inflate(width, height)

 inflate(width, height) 

按指定的量膨胀此 Rectangle

Parameters:

参数TypeDescription
widthint水平膨胀此 Rectangle 的量。
heightint垂直膨胀此 Rectangle 的量。

Method: inflate_rect(rect, x, y) [static]

 inflate_rect(rect, x, y) 

创建并返回指定的 Rectangle 结构的膨胀副本。该副本按指定的量进行膨胀,原始的 Rectangle 结构保持不变。

Parameters:

参数TypeDescription
rectRectangle用于开始的 Rectangle。此矩形不会被修改。
xint水平膨胀此 Rectangle 的量。
yint垂直膨胀此 Rectangle 的量。

Returns

TypeDescription
Rectangle膨胀后的 Rectangle

Method: intersect(a, b) [static]

 intersect(a, b) 

返回一个第三个 Rectangle 结构,表示另外两个 Rectangle 结构的交集。如果没有交集,则返回一个空的 Rectangle

Parameters:

参数TypeDescription
aRectangle第一个要相交的矩形。
bRectangle第二个要相交的矩形。

Returns

TypeDescription
Rectangle表示 ab 交集的 Rectangle

Method: intersect(rect)

 intersect(rect) 

用自身与指定的 Rectangle 的交集替换此 Rectangle

Parameters:

参数TypeDescription
rectRectangle用于求交的 Rectangle

Method: intersect_rects(a, b) [static]

 intersect_rects(a, b) 

返回一个第三个 Rectangle 结构,表示另外两个 Rectangle 结构的交集。如果没有交集,则返回一个空的 Rectangle

Parameters:

参数TypeDescription
aRectangle第一个要相交的矩形。
bRectangle第二个要相交的矩形。

Returns

TypeDescription
Rectangle表示 ab 交集的 Rectangle

Method: intersects_with(rect)

 intersects_with(rect) 

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

Parameters:

参数TypeDescription
rectRectangle要测试的矩形。

Returns

TypeDescription
bool如果存在任何交集,则此方法返回 true;否则返回 false。

Method: offset(pos)

 offset(pos) 

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

Parameters:

参数TypeDescription
posPoint位置的偏移量。

Method: offset(x, y)

 offset(x, y) 

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

Parameters:

参数TypeDescription
xint水平偏移量。
yint垂直偏移量。

Method: round(value) [static]

 round(value) 

将指定的 RectangleF 转换为 Rectangle,方法是将 RectangleF 的值四舍五入到最近的整数。

Parameters:

参数TypeDescription
valueRectangleF要转换的 RectangleF

Returns

TypeDescription
Rectangle一个新的 Rectangle

Method: truncate(value) [static]

 truncate(value) 

将指定的 RectangleF 转换为 Rectangle,方法是截断 RectangleF 的值。

Parameters:

参数TypeDescription
valueRectangleF要转换的 RectangleF

Returns

TypeDescription
Rectangle一个新的 Rectangle

Method: union(a, b) [static]

 union(a, b) 

获取一个包含两个 Rectangle 结构并集的 Rectangle 结构。

Parameters:

参数TypeDescription
aRectangle第一个用于合并的矩形。
bRectangle第二个用于合并的矩形。

Returns

TypeDescription
Rectangle一个 Rectangle 结构,界定两个 Rectangle 结构的并集。