Packages

 

com.aspose.cad

Class Rectangle



  • 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 Summary

      Constructors 
      Constructor and Description
      Rectangle() 
      Rectangle(int x, int y, int width, int height)
      Initializes a new instance of the Aspose.Imaging.Rectangle structure with the specified location and size.
      Rectangle(Point location, Size size)
      Initializes a new instance of the Aspose.Imaging.Rectangle structure with the specified location and size.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static Rectangle ceiling(RectangleF value)
      Converts the specified Aspose.Imaging.RectangleF structure to a Aspose.Imaging.Rectangle structure by rounding the Aspose.Imaging.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 Aspose.Imaging.Rectangle structure.
      boolean contains(Point point)
      Determines if the specified point is contained within this Aspose.Imaging.Rectangle structure.
      boolean contains(Rectangle rect)
      Determines if the rectangular region represented by rect is entirely contained within this Aspose.Imaging.Rectangle structure.
      boolean equals(Object obj)
      Tests whether obj is a Aspose.Imaging.Rectangle structure with the same location and size of this Aspose.Imaging.Rectangle structure.
      static Rectangle fromLeftTopRightBottom(int left, int top, int right, int bottom)
      Creates a 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 Aspose.Imaging.Rectangle.Y and Aspose.Imaging.Rectangle.Height property values of this Aspose.Imaging.Rectangle structure.
      static Rectangle getEmpty()
      Gets a new instance of the Aspose.Imaging.Rectangle structure that has Aspose.Imaging.Rectangle.X, Aspose.Imaging.Rectangle.Y, Aspose.Imaging.Rectangle.Width and Aspose.Imaging.Rectangle.Height values set to zero.
      int getHeight()
      Gets or sets the height of this Aspose.Imaging.Rectangle structure.
      int getLeft()
      Gets or sets the x-coordinate of the left edge of this Aspose.Imaging.Rectangle structure.
      Point getLocation()
      Gets or sets the coordinates of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      int getRight()
      Gets or sets the x-coordinate that is the sum of Aspose.Imaging.Rectangle.X and Aspose.Imaging.Rectangle.Width property values of this Aspose.Imaging.Rectangle structure.
      Size getSize()
      Gets or sets the size of this Aspose.Imaging.Rectangle.
      int getTop()
      Gets or sets the y-coordinate of the top edge of this Aspose.Imaging.Rectangle structure.
      int getWidth()
      Gets or sets the width of this Aspose.Imaging.Rectangle structure.
      int getX()
      Gets or sets the x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      int getY()
      Gets or sets the y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      int hashCode()
      Returns the hash code for this Aspose.Imaging.Rectangle structure.
      void inflate(int width, int height)
      Inflates this 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 Aspose.Imaging.Rectangle structure.
      void inflate(Size size)
      Inflates this Aspose.Imaging.Rectangle by the specified amount.
      void intersect(Rectangle rect)
      Replaces this Aspose.Imaging.Rectangle with the intersection of itself and the specified Aspose.Imaging.Rectangle.
      static Rectangle intersect(Rectangle a, Rectangle b)
      Returns a third Aspose.Imaging.Rectangle structure that represents the intersection of two other 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 Aspose.Imaging.Rectangle have values of zero.
      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 Aspose.Imaging.Rectangle structures have equal location and size.
      static boolean op_Inequality(Rectangle left, Rectangle right)
      Tests whether two Aspose.Imaging.Rectangle structures differ in location or size.
      static Rectangle round(RectangleF value)
      Converts the specified Aspose.Imaging.RectangleF to a Aspose.Imaging.Rectangle by rounding the 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 Aspose.Imaging.Rectangle.Y and Aspose.Imaging.Rectangle.Height property values of this Aspose.Imaging.Rectangle structure.
      void setHeight(int value)
      Gets or sets the height of this Aspose.Imaging.Rectangle structure.
      void setLeft(int value)
      Gets or sets the x-coordinate of the left edge of this Aspose.Imaging.Rectangle structure.
      void setLocation(Point value)
      Gets or sets the coordinates of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      void setRight(int value)
      Gets or sets the x-coordinate that is the sum of Aspose.Imaging.Rectangle.X and Aspose.Imaging.Rectangle.Width property values of this Aspose.Imaging.Rectangle structure.
      void setSize(Size value)
      Gets or sets the size of this Aspose.Imaging.Rectangle.
      void setTop(int value)
      Gets or sets the y-coordinate of the top edge of this Aspose.Imaging.Rectangle structure.
      void setWidth(int value)
      Gets or sets the width of this Aspose.Imaging.Rectangle structure.
      void setX(int value)
      Gets or sets the x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      void setY(int value)
      Gets or sets the y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      String toString()
      Converts the attributes of this Aspose.Imaging.Rectangle to a human-readable string.
      static Rectangle truncate(RectangleF value)
      Converts the specified Aspose.Imaging.RectangleF to a Aspose.Imaging.Rectangle by truncating the Aspose.Imaging.RectangleF values.
      static Rectangle union(Rectangle a, Rectangle b)
      Gets a Aspose.Imaging.Rectangle structure that contains the union of two Aspose.Imaging.Rectangle structures.
    • Constructor Detail

      • Rectangle

        public Rectangle()
      • Rectangle

        public Rectangle(int x,
                         int y,
                         int width,
                         int height)

        Initializes a new instance of the Aspose.Imaging.Rectangle structure with the specified location and size.

        Parameters:
        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.
      • Rectangle

        public Rectangle(Point location,
                         Size size)

        Initializes a new instance of the Aspose.Imaging.Rectangle structure with the specified location and size.

        Parameters:
        location - A Aspose.Imaging.Point that represents the upper-left corner of the rectangular region.
        size - A Aspose.Imaging.Size that represents the width and height of the rectangular region.
    • Method Detail

      • getEmpty

        public static Rectangle getEmpty()

        Gets a new instance of the Aspose.Imaging.Rectangle structure that has Aspose.Imaging.Rectangle.X, Aspose.Imaging.Rectangle.Y, Aspose.Imaging.Rectangle.Width and Aspose.Imaging.Rectangle.Height values set to zero.

      • getLocation

        public Point getLocation()

        Gets or sets the coordinates of the upper-left corner of this Aspose.Imaging.Rectangle structure.

        Value: A Aspose.Imaging.Point that represents the upper-left corner of this Aspose.Imaging.Rectangle structure.
      • setLocation

        public void setLocation(Point value)

        Gets or sets the coordinates of the upper-left corner of this Aspose.Imaging.Rectangle structure.

        Value: A Aspose.Imaging.Point that represents the upper-left corner of this Aspose.Imaging.Rectangle structure.
      • getSize

        public Size getSize()

        Gets or sets the size of this Aspose.Imaging.Rectangle.

        Value: A Aspose.Imaging.Size that represents the width and height of this Aspose.Imaging.Rectangle structure.
      • setSize

        public void setSize(Size value)

        Gets or sets the size of this Aspose.Imaging.Rectangle.

        Value: A Aspose.Imaging.Size that represents the width and height of this Aspose.Imaging.Rectangle structure.
      • getX

        public int getX()

        Gets or sets the x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.

        Value: The x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      • setX

        public void setX(int value)

        Gets or sets the x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.

        Value: The x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      • getY

        public int getY()

        Gets or sets the y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.

        Value: The y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      • setY

        public void setY(int value)

        Gets or sets the y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.

        Value: The y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
      • getWidth

        public int getWidth()

        Gets or sets the width of this Aspose.Imaging.Rectangle structure.

        Returns:
        The width of this Aspose.Imaging.Rectangle structure.
      • setWidth

        public void setWidth(int value)

        Gets or sets the width of this Aspose.Imaging.Rectangle structure.

      • getHeight

        public int getHeight()

        Gets or sets the height of this Aspose.Imaging.Rectangle structure.

        Returns:
        The height of this Aspose.Imaging.Rectangle structure.
      • setHeight

        public void setHeight(int value)

        Gets or sets the height of this Aspose.Imaging.Rectangle structure.

      • getLeft

        public int getLeft()

        Gets or sets the x-coordinate of the left edge of this Aspose.Imaging.Rectangle structure.

        Value: The x-coordinate of the left edge of this Aspose.Imaging.Rectangle structure.
      • setLeft

        public void setLeft(int value)

        Gets or sets the x-coordinate of the left edge of this Aspose.Imaging.Rectangle structure.

        Value: The x-coordinate of the left edge of this Aspose.Imaging.Rectangle structure.
      • getTop

        public int getTop()

        Gets or sets the y-coordinate of the top edge of this Aspose.Imaging.Rectangle structure.

        Value: The y-coordinate of the top edge of this Aspose.Imaging.Rectangle structure.
      • setTop

        public void setTop(int value)

        Gets or sets the y-coordinate of the top edge of this Aspose.Imaging.Rectangle structure.

        Value: The y-coordinate of the top edge of this Aspose.Imaging.Rectangle structure.
      • getRight

        public int getRight()

        Gets or sets the x-coordinate that is the sum of Aspose.Imaging.Rectangle.X and Aspose.Imaging.Rectangle.Width property values of this Aspose.Imaging.Rectangle structure.

        Value: The x-coordinate that is the sum of Aspose.Imaging.Rectangle.X and Aspose.Imaging.Rectangle.Width of this Aspose.Imaging.Rectangle.
      • setRight

        public void setRight(int value)

        Gets or sets the x-coordinate that is the sum of Aspose.Imaging.Rectangle.X and Aspose.Imaging.Rectangle.Width property values of this Aspose.Imaging.Rectangle structure.

        Value: The x-coordinate that is the sum of Aspose.Imaging.Rectangle.X and Aspose.Imaging.Rectangle.Width of this Aspose.Imaging.Rectangle.
      • getBottom

        public int getBottom()

        Gets or sets the y-coordinate that is the sum of the Aspose.Imaging.Rectangle.Y and Aspose.Imaging.Rectangle.Height property values of this Aspose.Imaging.Rectangle structure.

        Value: The y-coordinate that is the sum of Aspose.Imaging.Rectangle.Y and Aspose.Imaging.Rectangle.Height of this Aspose.Imaging.Rectangle.
      • setBottom

        public void setBottom(int value)

        Gets or sets the y-coordinate that is the sum of the Aspose.Imaging.Rectangle.Y and Aspose.Imaging.Rectangle.Height property values of this Aspose.Imaging.Rectangle structure.

        Value: The y-coordinate that is the sum of Aspose.Imaging.Rectangle.Y and Aspose.Imaging.Rectangle.Height of this Aspose.Imaging.Rectangle.
      • isEmpty

        public boolean isEmpty()

        Gets a value indicating whether all numeric properties of this Aspose.Imaging.Rectangle have values of zero.

        Value: This property returns true if the Aspose.Imaging.Rectangle.Width, Aspose.Imaging.Rectangle.Height, Aspose.Imaging.Rectangle.X, and Aspose.Imaging.Rectangle.Y properties of this Aspose.Imaging.Rectangle all have values of zero; otherwise, false.
      • fromPoints

        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.

        Parameters:
        point1 - The first Point for the new rectangle.
        point2 - The second Point for the new rectangle.
        Returns:
        A newly created Rectangle.
      • ceiling

        public static Rectangle ceiling(RectangleF value)

        Converts the specified Aspose.Imaging.RectangleF structure to a Aspose.Imaging.Rectangle structure by rounding the Aspose.Imaging.RectangleF values to the next higher integer values.

        Parameters:
        value - The Aspose.Imaging.RectangleF structure to be converted.
        Returns:
        Returns a Aspose.Imaging.Rectangle.
      • truncate

        public static Rectangle truncate(RectangleF value)

        Converts the specified Aspose.Imaging.RectangleF to a Aspose.Imaging.Rectangle by truncating the Aspose.Imaging.RectangleF values.

        Parameters:
        value - The Aspose.Imaging.RectangleF to be converted.
        Returns:
        A new Aspose.Imaging.Rectangle.
      • round

        public static Rectangle round(RectangleF value)

        Converts the specified Aspose.Imaging.RectangleF to a Aspose.Imaging.Rectangle by rounding the Aspose.Imaging.RectangleF values to the nearest integer values.

        Parameters:
        value - The Aspose.Imaging.RectangleF to be converted.
        Returns:
        A new Aspose.Imaging.Rectangle.
      • inflate

        public static Rectangle inflate(Rectangle rect,
                                        int x,
                                        int y)

        Creates and returns an inflated copy of the specified Aspose.Imaging.Rectangle structure. The copy is inflated by the specified amount. The original Aspose.Imaging.Rectangle structure remains unmodified.

        Parameters:
        rect - The Aspose.Imaging.Rectangle with which to start. This rectangle is not modified.
        x - The amount to inflate this Aspose.Imaging.Rectangle horizontally.
        y - The amount to inflate this Aspose.Imaging.Rectangle vertically.
        Returns:
        The inflated Aspose.Imaging.Rectangle.
      • intersect

        public static Rectangle intersect(Rectangle a,
                                          Rectangle b)

        Returns a third Aspose.Imaging.Rectangle structure that represents the intersection of two other Aspose.Imaging.Rectangle structures. If there is no intersection, an empty Aspose.Imaging.Rectangle is returned.

        Parameters:
        a - A first rectangle to intersect.
        b - A second rectangle to intersect.
        Returns:
        A Aspose.Imaging.Rectangle that represents the intersection of a and b.
      • union

        public static Rectangle union(Rectangle a,
                                      Rectangle b)

        Gets a Aspose.Imaging.Rectangle structure that contains the union of two Aspose.Imaging.Rectangle structures.

        Parameters:
        a - A first rectangle to union.
        b - A second rectangle to union.
        Returns:
        A Aspose.Imaging.Rectangle structure that bounds the union of the two Aspose.Imaging.Rectangle structures.
      • op_Equality

        public static boolean op_Equality(Rectangle left,
                                          Rectangle right)

        Tests whether two Aspose.Imaging.Rectangle structures have equal location and size.

        Parameters:
        left - The Aspose.Imaging.Rectangle structure that is to the left of the equality operator.
        right - The Aspose.Imaging.Rectangle structure that is to the right of the equality operator.
        Returns:
        This operator returns true if the two Aspose.Imaging.Rectangle structures have equal Aspose.Imaging.Rectangle.X, Aspose.Imaging.Rectangle.Y, Aspose.Imaging.Rectangle.Width, and Aspose.Imaging.Rectangle.Height properties.
      • op_Inequality

        public static boolean op_Inequality(Rectangle left,
                                            Rectangle right)

        Tests whether two Aspose.Imaging.Rectangle structures differ in location or size.

        Parameters:
        left - The Aspose.Imaging.Rectangle structure that is to the left of the inequality operator.
        right - The Aspose.Imaging.Rectangle structure that is to the right of the inequality operator.
        Returns:
        This operator returns true if any of the Aspose.Imaging.Rectangle.X, Aspose.Imaging.Rectangle.Y, Aspose.Imaging.Rectangle.Width or Aspose.Imaging.Rectangle.Height properties of the two Aspose.Imaging.Rectangle structures are unequal; otherwise false.
      • fromLeftTopRightBottom

        public static Rectangle fromLeftTopRightBottom(int left,
                                                       int top,
                                                       int right,
                                                       int bottom)

        Creates a Aspose.Imaging.Rectangle structure with the specified edge locations.

        Parameters:
        left - The x-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
        top - The y-coordinate of the upper-left corner of this Aspose.Imaging.Rectangle structure.
        right - The x-coordinate of the lower-right corner of this Aspose.Imaging.Rectangle structure.
        bottom - The y-coordinate of the lower-right corner of this Aspose.Imaging.Rectangle structure.
        Returns:
        The new Aspose.Imaging.Rectangle that this method creates.
      • contains

        public boolean contains(int x,
                                int y)

        Determines if the specified point is contained within this Aspose.Imaging.Rectangle structure.

        Parameters:
        x - The x-coordinate of the point to test.
        y - The y-coordinate of the point to test.
        Returns:
        This method returns true if the point defined by x and y is contained within this Aspose.Imaging.Rectangle structure; otherwise false.
      • contains

        public boolean contains(Point point)

        Determines if the specified point is contained within this Aspose.Imaging.Rectangle structure.

        Parameters:
        point - The Aspose.Imaging.Point to test.
        Returns:
        This method returns true if the point represented by point is contained within this Aspose.Imaging.Rectangle structure; otherwise false.
      • contains

        public boolean contains(Rectangle rect)

        Determines if the rectangular region represented by rect is entirely contained within this Aspose.Imaging.Rectangle structure.

        Parameters:
        rect - The Aspose.Imaging.Rectangle to test.
        Returns:
        This method returns true if the rectangular region represented by rect is entirely contained within this Aspose.Imaging.Rectangle structure; otherwise false.
      • inflate

        public void inflate(int width,
                            int height)

        Inflates this Aspose.Imaging.Rectangle by the specified amount.

        Parameters:
        width - The amount to inflate this Aspose.Imaging.Rectangle horizontally.
        height - The amount to inflate this Aspose.Imaging.Rectangle vertically.
      • inflate

        public void inflate(Size size)

        Inflates this Aspose.Imaging.Rectangle by the specified amount.

        Parameters:
        size - The amount to inflate this rectangle.
      • intersect

        public void intersect(Rectangle rect)

        Replaces this Aspose.Imaging.Rectangle with the intersection of itself and the specified Aspose.Imaging.Rectangle.

        Parameters:
        rect - The Aspose.Imaging.Rectangle with which to intersect.
      • intersectsWith

        public boolean intersectsWith(Rectangle rect)

        Determines if this rectangle intersects with rect.

        Parameters:
        rect - The rectangle to test.
        Returns:
        This method returns true if there is any intersection, otherwise false.
      • offset

        public void offset(Point pos)

        Adjusts the location of this rectangle by the specified amount.

        Parameters:
        pos - Amount to offset the location.
      • offset

        public void offset(int x,
                           int y)

        Adjusts the location of this rectangle by the specified amount.

        Parameters:
        x - The horizontal offset.
        y - The vertical offset.
      • normalize

        public void normalize()

        Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.

      • equals

        public boolean equals(Object obj)

        Tests whether obj is a Aspose.Imaging.Rectangle structure with the same location and size of this Aspose.Imaging.Rectangle structure.

        Overrides:
        equals in class Object
        Parameters:
        obj - The System.Object to test.
        Returns:
        This method returns true if obj is a Aspose.Imaging.Rectangle structure and its Aspose.Imaging.Rectangle.X, Aspose.Imaging.Rectangle.Y, Aspose.Imaging.Rectangle.Width, and Aspose.Imaging.Rectangle.Height properties are equal to the corresponding properties of this Aspose.Imaging.Rectangle structure; otherwise, false.
      • hashCode

        public int hashCode()

        Returns the hash code for this Aspose.Imaging.Rectangle structure.

        Overrides:
        hashCode in class Object
        Returns:
        An integer that represents the hash code for this rectangle.
      • toString

        public String toString()

        Converts the attributes of this Aspose.Imaging.Rectangle to a human-readable string.

        Overrides:
        toString in class Object
        Returns:
        A string that contains the position, width, and height of this Aspose.Imaging.Rectangle structure.
      • CloneTo

        public void CloneTo(Rectangle that)
        Specified by:
        CloneTo in class com.aspose.ms.System.ValueType<Rectangle>
      • Clone

        public Rectangle Clone()
        Specified by:
        Clone in class com.aspose.ms.System.ValueType<Rectangle>