RectangleF 类
Summary: Stores a set of four floating-point numbers that represent the location and size of a rectangle.
Module: aspose.imaging
Full Name: aspose.imaging.RectangleF
Constructors
| Name | 描述 |
|---|---|
| RectangleF() | 初始化 RectangleF 类的新实例 |
| RectangleF(location, size) | 使用指定的位置和大小初始化 RectangleF 结构的新实例。 |
| RectangleF(x, y, width, height) | 使用指定的位置和大小初始化 RectangleF 结构的新实例。 |
Properties
| Name | Type | Access | 描述 |
|---|---|---|---|
| bottom | float | r/w | 获取或设置此 RectangleF 结构的 y 坐标,该坐标为 RectangleF.y 与 RectangleF.height 的和。 |
| empty [static] | RectangleF | r | 获取一个新的 RectangleF 结构实例,其 RectangleF.x、RectangleF.y、RectangleF.width 和 RectangleF.height 的值均为零。 |
| height | float | r/w | 获取或设置此 RectangleF 结构的高度。 |
| is_empty | bool | r | 获取一个值,指示此 RectangleF 的 RectangleF.width 或 RectangleF.height 属性是否为零。 |
| left | float | r/w | 获取或设置此 RectangleF 结构左边缘的 x 坐标。 |
| location | PointF | r/w | 获取或设置此 RectangleF 结构左上角的坐标。 |
| right | float | r/w | 获取或设置此 RectangleF 结构的 x 坐标,该坐标为 RectangleF.x 与 RectangleF.width 的和。 |
| size | SizeF | r/w | 获取或设置此 RectangleF 的大小。 |
| top | float | r/w | 获取或设置此 RectangleF 结构顶部边缘的 y 坐标。 |
| width | float | r/w | 获取或设置此 RectangleF 结构的宽度。 |
| x | float | r/w | 获取或设置此 RectangleF 结构左上角的 x 坐标。 |
| y | float | r/w | 获取或设置此 RectangleF 结构左上角的 y 坐标。 |
Methods
Constructor: RectangleF()
RectangleF()
初始化 RectangleF 类的新实例
Constructor: RectangleF(location, size)
RectangleF(location, size)
使用指定的位置和大小初始化 RectangleF 结构的新实例。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| location | PointF | 一个表示矩形区域左上角的 PointF。 |
| size | SizeF | 一个表示矩形区域宽度和高度的 SizeF。 |
Constructor: RectangleF(x, y, width, height)
RectangleF(x, y, width, height)
使用指定的位置和大小初始化 RectangleF 结构的新实例。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| x | float | 矩形左上角的 x 坐标。 |
| y | float | 矩形左上角的 y 坐标。 |
| width | float | 矩形的宽度。 |
| height | float | 矩形的高度。 |
Method: contains(point)
contains(point)
确定指定的点是否包含在此 RectangleF 结构中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| point | PointF | 要测试的 PointF。 |
Returns
| Type | Description |
|---|---|
| bool | 如果 point 参数表示的点包含在此 RectangleF 结构中,则此方法返回 true;否则返回 false。 |
Method: contains(rect)
contains(rect)
确定由 rect 表示的矩形区域是否完全包含在此 RectangleF 结构中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rect | RectangleF | 要测试的 RectangleF。 |
Returns
| Type | Description |
|---|---|
| bool | 如果由 rect 表示的矩形区域完全包含在由此 RectangleF 表示的矩形区域中,则此方法返回 true;否则返回 false。 |
Method: contains(x, y)
contains(x, y)
确定指定的点是否包含在此 RectangleF 结构中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| x | float | 要测试的点的 x 坐标。 |
| y | float | 要测试的点的 y 坐标。 |
Returns
| Type | Description |
|---|---|
| bool | 如果由 x 和 y 定义的点包含在此 RectangleF 结构中,则此方法返回 true;否则返回 false。 |
Method: contains_point_f(point)
contains_point_f(point)
确定指定的点是否包含在此 RectangleF 结构中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| point | PointF | 要测试的 PointF。 |
Returns
| Type | Description |
|---|---|
| bool | 如果 point 参数表示的点包含在此 RectangleF 结构中,则此方法返回 true;否则返回 false。 |
Method: contains_rect_f(rect)
contains_rect_f(rect)
确定由 rect 表示的矩形区域是否完全包含在此 RectangleF 结构中。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rect | RectangleF | 要测试的 RectangleF。 |
Returns
| Type | Description |
|---|---|
| bool | 如果由 rect 表示的矩形区域完全包含在由此 RectangleF 表示的矩形区域中,则此方法返回 true;否则返回 false。 |
Method: from_left_top_right_bottom(left, top, right, bottom) [static]
from_left_top_right_bottom(left, top, right, bottom)
创建一个 RectangleF 结构,其左上角和右下角位于指定位置。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| 左 | float | 矩形区域左上角的 x 坐标。 |
| 上 | float | 矩形区域左上角的 y 坐标。 |
| 右 | float | 矩形区域右下角的 x 坐标。 |
| 下 | float | 矩形区域右下角的 y 坐标。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 此方法创建的新的 RectangleF。 |
Method: from_points(point1, point2) [static]
from_points(point1, point2)
从指定的两个点创建一个新的 Rectangle 。创建的 Rectangle 的两个顶点将等于传入的 point1 和 point2。这些通常是相对的顶点。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| point1 | PointF | 新矩形的第一个 Point。 |
| point2 | PointF | 新矩形的第二个 Point。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 新创建的 Rectangle。 |
Method: inflate(rect, x, y) [static]
inflate(rect, x, y)
创建并返回指定的 RectangleF 结构的膨胀副本。该副本按指定量进行膨胀。原始矩形保持不变。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rect | RectangleF | 要复制的 RectangleF。此矩形不会被修改。 |
| x | float | 水平膨胀矩形副本的量。 |
| y | float | 垂直膨胀矩形副本的量。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 膨胀后的 RectangleF。 |
Method: inflate(size)
inflate(size)
按指定量膨胀此 RectangleF。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| size | SizeF | 膨胀此矩形的量。 |
Method: inflate(x, y)
inflate(x, y)
按指定量膨胀此 RectangleF 结构。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| x | float | 水平膨胀此 RectangleF 结构的量。 |
| y | float | 垂直膨胀此 RectangleF 结构的量。 |
Method: inflate_rect(rect, x, y) [static]
inflate_rect(rect, x, y)
创建并返回指定的 RectangleF 结构的膨胀副本。该副本按指定量进行膨胀。原始矩形保持不变。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rect | RectangleF | 要复制的 RectangleF。此矩形不会被修改。 |
| x | float | 水平膨胀矩形副本的量。 |
| y | float | 垂直膨胀矩形副本的量。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 膨胀后的 RectangleF。 |
Method: intersect(a, b) [static]
intersect(a, b)
返回一个表示两个矩形交集的 RectangleF 结构。如果没有交集,则返回一个空的 RectangleF。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| a | RectangleF | 第一个要相交的矩形。 |
| b | RectangleF | 第二个要相交的矩形。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 第三个 RectangleF 结构,其大小表示两个指定矩形的重叠区域。 |
Method: intersect(rect)
intersect(rect)
用自身与指定的 RectangleF 结构的交集替换此 RectangleF 结构。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rect | RectangleF | 要相交的矩形。 |
Method: intersect_rects(a, b) [static]
intersect_rects(a, b)
返回一个表示两个矩形交集的 RectangleF 结构。如果没有交集,则返回一个空的 RectangleF。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| a | RectangleF | 第一个要相交的矩形。 |
| b | RectangleF | 第二个要相交的矩形。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 第三个 RectangleF 结构,其大小表示两个指定矩形的重叠区域。 |
Method: intersects_with(rect)
intersects_with(rect)
确定此矩形是否与 rect 相交。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| rect | RectangleF | 要测试的矩形。 |
Returns
| Type | Description |
|---|---|
| bool | 如果存在任何交集,此方法返回 true。 |
Method: offset(pos)
offset(pos)
按指定量调整此矩形的位置。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| pos | PointF | 位置的偏移量。 |
Method: offset(x, y)
offset(x, y)
按指定量调整此矩形的位置。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| x | float | 水平偏移位置的量。 |
| y | float | 垂直偏移位置的量。 |
Method: union(a, b) [static]
union(a, b)
创建能够包含两个矩形(形成并集)的最小可能的第三个矩形。
Parameters:
| 参数 | Type | Description |
|---|---|---|
| a | RectangleF | 第一个用于合并的矩形。 |
| b | RectangleF | 第二个用于合并的矩形。 |
Returns
| Type | Description |
|---|---|
| RectangleF | 第三个 RectangleF 结构,包含形成合并的两个矩形。 |