Rectangle
概述
Rectangle 是 Aspose.Psd FOSS 中用于 Python 的类。
存储一组四个整数,表示矩形的位置和大小。
此类在 Python 程序中为 Rectangle 对象声明了 18 个方法。可用的方法包括:__init__、ceiling、contains、empty、from_left_top_right_bottom、from_ltrb、from_point_and_size、from_points、inflate、inflate_rect、intersect、intersect_rect,以及另外 6 个方法。公共成员在安装了 Aspose.Psd FOSS for Python 包后,可供任何 Python 应用程序访问。属性包括:bottom、height、is_empty、left、location、right,以及另外 5 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
bottom | `` | 读写 | 获取或设置此矩形底边的 y 坐标。 |
is_empty | `` | 读取 | 获取一个值,指示此矩形是否没有位置或大小。 |
left | `` | 读写 | 获取或设置此矩形左边的 x 坐标。 |
right | `` | 读写 | 获取或设置此矩形右边的 x 坐标。 |
top | `` | 读写 | 获取或设置此矩形顶部边缘的 y 坐标。 |
location | `` | 读写 | 获取或设置此矩形左上角的坐标。 |
size | `` | 读写 | 获取或设置此 Rectangle 的大小。 |
x | `` | 读取 | 获取 x。 |
y | `` | 读取 | 获取 y。 |
width | `` | 读取 | 获取宽度。 |
height | `` | 读取 | 获取高度。 |
方法
| 签名 | 描述 |
|---|---|
__init__(x, y, width, height) | Calls init(x, y, width, height) 在此 Rectangle 实例上。 |
empty() | 表示一个 Rectangle 结构,其属性保持未初始化状态。 |
from_left_top_right_bottom(left, top, right, bottom) | 根据边缘坐标创建一个矩形。 |
from_ltrb(left, top, right, bottom) | 从边缘坐标创建矩形,用于内部 PSD 记录解析。 |
from_points(point1, point2) | 创建一个跨越指定点的矩形。 |
from_point_and_size(location: Point, size: Size) | 从 Point 和 Size 初始化一个新实例。 |
ceiling(value) | 通过向上取整坐标和大小,将 RectangleF 结构转换为 Rectangle 结构。 |
round(value) | 通过对坐标和尺寸进行四舍五入,将 RectangleF 结构转换为 Rectangle 结构。 |
truncate(value) | 通过截断坐标和尺寸,将 RectangleF 结构转换为 Rectangle 结构。 |
inflate_rect(rectangle, x, y) | 创建并返回指定矩形的膨胀副本。 |
intersect_rect(a, b) | 返回一个表示两个矩形交集的矩形。 |
union_rect(a, b) | 返回一个包含两个矩形并集的矩形。 |
contains() | 确定指定的点或矩形是否包含在此 Rectangle 中。 |
inflate() | 按指定的大小或维度膨胀此 rectangle。 |
intersect(rectangle) | 用其与指定 rectangle 的交集替换此 rectangle。 |
intersects_with(rectangle) | 确定此矩形是否与指定的矩形相交。 |
normalize() | 将此矩形标准化,使宽度和高度为非负。 |
offset() | 按指定的点或偏移量移动此矩形。 |