| Constructor and Description |
|---|
Rectangle() |
Rectangle(int x,
int y,
int width,
int height)
Initializes a new instance of the Rectangle structure with the specified location and size.
|
Rectangle(Point location,
Size size)
Initializes a new instance of the
Rectangle struct with the specified location and size. |
| Modifier and Type | Method and Description |
|---|---|
static Rectangle |
ceiling(RectangleF value)
Converts the specified
RectangleF structure to a Rectangle structure by rounding the RectangleF values to the next higher integer values. |
Object |
clone() |
Rectangle |
Clone() |
void |
CloneTo(Rectangle that) |
boolean |
contains(int x,
int y)
Determines if the specified point is contained within this
Rectangle structure. |
boolean |
contains(Point pt)
Determines if the specified point is contained within this
Rectangle structure. |
boolean |
contains(Rectangle rect) |
boolean |
equals(Object obj)
|
boolean |
equals(Rectangle other)
|
static Rectangle |
fromLTRB(int left,
int top,
int right,
int bottom)
Creates a
Rectangle structure with the specified edge locations. |
static Rectangle |
fromPoints(Point point1,
Point point2)
Creates a new rectangle from two points.
|
int |
getBottom()
Gets the y-coordinate that is the sum of the Y and Height property values of this Rectangle structure.
|
static Rectangle |
getEmpty()
Gets a new instance of the
Rectangle structure that has Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height values set to zero. |
int |
getHeight()
Gets the height of this Rectangle structure.
|
int |
getLeft()
Gets the x-coordinate of the left edge of this Rectangle structure.
|
Point |
getLocation()
Gets the coordinates of the upper-left corner of this
Rectangle structure. |
int |
getRight()
Gets the x-coordinate that is the sum of X and Width property values of this Rectangle structure.
|
Size |
getSize()
Gets the size of this
Rectangle. |
int |
getTop()
Gets the y-coordinate of the top edge of this Rectangle structure.
|
int |
getWidth()
Gets the width of this Rectangle structure.
|
int |
getX()
Gets the x-coordinate of the upper-left corner of this Rectangle structure.
|
int |
getY()
Gets the y-coordinate of the upper-left corner of this Rectangle structure.
|
int |
hashCode()
Returns the hash code for this
Rectangle structure. |
void |
inflate(int width,
int height)
Enlarges this
Rectangle by the specified amount. |
static Rectangle |
inflate(Rectangle rect,
int x,
int y) |
void |
inflate(Size size)
Enlarges this
Rectangle by the specified amount. |
void |
intersect(Rectangle rect)
|
static Rectangle |
intersect(Rectangle a,
Rectangle b)
|
boolean |
intersectsWith(Rectangle rect)
Determines if this rectangle intersects with
rect. |
boolean |
isEmpty()
Gets a value indicating whether all numeric properties of this
Rectangle have values of zero. |
static boolean |
isEquals(Rectangle obj1,
Rectangle obj2) |
void |
normalize()
Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.
|
void |
offset(int x,
int y)
Adjusts the location of this rectangle by the specified amount.
|
void |
offset(Point pos)
Adjusts the location of this rectangle by the specified amount.
|
static boolean |
op_Equality(Rectangle left,
Rectangle right)
Tests whether two
Rectangle structures have equal location and size. |
static boolean |
op_Inequality(Rectangle left,
Rectangle right)
Tests whether two
Rectangle structures differ in location or size. |
static Rectangle |
round(RectangleF value)
Converts the specified
RectangleF to a Rectangle by rounding
the RectangleF values to the nearest integer values. |
void |
setHeight(int value)
Sets the height of this Rectangle structure.
|
void |
setLocation(Point value)
Sets the coordinates of the upper-left corner of this
Rectangle structure. |
void |
setSize(Size value)
Sets the size of this
Rectangle. |
void |
setWidth(int value)
Sets the width of this Rectangle structure.
|
void |
setX(int value)
Sets the x-coordinate of the upper-left corner of this Rectangle structure.
|
void |
setY(int value)
Sets the y-coordinate of the upper-left corner of this Rectangle structure.
|
String |
toString() |
static Rectangle |
truncate(RectangleF value)
|
static Rectangle |
union(Rectangle a,
Rectangle b)
|
public Rectangle()
public Rectangle(int x,
int y,
int width,
int height)
Initializes a new instance of the Rectangle structure with the specified location and size.
x - The x-coordinate of the upper-left corner of the rectangle.y - The y-coordinate of the upper-left corner of the rectangle.width - The width of the rectangle.height - The height of the rectangle.public Rectangle(Point location, Size size)
Initializes a new instance of the Rectangle struct with the specified location and size.
location - A Point that represents the upper-left corner of the rectangular region.size - A Size(Rectangle.getSize()/Rectangle.setSize(Size)) that represents the width and height of the rectangular region.public static Rectangle fromLTRB(int left, int top, int right, int bottom)
Creates a Rectangle structure with the specified edge locations.
left - The x-coordinate of the upper-left corner of this Rectangle structure.top - The y-coordinate of the upper-left corner of this Rectangle structure.right - The x-coordinate of the lower-right corner of this Rectangle structure.bottom - The y-coordinate of the lower-right corner of this Rectangle structure.Rectangle that this method creates.public static Rectangle intersect(Rectangle a, Rectangle 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.
a - First rectangle to intersect.b - Second rectangle to intersect.Rectangle that represents the intersection of a and b.public static boolean op_Equality(Rectangle left, Rectangle right)
Tests whether two Rectangle structures have equal location and size.
public static boolean op_Inequality(Rectangle left, Rectangle right)
Tests whether two Rectangle structures differ in location or size.
left - The Rectangle structure that is to the left of the inequality operator.right - The Rectangle structure that is to the right of the inequality operator.true if any of the X, Y, Width or Height properties of the two Rectangle structures are unequal; otherwise false.public static Rectangle ceiling(RectangleF value)
Converts the specified RectangleF structure to a Rectangle structure by rounding the RectangleF values to the next higher integer values.
value - The RectangleF structure to be converted.Rectangle.public static Rectangle truncate(RectangleF value)
Converts the specified RectangleF to a Rectangle by truncating the RectangleF values.
value - The RectangleF to be converted.Rectangle.public static Rectangle round(RectangleF value)
Converts the specified RectangleF to a Rectangle by rounding
the RectangleF values to the nearest integer values.
value - The RectangleF to be converted.Rectangle.public static Rectangle fromPoints(Point point1, Point point2)
Creates a new rectangle from two points. The created rectangle will be normalized with (left,top) lower than (right,bottom).
point1 - The first point.point2 - The second point.public static Rectangle getEmpty()
Gets a new instance of the Rectangle structure that has Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height values set to zero.
public final int getX()
Gets the x-coordinate of the upper-left corner of this Rectangle structure.
public final void setX(int value)
Sets the x-coordinate of the upper-left corner of this Rectangle structure.
value - the x-coordinate of the upper-left corner of this Rectangle structure.public final int getY()
Gets the y-coordinate of the upper-left corner of this Rectangle structure.
public final void setY(int value)
Sets the y-coordinate of the upper-left corner of this Rectangle structure.
value - the y-coordinate of the upper-left corner of this Rectangle structure.public final Point getLocation()
Gets the coordinates of the upper-left corner of this Rectangle structure.
Rectangle structure.public final void setLocation(Point value)
Sets the coordinates of the upper-left corner of this Rectangle structure.
value - the coordinates of the upper-left corner of this Rectangle structure.public final int getWidth()
Gets the width of this Rectangle structure.
public final void setWidth(int value)
Sets the width of this Rectangle structure.
value - the width of this Rectangle structure.public final int getHeight()
Gets the height of this Rectangle structure.
public final void setHeight(int value)
Sets the height of this Rectangle structure.
value - the height of this Rectangle structure.public final Size getSize()
Gets the size of this Rectangle.
Rectangle.public final void setSize(Size value)
Sets the size of this Rectangle.
value - the size of this Rectangle.public final int getLeft()
Gets the x-coordinate of the left edge of this Rectangle structure.
public final int getTop()
Gets the y-coordinate of the top edge of this Rectangle structure.
public final int getRight()
Gets the x-coordinate that is the sum of X and Width property values of this Rectangle structure.
public final int getBottom()
Gets the y-coordinate that is the sum of the Y and Height property values of this Rectangle structure.
public final boolean isEmpty()
Gets a value indicating whether all numeric properties of this Rectangle have values of zero.
true if the Rectangle.Width, Rectangle.Height, Rectangle.X,
and Rectangle.Y properties of this Rectangle all have values of zero; otherwise, false.public boolean equals(Object obj)
Tests whether obj is a Rectangle structure with the same location and size of this Rectangle structure.
equals in interface com.aspose.ms.System.IEquatable<Rectangle>equals in class Objectobj - The Object to test.true if obj is a Rectangle structure and its X, Y, Width, and Height properties are equal to the corresponding properties of this Rectangle structure; otherwise, false.public int hashCode()
Returns the hash code for this Rectangle structure. For information about the use of hash codes, see GetHashCode .
public final void intersect(Rectangle rect)
rect - The Rectangle with which to intersect.public final void inflate(int width,
int height)
Enlarges this Rectangle by the specified amount.
public final void inflate(Size size)
Enlarges this Rectangle by the specified amount.
size - The size to inflate this Rectangle.public final boolean contains(int x,
int y)
Determines if the specified point is contained within this Rectangle structure.
x - The x-coordinate of the point to test.y - The y-coordinate of the point to test.true if the point defined by x and y is contained within this Rectangle
structure; otherwise false.public final boolean contains(Point pt)
Determines if the specified point is contained within this Rectangle structure.
public final boolean contains(Rectangle rect)
public final boolean intersectsWith(Rectangle rect)
Determines if this rectangle intersects with rect.
rect - The rectangle to test.public final void offset(int x,
int y)
Adjusts the location of this rectangle by the specified amount.
x - The horizontal offset.y - The vertical offset.public final void offset(Point pos)
Adjusts the location of this rectangle by the specified amount.
pos - The offset.public final boolean equals(Rectangle other)
public void CloneTo(Rectangle that)
CloneTo in class com.aspose.ms.System.ValueType<Rectangle>public Rectangle Clone()
Clone in class com.aspose.ms.System.ValueType<Rectangle>public void normalize()
Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.
Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.