Rectangle

Overview

Rectangle is a class in Aspose.PSD FOSS for Python.

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

This class declares 24 methods for Rectangle objects in Python programs. Available methods include: __copy__, __eq__, __hash__, __init__, __ne__, __repr__, __str__, ceiling, contains, empty, from_left_top_right_bottom, from_ltrb, and 12 additional methods. Public members are accessible to any Python application after installing the Aspose.PSD FOSS for Python package. Properties: bottom, height, is_empty, left, location, right, and 5 more.

Properties

NameTypeAccessDescription
bottom-Read/WriteGets or sets the y-coordinate of the bottom edge of this Rectangle.
is_empty-ReadGets a value indicating whether this Rectangle has no location or size.
left-Read/WriteGets or sets the x-coordinate of the left edge of this Rectangle.
right-Read/WriteGets or sets the x-coordinate of the right edge of this Rectangle.
top-Read/WriteGets or sets the y-coordinate of the top edge of this Rectangle.
location-Read/WriteGets or sets the coordinates of the upper-left corner of this Rectangle.
size-Read/WriteGets or sets the size of this Rectangle.
x-ReadGets the x.
y-ReadGets the y.
width-ReadGets the width.
height-ReadGets the height.

Methods

SignatureDescription
__init__(x, y, width, height)Calls init(x, y, width, height) on this Rectangle instance.
empty()Represents a Rectangle structure with its properties left uninitialized.
from_left_top_right_bottom(left, top, right, bottom)Creates a rectangle from edge coordinates.
from_ltrb(left, top, right, bottom)Creates a rectangle from edge coordinates for internal PSD record parsing.
from_points(point1, point2)Creates a rectangle that spans the specified points.
from_point_and_size(location: Point, size: Size)Initializes a new instance from a Point and a Size.
ceiling(value)Converts a RectangleF structure to a Rectangle structure by rounding up the coordinates and size.
round(value)Converts a RectangleF structure to a Rectangle structure by rounding the coordinates and size.
truncate(value)Converts a RectangleF structure to a Rectangle structure by truncating the coordinates and size.
inflate_rect(rectangle, x, y)Creates and returns an inflated copy of the specified rectangle.
intersect_rect(a, b)Returns a rectangle that represents the intersection of two rectangles.
union_rect(a, b)Returns a rectangle that contains the union of two rectangles.
contains()Determines whether the specified point or rectangle is contained within this Rectangle.
__eq__(other)Calls eq(other) on this Rectangle instance.
__ne__(other)Calls ne(other) on this Rectangle instance.
__hash__()Calls hash on this Rectangle instance.
__str__()Calls str on this Rectangle instance.
__repr__()Calls repr on this Rectangle instance.
__copy__()Calls copy on this Rectangle instance.
inflate()Inflates this rectangle by the specified size or dimensions.
intersect(rectangle)Replaces this rectangle with its intersection with the specified rectangle.
intersects_with(rectangle)Determines whether this rectangle intersects with the specified rectangle.
normalize()Normalizes this rectangle so that width and height are non-negative.
offset()Moves this rectangle by the specified point or offsets.

See Also

 English