public class Rectangle extends com.aspose.ms.lang.Struct<Rectangle>
Stores a set of four integers that represent the location and size of a rectangle.
| Constructor and Description |
|---|
Rectangle() |
Rectangle(int x,
int y,
int width,
int height)
Initializes a new instance of the
com.aspose.imaging.Rectangle structure with the specified location and size. |
Rectangle(Point location,
Size size)
Initializes a new instance of the
com.aspose.imaging.Rectangle structure with the specified location and size. |
| Modifier and Type | Method and Description |
|---|---|
static Rectangle |
ceiling(RectangleF value)
Converts the specified
com.aspose.imaging.RectangleF structure to a com.aspose.imaging.Rectangle structure by rounding the com.aspose.imaging.RectangleF values to the next higher integer values. |
Rectangle |
Clone() |
void |
CloneTo(Rectangle that) |
boolean |
contains(int x,
int y)
Determines if the specified point is contained within this
com.aspose.imaging.Rectangle structure. |
boolean |
contains(Point point)
Determines if the specified point is contained within this
com.aspose.imaging.Rectangle structure. |
boolean |
contains(Rectangle rect)
Determines if the rectangular region represented by
rect is entirely contained within this com.aspose.imaging.Rectangle structure. |
boolean |
equals(Object obj)
Tests whether
obj is a com.aspose.imaging.Rectangle structure with the same location and size of this com.aspose.imaging.Rectangle structure. |
static Rectangle |
fromLeftTopRightBottom(int left,
int top,
int right,
int bottom)
Creates a
com.aspose.imaging.Rectangle structure with the specified edge locations. |
static Rectangle |
fromPoints(Point point1,
Point point2)
Creates a new
Rectangle from two points specified. |
int |
getBottom()
Gets or sets the y-coordinate that is the sum of the
com.aspose.imaging.Rectangle.Y and com.aspose.imaging.Rectangle.Height property values of this com.aspose.imaging.Rectangle structure. |
static Rectangle |
getEmpty()
Gets a new instance of the
com.aspose.imaging.Rectangle structure that has com.aspose.imaging.Rectangle.X, com.aspose.imaging.Rectangle.Y, com.aspose.imaging.Rectangle.Width and com.aspose.imaging.Rectangle.Height values set to zero. |
int |
getHeight()
Gets or sets the height of this
com.aspose.imaging.Rectangle structure. |
int |
getLeft()
Gets or sets the x-coordinate of the left edge of this
com.aspose.imaging.Rectangle structure. |
Point |
getLocation()
Gets or sets the coordinates of the upper-left corner of this
com.aspose.imaging.Rectangle structure. |
int |
getRight()
Gets or sets the x-coordinate that is the sum of
com.aspose.imaging.Rectangle.X and com.aspose.imaging.Rectangle.Width property values of this com.aspose.imaging.Rectangle structure. |
Size |
getSize()
Gets or sets the size of this
com.aspose.imaging.Rectangle. |
int |
getTop()
Gets or sets the y-coordinate of the top edge of this
com.aspose.imaging.Rectangle structure. |
int |
getWidth()
Gets the width of this
com.aspose.imaging.Rectangle structure. |
int |
getX()
Gets or sets the x-coordinate of the upper-left corner of this
com.aspose.imaging.Rectangle structure. |
int |
getY()
Gets or sets the y-coordinate of the upper-left corner of this
com.aspose.imaging.Rectangle structure. |
int |
hashCode()
Returns the hash code for this
com.aspose.imaging.Rectangle structure. |
void |
inflate(int width,
int height)
Inflates this
com.aspose.imaging.Rectangle by the specified amount. |
static Rectangle |
inflate(Rectangle rect,
int x,
int y)
Creates and returns an inflated copy of the specified
com.aspose.imaging.Rectangle structure. |
void |
inflate(Size size)
Inflates this
com.aspose.imaging.Rectangle by the specified amount. |
void |
intersect(Rectangle rect)
Replaces this
com.aspose.imaging.Rectangle with the intersection of itself and the specified com.aspose.imaging.Rectangle. |
static Rectangle |
intersect(Rectangle a,
Rectangle b)
Returns a third
com.aspose.imaging.Rectangle structure that represents the intersection of two other com.aspose.imaging.Rectangle structures. |
boolean |
intersectsWith(Rectangle rect)
Determines if this rectangle intersects with
rect. |
boolean |
isEmpty()
Gets a value indicating whether all numeric properties of this
com.aspose.imaging.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
com.aspose.imaging.Rectangle structures have equal location and size. |
static boolean |
op_Inequality(Rectangle left,
Rectangle right)
Tests whether two
com.aspose.imaging.Rectangle structures differ in location or size. |
static Rectangle |
round(RectangleF value)
Converts the specified
com.aspose.imaging.RectangleF to a com.aspose.imaging.Rectangle by rounding the com.aspose.imaging.RectangleF values to the nearest integer values. |
void |
setBottom(int value)
Gets or sets the y-coordinate that is the sum of the
com.aspose.imaging.Rectangle.Y and com.aspose.imaging.Rectangle.Height property values of this com.aspose.imaging.Rectangle structure. |
void |
setHeight(int value)
Gets or sets the height of this
com.aspose.imaging.Rectangle structure. |
void |
setLeft(int value)
Gets or sets the x-coordinate of the left edge of this
com.aspose.imaging.Rectangle structure. |
void |
setLocation(Point value)
Gets or sets the coordinates of the upper-left corner of this
com.aspose.imaging.Rectangle structure. |
void |
setRight(int value)
Gets or sets the x-coordinate that is the sum of
com.aspose.imaging.Rectangle.X and com.aspose.imaging.Rectangle.Width property values of this com.aspose.imaging.Rectangle structure. |
void |
setSize(Size value)
Gets or sets the size of this
com.aspose.imaging.Rectangle. |
void |
setTop(int value)
Gets or sets the y-coordinate of the top edge of this
com.aspose.imaging.Rectangle structure. |
void |
setWidth(int value)
Sets the width of this
com.aspose.imaging.Rectangle structure. |
void |
setX(int value)
Gets or sets the x-coordinate of the upper-left corner of this
com.aspose.imaging.Rectangle structure. |
void |
setY(int value)
Gets or sets the y-coordinate of the upper-left corner of this
com.aspose.imaging.Rectangle structure. |
String |
toString()
Converts the attributes of this
com.aspose.imaging.Rectangle to a human-readable string. |
static Rectangle |
truncate(RectangleF value)
Converts the specified
com.aspose.imaging.RectangleF to a com.aspose.imaging.Rectangle by truncating the com.aspose.imaging.RectangleF values. |
static Rectangle |
union(Rectangle a,
Rectangle b)
Gets a
com.aspose.imaging.Rectangle structure that contains the union of two com.aspose.imaging.Rectangle structures. |
public Rectangle()
public Rectangle(int x,
int y,
int width,
int height)
Initializes a new instance of the com.aspose.imaging.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 com.aspose.imaging.Rectangle structure with the specified location and size.
location - A com.aspose.imaging.Point that represents the upper-left corner of the rectangular region.size - A com.aspose.imaging.Size that represents the width and height of the rectangular region.public static Rectangle getEmpty()
Gets a new instance of the com.aspose.imaging.Rectangle structure that has com.aspose.imaging.Rectangle.X, com.aspose.imaging.Rectangle.Y, com.aspose.imaging.Rectangle.Width and com.aspose.imaging.Rectangle.Height values set to zero.
public Point getLocation()
Gets or sets the coordinates of the upper-left corner of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Point that represents the upper-left corner of this com.aspose.imaging.Rectangle structure.public void setLocation(Point value)
Gets or sets the coordinates of the upper-left corner of this com.aspose.imaging.Rectangle structure.
value - A Point that represents the upper-left corner of this com.aspose.imaging.Rectangle structure.public Size getSize()
Gets or sets the size of this com.aspose.imaging.Rectangle.
com.aspose.imaging.Size that represents the width and height of this com.aspose.imaging.Rectangle structure.public void setSize(Size value)
Gets or sets the size of this com.aspose.imaging.Rectangle.
value - A com.aspose.imaging.Size that represents the width and height of this com.aspose.imaging.Rectangle structure.public int getX()
Gets or sets the x-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle structure.public void setX(int value)
Gets or sets the x-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.
value - The x-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.public int getY()
Gets or sets the y-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle structure.public void setY(int value)
Gets or sets the y-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.
value - The y-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.public int getWidth()
Gets the width of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle structure.public void setWidth(int value)
Sets the width of this com.aspose.imaging.Rectangle structure.
value - The width of this com.aspose.imaging.Rectangle structure.public int getHeight()
Gets or sets the height of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle structure.public void setHeight(int value)
Gets or sets the height of this com.aspose.imaging.Rectangle structure.
value - The height of this com.aspose.imaging.Rectangle structure.public int getLeft()
Gets or sets the x-coordinate of the left edge of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle structure.public void setLeft(int value)
Gets or sets the x-coordinate of the left edge of this com.aspose.imaging.Rectangle structure.
value - The x-coordinate of the left edge of this com.aspose.imaging.Rectangle structure.public int getTop()
Gets or sets the y-coordinate of the top edge of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle structure.public void setTop(int value)
Gets or sets the y-coordinate of the top edge of this com.aspose.imaging.Rectangle structure.
value - The y-coordinate of the top edge of this com.aspose.imaging.Rectangle structure.public int getRight()
Gets or sets the x-coordinate that is the sum of com.aspose.imaging.Rectangle.X and com.aspose.imaging.Rectangle.Width property values of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle.X and com.aspose.imaging.Rectangle.Width of this com.aspose.imaging.Rectangle.public void setRight(int value)
Gets or sets the x-coordinate that is the sum of com.aspose.imaging.Rectangle.X and com.aspose.imaging.Rectangle.Width property values of this com.aspose.imaging.Rectangle structure.
value - The x-coordinate that is the sum of com.aspose.imaging.Rectangle.X and com.aspose.imaging.Rectangle.Width of this com.aspose.imaging.Rectangle.public int getBottom()
Gets or sets the y-coordinate that is the sum of the com.aspose.imaging.Rectangle.Y and com.aspose.imaging.Rectangle.Height property values of this com.aspose.imaging.Rectangle structure.
com.aspose.imaging.Rectangle.Y and com.aspose.imaging.Rectangle.Height of this com.aspose.imaging.Rectangle.public void setBottom(int value)
Gets or sets the y-coordinate that is the sum of the com.aspose.imaging.Rectangle.Y and com.aspose.imaging.Rectangle.Height property values of this com.aspose.imaging.Rectangle structure.
value - The y-coordinate that is the sum of com.aspose.imaging.Rectangle.Y and com.aspose.imaging.Rectangle.Height of this com.aspose.imaging.Rectangle.public boolean isEmpty()
Gets a value indicating whether all numeric properties of this com.aspose.imaging.Rectangle have values of zero.
com.aspose.imaging.Rectangle.Width, com.aspose.imaging.Rectangle.Height, com.aspose.imaging.Rectangle.X, and com.aspose.imaging.Rectangle.Y properties of this com.aspose.imaging.Rectangle all have values of zero; otherwise, false.public static Rectangle fromPoints(Point point1, Point 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.
point1 - The first Point for the new rectangle.point2 - The second Point for the new rectangle.Rectangle.public static Rectangle ceiling(RectangleF value)
Converts the specified com.aspose.imaging.RectangleF structure to a com.aspose.imaging.Rectangle structure by rounding the com.aspose.imaging.RectangleF values to the next higher integer values.
value - The com.aspose.imaging.RectangleF structure to be converted.com.aspose.imaging.Rectangle.public static Rectangle truncate(RectangleF value)
Converts the specified com.aspose.imaging.RectangleF to a com.aspose.imaging.Rectangle by truncating the com.aspose.imaging.RectangleF values.
value - The com.aspose.imaging.RectangleF to be converted.com.aspose.imaging.Rectangle.public static Rectangle round(RectangleF value)
Converts the specified com.aspose.imaging.RectangleF to a com.aspose.imaging.Rectangle by rounding the com.aspose.imaging.RectangleF values to the nearest integer values.
value - The com.aspose.imaging.RectangleF to be converted.com.aspose.imaging.Rectangle.public static Rectangle inflate(Rectangle rect, int x, int y)
Creates and returns an inflated copy of the specified com.aspose.imaging.Rectangle structure. The copy is inflated by the specified amount. The original com.aspose.imaging.Rectangle structure remains unmodified.
rect - The com.aspose.imaging.Rectangle with which to start. This rectangle is not modified.x - The amount to inflate this com.aspose.imaging.Rectangle horizontally.y - The amount to inflate this com.aspose.imaging.Rectangle vertically.com.aspose.imaging.Rectangle.public static Rectangle intersect(Rectangle a, Rectangle b)
Returns a third com.aspose.imaging.Rectangle structure that represents the intersection of two other com.aspose.imaging.Rectangle structures. If there is no intersection, an empty com.aspose.imaging.Rectangle is returned.
a - A first rectangle to intersect.b - A second rectangle to intersect.com.aspose.imaging.Rectangle that represents the intersection of a and b.public static Rectangle union(Rectangle a, Rectangle b)
Gets a com.aspose.imaging.Rectangle structure that contains the union of two com.aspose.imaging.Rectangle structures.
a - A first rectangle to union.b - A second rectangle to union.com.aspose.imaging.Rectangle structure that bounds the union of the two com.aspose.imaging.Rectangle structures.public static boolean op_Equality(Rectangle left, Rectangle right)
Tests whether two com.aspose.imaging.Rectangle structures have equal location and size.
left - The com.aspose.imaging.Rectangle structure that is to the left of the equality operator.right - The com.aspose.imaging.Rectangle structure that is to the right of the equality operator.com.aspose.imaging.Rectangle structures have equal com.aspose.imaging.Rectangle.X, com.aspose.imaging.Rectangle.Y, com.aspose.imaging.Rectangle.Width, and com.aspose.imaging.Rectangle.Height properties.public static boolean op_Inequality(Rectangle left, Rectangle right)
Tests whether two com.aspose.imaging.Rectangle structures differ in location or size.
left - The com.aspose.imaging.Rectangle structure that is to the left of the inequality operator.right - The com.aspose.imaging.Rectangle structure that is to the right of the inequality operator.com.aspose.imaging.Rectangle.X, com.aspose.imaging.Rectangle.Y, com.aspose.imaging.Rectangle.Width or com.aspose.imaging.Rectangle.Height properties of the two com.aspose.imaging.Rectangle structures are unequal; otherwise false.public static Rectangle fromLeftTopRightBottom(int left, int top, int right, int bottom)
Creates a com.aspose.imaging.Rectangle structure with the specified edge locations.
left - The x-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.top - The y-coordinate of the upper-left corner of this com.aspose.imaging.Rectangle structure.right - The x-coordinate of the lower-right corner of this com.aspose.imaging.Rectangle structure.bottom - The y-coordinate of the lower-right corner of this com.aspose.imaging.Rectangle structure.com.aspose.imaging.Rectangle that this method creates.public boolean contains(int x,
int y)
Determines if the specified point is contained within this com.aspose.imaging.Rectangle structure.
x - The x-coordinate of the point to test.y - The y-coordinate of the point to test.x and y is contained within this com.aspose.imaging.Rectangle structure; otherwise false.public boolean contains(Point point)
Determines if the specified point is contained within this com.aspose.imaging.Rectangle structure.
point - The com.aspose.imaging.Point to test.point is contained within this com.aspose.imaging.Rectangle structure; otherwise false.public boolean contains(Rectangle rect)
Determines if the rectangular region represented by rect is entirely contained within this com.aspose.imaging.Rectangle structure.
rect - The com.aspose.imaging.Rectangle to test.rect is entirely contained within this com.aspose.imaging.Rectangle structure; otherwise false.public void inflate(int width,
int height)
Inflates this com.aspose.imaging.Rectangle by the specified amount.
width - The amount to inflate this com.aspose.imaging.Rectangle horizontally.height - The amount to inflate this com.aspose.imaging.Rectangle vertically.public void inflate(Size size)
Inflates this com.aspose.imaging.Rectangle by the specified amount.
size - The amount to inflate this rectangle.public void intersect(Rectangle rect)
Replaces this com.aspose.imaging.Rectangle with the intersection of itself and the specified com.aspose.imaging.Rectangle.
rect - The com.aspose.imaging.Rectangle with which to intersect.public boolean intersectsWith(Rectangle rect)
Determines if this rectangle intersects with rect.
rect - The rectangle to test.public void offset(Point pos)
Adjusts the location of this rectangle by the specified amount.
pos - Amount to offset the location.public 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 void normalize()
Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.
public boolean equals(Object obj)
Tests whether obj is a com.aspose.imaging.Rectangle structure with the same location and size of this com.aspose.imaging.Rectangle structure.
equals in class Objectobj - The System.Object to test.obj is a com.aspose.imaging.Rectangle structure and its com.aspose.imaging.Rectangle.X, com.aspose.imaging.Rectangle.Y, com.aspose.imaging.Rectangle.Width, and com.aspose.imaging.Rectangle.Height properties are equal to the corresponding properties of this com.aspose.imaging.Rectangle structure; otherwise, false.public int hashCode()
Returns the hash code for this com.aspose.imaging.Rectangle structure.
public String toString()
Converts the attributes of this com.aspose.imaging.Rectangle to a human-readable string.
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>Copyright (c) 2008-2022 Aspose Pty Ltd. All Rights Reserved.