Rectangle Class
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 | Description |
|---|---|
| Rectangle() | Initializes a new instance of the Rectangle class |
| Rectangle(location, size) | Initializes a new instance of the Rectangle structure with the specified location and size. |
| Rectangle(x, y, width, height) | Initializes a new instance of the Rectangle structure with the specified location and size. |
Properties
| Name | Type | Access | Description |
|---|---|---|---|
| bottom | int | r/w | Gets or sets the y-coordinate that is the sum of the Rectangle.y and Rectangle.height property values of this Rectangle structure. |
| empty [static] | Rectangle | r | Gets a new instance of the Rectangle structure that has Rectangle.x, Rectangle.y, Rectangle.width and Rectangle.height values set to zero. |
| height | int | r/w | Gets or sets the height of this Rectangle structure. |
| is_empty | bool | r | Gets a value indicating whether all numeric properties of this Rectangle have values of zero. |
| left | int | r/w | Gets or sets the x-coordinate of the left edge of this Rectangle structure. |
| location | Point | r/w | Gets or sets the coordinates of the upper-left corner of this Rectangle structure. |
| right | int | r/w | Gets or sets the x-coordinate that is the sum of Rectangle.x and Rectangle.width property values of this Rectangle structure. |
| size | Size | r/w | Gets or sets the size of this Rectangle. |
| top | int | r/w | Gets or sets the y-coordinate of the top edge of this Rectangle structure. |
| width | int | r/w | Gets or sets the width of this Rectangle structure. |
| x | int | r/w | Gets or sets the x-coordinate of the upper-left corner of this Rectangle structure. |
| y | int | r/w | Gets or sets the y-coordinate of the upper-left corner of this Rectangle structure. |
Methods
| Name | Description |
|---|---|
| ceiling(value) | Converts the specified RectangleF structure to a Rectangle structure by rounding the RectangleF values to the next higher integer values. |
| contains(point) | Determines if the specified point is contained within this Rectangle structure. |
| contains(rect) | Determines if the rectangular region represented by rect is entirely contained within this Rectangle structure. |
| contains(x, y) | Determines if the specified point is contained within this Rectangle structure. |
| contains_point(point) | Determines if the specified point is contained within this Rectangle structure. |
| contains_rect(rect) | Determines if the rectangular region represented by rect is entirely contained within this Rectangle structure. |
| from_left_top_right_bottom(left, top, right, bottom) | Creates a Rectangle structure with the specified edge locations. |
| from_points(point1, point2) | Creates a new Rectangle from two points specified. Two verticales of the created Rectangle will be equal to the passed point1 and point2. These would be typically the opposite vertices. |
| inflate(rect, x, y) | Creates and returns an inflated copy of the specified Rectangle structure. The copy is inflated by the specified amount. The original Rectangle structure remains unmodified. |
| inflate(size) | Inflates this Rectangle by the specified amount. |
| inflate(width, height) | Inflates this Rectangle by the specified amount. |
| inflate_rect(rect, x, y) | Creates and returns an inflated copy of the specified Rectangle structure. The copy is inflated by the specified amount. The original Rectangle structure remains unmodified. |
| intersect(a, b) | Returns a third Rectangle structure that represents the intersection of two other Rectangle structures. If there is no intersection, an empty Rectangle is returned. |
| intersect(rect) | Replaces this Rectangle with the intersection of itself and the specified Rectangle. |
| intersect_rects(a, b) | Returns a third Rectangle structure that represents the intersection of two other Rectangle structures. If there is no intersection, an empty Rectangle is returned. |
| intersects_with(rect) | Determines if this rectangle intersects with rect. |
| normalize() | Normalizes the rectangle by making it’s width and height positive, left less than right and top less than bottom. |
| offset(pos) | Adjusts the location of this rectangle by the specified amount. |
| offset(x, y) | Adjusts the location of this rectangle by the specified amount. |
| round(value) | Converts the specified RectangleF to a Rectangle by rounding the RectangleF values to the nearest integer values. |
| truncate(value) | Converts the specified RectangleF to a Rectangle by truncating the RectangleF values. |
| union(a, b) | Gets a Rectangle structure that contains the union of two Rectangle structures. |
Constructor: Rectangle()
Rectangle()
Initializes a new instance of the Rectangle class
Constructor: Rectangle(location, size)
Rectangle(location, size)
Initializes a new instance of the Rectangle structure with the specified location and size.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| location | Point | A Point that represents the upper-left corner of the rectangular region. |
| size | Size | A Size that represents the width and height of the rectangular region. |
Constructor: Rectangle(x, y, width, height)
Rectangle(x, y, width, height)
Initializes a new instance of the Rectangle structure with the specified location and size.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | int | The x-coordinate of the upper-left corner of the rectangle. |
| y | int | The y-coordinate of the upper-left corner of the rectangle. |
| width | int | The width of the rectangle. |
| height | int | The height of the rectangle. |
Method: ceiling(value) [static]
ceiling(value)
Converts the specified RectangleF structure to a Rectangle structure by rounding the RectangleF values to the next higher integer values.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | RectangleF | The RectangleF structure to be converted. |
Returns
| Type | Description |
|---|---|
| Rectangle | Returns a Rectangle. |
Method: contains(point)
contains(point)
Determines if the specified point is contained within this Rectangle structure.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| point | Point | The Point to test. |
Returns
| Type | Description |
|---|---|
| bool | This method returns true if the point represented by point is contained within this Rectangle structure; otherwise false. |
Method: contains(rect)
contains(rect)
Determines if the rectangular region represented by rect is entirely contained within this Rectangle structure.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The Rectangle to test. |
Returns
| Type | Description |
|---|---|
| bool | This method returns true if the rectangular region represented by rect is entirely contained within this Rectangle structure; otherwise false. |
Method: contains(x, y)
contains(x, y)
Determines if the specified point is contained within this Rectangle structure.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | int | The x-coordinate of the point to test. |
| y | int | The y-coordinate of the point to test. |
Returns
| Type | Description |
|---|---|
| bool | This method returns true if the point defined by x and y is contained within this Rectangle structure; otherwise false. |
Method: contains_point(point)
contains_point(point)
Determines if the specified point is contained within this Rectangle structure.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| point | Point | The Point to test. |
Returns
| Type | Description |
|---|---|
| bool | This method returns true if the point represented by point is contained within this Rectangle structure; otherwise false. |
Method: contains_rect(rect)
contains_rect(rect)
Determines if the rectangular region represented by rect is entirely contained within this Rectangle structure.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The Rectangle to test. |
Returns
| Type | Description |
|---|---|
| bool | This method returns true if the rectangular region represented by rect is entirely contained within this Rectangle structure; otherwise false. |
Method: from_left_top_right_bottom(left, top, right, bottom) [static]
from_left_top_right_bottom(left, top, right, bottom)
Creates a Rectangle structure with the specified edge locations.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| left | int | The x-coordinate of the upper-left corner of this Rectangle structure. |
| top | int | The y-coordinate of the upper-left corner of this Rectangle structure. |
| right | int | The x-coordinate of the lower-right corner of this Rectangle structure. |
| bottom | int | The y-coordinate of the lower-right corner of this Rectangle structure. |
Returns
| Type | Description |
|---|---|
| Rectangle | The new Rectangle that this method creates. |
Method: from_points(point1, point2) [static]
from_points(point1, point2)
Creates a new Rectangle from two points specified. Two verticales of the created Rectangle will be equal to the passed point1 and point2. These would be typically the opposite vertices.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| point1 | Point | The first Point for the new rectangle. |
| point2 | Point | The second Point for the new rectangle. |
Returns
| Type | Description |
|---|---|
| Rectangle | A newly created Rectangle. |
Method: inflate(rect, x, y) [static]
inflate(rect, x, y)
Creates and returns an inflated copy of the specified Rectangle structure. The copy is inflated by the specified amount. The original Rectangle structure remains unmodified.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The Rectangle with which to start. This rectangle is not modified. |
| x | int | The amount to inflate this Rectangle horizontally. |
| y | int | The amount to inflate this Rectangle vertically. |
Returns
| Type | Description |
|---|---|
| Rectangle | The inflated Rectangle. |
Method: inflate(size)
inflate(size)
Inflates this Rectangle by the specified amount.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| size | Size | The amount to inflate this rectangle. |
Method: inflate(width, height)
inflate(width, height)
Inflates this Rectangle by the specified amount.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| width | int | The amount to inflate this Rectangle horizontally. |
| height | int | The amount to inflate this Rectangle vertically. |
Method: inflate_rect(rect, x, y) [static]
inflate_rect(rect, x, y)
Creates and returns an inflated copy of the specified Rectangle structure. The copy is inflated by the specified amount. The original Rectangle structure remains unmodified.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The Rectangle with which to start. This rectangle is not modified. |
| x | int | The amount to inflate this Rectangle horizontally. |
| y | int | The amount to inflate this Rectangle vertically. |
Returns
| Type | Description |
|---|---|
| Rectangle | The inflated Rectangle. |
Method: intersect(a, b) [static]
intersect(a, b)
Returns a third Rectangle structure that represents the intersection of two other Rectangle structures. If there is no intersection, an empty Rectangle is returned.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| a | Rectangle | A first rectangle to intersect. |
| b | Rectangle | A second rectangle to intersect. |
Returns
| Type | Description |
|---|---|
| Rectangle | A Rectangle that represents the intersection of a and b. |
Method: intersect(rect)
intersect(rect)
Replaces this Rectangle with the intersection of itself and the specified Rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The Rectangle with which to intersect. |
Method: intersect_rects(a, b) [static]
intersect_rects(a, b)
Returns a third Rectangle structure that represents the intersection of two other Rectangle structures. If there is no intersection, an empty Rectangle is returned.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| a | Rectangle | A first rectangle to intersect. |
| b | Rectangle | A second rectangle to intersect. |
Returns
| Type | Description |
|---|---|
| Rectangle | A Rectangle that represents the intersection of a and b. |
Method: intersects_with(rect)
intersects_with(rect)
Determines if this rectangle intersects with rect.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The rectangle to test. |
Returns
| Type | Description |
|---|---|
| bool | This method returns true if there is any intersection, otherwise false. |
Method: offset(pos)
offset(pos)
Adjusts the location of this rectangle by the specified amount.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pos | Point | Amount to offset the location. |
Method: offset(x, y)
offset(x, y)
Adjusts the location of this rectangle by the specified amount.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | int | The horizontal offset. |
| y | int | The vertical offset. |
Method: round(value) [static]
round(value)
Converts the specified RectangleF to a Rectangle by rounding the RectangleF values to the nearest integer values.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | RectangleF | The RectangleF to be converted. |
Returns
| Type | Description |
|---|---|
| Rectangle | A new Rectangle. |
Method: truncate(value) [static]
truncate(value)
Converts the specified RectangleF to a Rectangle by truncating the RectangleF values.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | RectangleF | The RectangleF to be converted. |
Returns
| Type | Description |
|---|---|
| Rectangle | A new Rectangle. |
Method: union(a, b) [static]
union(a, b)
Gets a Rectangle structure that contains the union of two Rectangle structures.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| a | Rectangle | A first rectangle to union. |
| b | Rectangle | A second rectangle to union. |
Returns
| Type | Description |
|---|---|
| Rectangle | A Rectangle structure that bounds the union of the two Rectangle structures. |