Packages

 

com.aspose.imaging

Interfaces

Classes

com.aspose.imaging

Class Region



  • public final class Region
    extends Object

    Describes the interior of a graphics shape composed of rectangles and paths. This class cannot be inherited.

    • Constructor Summary

      Constructors 
      Constructor and Description
      Region()
      Initializes a new T:Aspose.Imaging.Region.
      Region(GraphicsPath path)
      Initializes a new T:Aspose.Imaging.Region with the specified T:Aspose.Imaging.GraphicsPath.
      Region(Rectangle rect)
      Initializes a new T:Aspose.Imaging.Region from the specified T:Aspose.Imaging.Rectangle structure.
      Region(RectangleF rect)
      Initializes a new T:Aspose.Imaging.Region from the specified T:Aspose.Imaging.RectangleF structure.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void complement(GraphicsPath path)
      Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.GraphicsPath that does not intersect with this com.aspose.imaging.region.
      void complement(Rectangle rect)
      Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.Rectangle structure that does not intersect with this com.aspose.imaging.region.
      void complement(RectangleF rect)
      Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.RectangleF structure that does not intersect with this com.aspose.imaging.region.
      void complement(Region region)
      Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.Region that does not intersect with this com.aspose.imaging.region.
      Region deepClone()
      Creates an exact deep copy of this com.aspose.imaging.region.
      void exclude(GraphicsPath path)
      Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.graphicsPath.
      void exclude(Rectangle rect)
      Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.Rectangle structure.
      void exclude(RectangleF rect)
      Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.RectangleF structure.
      void exclude(Region region)
      Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.region.
      void intersect(GraphicsPath path)
      Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.graphicsPath.
      void intersect(Rectangle rect)
      Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.Rectangle structure.
      void intersect(RectangleF rect)
      Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.RectangleF structure.
      void intersect(Region region)
      Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.region.
      boolean isEmpty(Graphics g)
      Tests whether this com.aspose.imaging.Region has an empty interior on the specified drawing surface.
      boolean isEquals(Region region, Graphics g)
      Tests whether the specified com.aspose.imaging.Region is identical to this com.aspose.imaging.Region on the specified drawing surface.
      boolean isInfinite(Graphics g)
      Tests whether this com.aspose.imaging.Region has an infinite interior on the specified drawing surface.
      boolean isVisible(float x, float y)
      Tests whether the specified point is contained within this com.aspose.imaging.region.
      boolean isVisible(float x, float y, float width, float height)
      Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.region.
      boolean isVisible(float x, float y, float width, float height, Graphics g)
      Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      boolean isVisible(float x, float y, Graphics g)
      Tests whether the specified point is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      boolean isVisible(int x, int y, Graphics g)
      Tests whether the specified point is contained within this com.aspose.imaging.Region object when drawn using the specified com.aspose.imaging.Graphics object.
      boolean isVisible(int x, int y, int width, int height)
      Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.region.
      boolean isVisible(int x, int y, int width, int height, Graphics g)
      Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      boolean isVisible(Point point)
      Tests whether the specified com.aspose.imaging.Point structure is contained within this com.aspose.imaging.region.
      boolean isVisible(PointF point)
      Tests whether the specified com.aspose.imaging.PointF structure is contained within this com.aspose.imaging.region.
      boolean isVisible(PointF point, Graphics g)
      Tests whether the specified com.aspose.imaging.PointF structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      boolean isVisible(Point point, Graphics g)
      Tests whether the specified com.aspose.imaging.Point structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      boolean isVisible(Rectangle rect)
      Tests whether any portion of the specified com.aspose.imaging.Rectangle structure is contained within this com.aspose.imaging.region.
      boolean isVisible(RectangleF rect)
      Tests whether any portion of the specified com.aspose.imaging.RectangleF structure is contained within this com.aspose.imaging.region.
      boolean isVisible(RectangleF rect, Graphics g)
      Tests whether any portion of the specified com.aspose.imaging.RectangleF structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      boolean isVisible(Rectangle rect, Graphics g)
      Tests whether any portion of the specified com.aspose.imaging.Rectangle structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.
      void makeEmpty()
      Initializes this com.aspose.imaging.Region to an empty interior.
      void makeInfinite()
      Initializes this com.aspose.imaging.Region object to an infinite interior.
      void transform(Matrix matrix)
      Transforms this com.aspose.imaging.Region by the specified com.aspose.imaging.matrix.
      void translate(float dx, float dy)
      Offsets the coordinates of this com.aspose.imaging.Region by the specified amount.
      void translate(int dx, int dy)
      Offsets the coordinates of this com.aspose.imaging.Region by the specified amount.
      void union(GraphicsPath path)
      Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.graphicsPath.
      void union(Rectangle rect)
      Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.Rectangle structure.
      void union(RectangleF rect)
      Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.RectangleF structure.
      void union(Region region)
      Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.region.
      void xor(GraphicsPath path)
      Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.graphicsPath.
      void xor(Rectangle rect)
      Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.Rectangle structure.
      void xor(RectangleF rect)
      Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.RectangleF structure.
      void xor(Region region)
      Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.region.
    • Constructor Detail

      • Region

        public Region()

        Initializes a new T:Aspose.Imaging.Region.

      • Region

        public Region(RectangleF rect)

        Initializes a new T:Aspose.Imaging.Region from the specified T:Aspose.Imaging.RectangleF structure.

        Parameters:
        rect - A T:Aspose.Imaging.RectangleF structure that defines the interior of the new T:Aspose.Imaging.Region.
      • Region

        public Region(Rectangle rect)

        Initializes a new T:Aspose.Imaging.Region from the specified T:Aspose.Imaging.Rectangle structure.

        Parameters:
        rect - A T:Aspose.Imaging.Rectangle structure that defines the interior of the new T:Aspose.Imaging.Region.
      • Region

        public Region(GraphicsPath path)

        Initializes a new T:Aspose.Imaging.Region with the specified T:Aspose.Imaging.GraphicsPath.

        Parameters:
        path - A T:Aspose.Imaging.GraphicsPath that defines the new T:Aspose.Imaging.Region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - path is null.
    • Method Detail

      • deepClone

        public Region deepClone()

        Creates an exact deep copy of this com.aspose.imaging.region.

        Returns:
        The com.aspose.imaging.Region that this method creates.
      • makeInfinite

        public void makeInfinite()

        Initializes this com.aspose.imaging.Region object to an infinite interior.

      • makeEmpty

        public void makeEmpty()

        Initializes this com.aspose.imaging.Region to an empty interior.

      • intersect

        public void intersect(RectangleF rect)

        Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.RectangleF structure.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to intersect with this com.aspose.imaging.region.
      • intersect

        public void intersect(Rectangle rect)

        Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.Rectangle structure.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to intersect with this com.aspose.imaging.region.
      • intersect

        public void intersect(GraphicsPath path)

        Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.graphicsPath.

        Parameters:
        path - The com.aspose.imaging.GraphicsPath to intersect with this com.aspose.imaging.region.
      • intersect

        public void intersect(Region region)

        Updates this com.aspose.imaging.Region to the intersection of itself with the specified com.aspose.imaging.region.

        Parameters:
        region - The com.aspose.imaging.Region to intersect with this com.aspose.imaging.region.
      • union

        public void union(RectangleF rect)

        Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.RectangleF structure.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to unite with this com.aspose.imaging.region.
      • union

        public void union(Rectangle rect)

        Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.Rectangle structure.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to unite with this com.aspose.imaging.region.
      • union

        public void union(GraphicsPath path)

        Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.graphicsPath.

        Parameters:
        path - The com.aspose.imaging.GraphicsPath to unite with this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - path is null.
      • union

        public void union(Region region)

        Updates this com.aspose.imaging.Region to the union of itself and the specified com.aspose.imaging.region.

        Parameters:
        region - The com.aspose.imaging.Region to unite with this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - region is null.
      • xor

        public void xor(RectangleF rect)

        Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.RectangleF structure.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to xor with this com.aspose.imaging.region.
      • xor

        public void xor(Rectangle rect)

        Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.Rectangle structure.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to xor with this com.aspose.imaging.region.
      • xor

        public void xor(GraphicsPath path)

        Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.graphicsPath.

        Parameters:
        path - The com.aspose.imaging.GraphicsPath to xor with this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - path is null.
      • xor

        public void xor(Region region)

        Updates this com.aspose.imaging.Region to the union minus the intersection of itself with the specified com.aspose.imaging.region.

        Parameters:
        region - The com.aspose.imaging.Region to xor with this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - region is null.
      • exclude

        public void exclude(RectangleF rect)

        Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.RectangleF structure.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to exclude from this com.aspose.imaging.region.
      • exclude

        public void exclude(Rectangle rect)

        Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.Rectangle structure.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to exclude from this com.aspose.imaging.region.
      • exclude

        public void exclude(GraphicsPath path)

        Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.graphicsPath.

        Parameters:
        path - The com.aspose.imaging.GraphicsPath to exclude from this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - path is null.
      • exclude

        public void exclude(Region region)

        Updates this com.aspose.imaging.Region to contain only the portion of its interior that does not intersect with the specified com.aspose.imaging.region.

        Parameters:
        region - The com.aspose.imaging.Region to exclude from this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - region is null.
      • complement

        public void complement(RectangleF rect)

        Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.RectangleF structure that does not intersect with this com.aspose.imaging.region.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to complement this com.aspose.imaging.region.
      • complement

        public void complement(Rectangle rect)

        Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.Rectangle structure that does not intersect with this com.aspose.imaging.region.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to complement this com.aspose.imaging.region.
      • complement

        public void complement(GraphicsPath path)

        Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.GraphicsPath that does not intersect with this com.aspose.imaging.region.

        Parameters:
        path - The com.aspose.imaging.GraphicsPath to complement this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - path isnull.
      • complement

        public void complement(Region region)

        Updates this com.aspose.imaging.Region to contain the portion of the specified com.aspose.imaging.Region that does not intersect with this com.aspose.imaging.region.

        Parameters:
        region - The com.aspose.imaging.Region object to complement this com.aspose.imaging.Region object.
        Throws:
        com.aspose.ms.System.ArgumentNullException - region isnull.
      • translate

        public void translate(float dx,
                              float dy)

        Offsets the coordinates of this com.aspose.imaging.Region by the specified amount.

        Parameters:
        dx - The amount to offset this com.aspose.imaging.Region horizontally.
        dy - The amount to offset this com.aspose.imaging.Region vertically.
      • translate

        public void translate(int dx,
                              int dy)

        Offsets the coordinates of this com.aspose.imaging.Region by the specified amount.

        Parameters:
        dx - The amount to offset this com.aspose.imaging.Region horizontally.
        dy - The amount to offset this com.aspose.imaging.Region vertically.
      • transform

        public void transform(Matrix matrix)

        Transforms this com.aspose.imaging.Region by the specified com.aspose.imaging.matrix.

        Parameters:
        matrix - The com.aspose.imaging.Matrix by which to transform this com.aspose.imaging.region.
        Throws:
        com.aspose.ms.System.ArgumentNullException - matrix is null.
      • isEmpty

        public boolean isEmpty(Graphics g)

        Tests whether this com.aspose.imaging.Region has an empty interior on the specified drawing surface.

        Parameters:
        g - A com.aspose.imaging.Graphics that represents a drawing surface.
        Returns:
        true if the interior of this com.aspose.imaging.Region is empty when the transformation associated with g is applied; otherwise, false.
        Throws:
        com.aspose.ms.System.ArgumentNullException - g is null.
      • isInfinite

        public boolean isInfinite(Graphics g)

        Tests whether this com.aspose.imaging.Region has an infinite interior on the specified drawing surface.

        Parameters:
        g - A com.aspose.imaging.Graphics that represents a drawing surface.
        Returns:
        true if the interior of this com.aspose.imaging.Region is infinite when the transformation associated with g is applied; otherwise, false.
        Throws:
        com.aspose.ms.System.ArgumentNullException - g is null.
      • isEquals

        public boolean isEquals(Region region,
                                Graphics g)

        Tests whether the specified com.aspose.imaging.Region is identical to this com.aspose.imaging.Region on the specified drawing surface.

        Parameters:
        region - The com.aspose.imaging.Region to test.
        g - A com.aspose.imaging.Graphics that represents a drawing surface.
        Returns:
        True if the interior of region is identical to the interior of this region when the transformation associated with the g parameter is applied; otherwise, false.
        Throws:
        com.aspose.ms.System.ArgumentNullException - g orregion is null.
      • isVisible

        public boolean isVisible(float x,
                                 float y)

        Tests whether the specified point is contained within this com.aspose.imaging.region.

        Parameters:
        x - The x-coordinate of the point to test.
        y - The y-coordinate of the point to test.
        Returns:
        True when the specified point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(PointF point)

        Tests whether the specified com.aspose.imaging.PointF structure is contained within this com.aspose.imaging.region.

        Parameters:
        point - The com.aspose.imaging.PointF structure to test.
        Returns:
        true when point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(float x,
                                 float y,
                                 Graphics g)

        Tests whether the specified point is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        x - The x-coordinate of the point to test.
        y - The y-coordinate of the point to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        True when the specified point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(PointF point,
                                 Graphics g)

        Tests whether the specified com.aspose.imaging.PointF structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        point - The com.aspose.imaging.PointF structure to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(float x,
                                 float y,
                                 float width,
                                 float height)

        Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.region.

        Parameters:
        x - The x-coordinate of the upper-left corner of the rectangle to test.
        y - The y-coordinate of the upper-left corner of the rectangle to test.
        width - The width of the rectangle to test.
        height - The height of the rectangle to test.
        Returns:
        true when any portion of the specified rectangle is contained within this com.aspose.imaging.Region object; otherwise, false.
      • isVisible

        public boolean isVisible(RectangleF rect)

        Tests whether any portion of the specified com.aspose.imaging.RectangleF structure is contained within this com.aspose.imaging.region.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to test.
        Returns:
        true when any portion of rect is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(float x,
                                 float y,
                                 float width,
                                 float height,
                                 Graphics g)

        Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        x - The x-coordinate of the upper-left corner of the rectangle to test.
        y - The y-coordinate of the upper-left corner of the rectangle to test.
        width - The width of the rectangle to test.
        height - The height of the rectangle to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when any portion of the specified rectangle is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(RectangleF rect,
                                 Graphics g)

        Tests whether any portion of the specified com.aspose.imaging.RectangleF structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        rect - The com.aspose.imaging.RectangleF structure to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when rect is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(int x,
                                 int y,
                                 Graphics g)

        Tests whether the specified point is contained within this com.aspose.imaging.Region object when drawn using the specified com.aspose.imaging.Graphics object.

        Parameters:
        x - The x-coordinate of the point to test.
        y - The y-coordinate of the point to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when the specified point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(Point point)

        Tests whether the specified com.aspose.imaging.Point structure is contained within this com.aspose.imaging.region.

        Parameters:
        point - The com.aspose.imaging.Point structure to test.
        Returns:
        true when point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(Point point,
                                 Graphics g)

        Tests whether the specified com.aspose.imaging.Point structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        point - The com.aspose.imaging.Point structure to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when point is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(int x,
                                 int y,
                                 int width,
                                 int height)

        Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.region.

        Parameters:
        x - The x-coordinate of the upper-left corner of the rectangle to test.
        y - The y-coordinate of the upper-left corner of the rectangle to test.
        width - The width of the rectangle to test.
        height - The height of the rectangle to test.
        Returns:
        true when any portion of the specified rectangle is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(Rectangle rect)

        Tests whether any portion of the specified com.aspose.imaging.Rectangle structure is contained within this com.aspose.imaging.region.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to test.
        Returns:
        This method returns true when any portion of rect is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(int x,
                                 int y,
                                 int width,
                                 int height,
                                 Graphics g)

        Tests whether any portion of the specified rectangle is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        x - The x-coordinate of the upper-left corner of the rectangle to test.
        y - The y-coordinate of the upper-left corner of the rectangle to test.
        width - The width of the rectangle to test.
        height - The height of the rectangle to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when any portion of the specified rectangle is contained within this com.aspose.imaging.Region; otherwise, false.
      • isVisible

        public boolean isVisible(Rectangle rect,
                                 Graphics g)

        Tests whether any portion of the specified com.aspose.imaging.Rectangle structure is contained within this com.aspose.imaging.Region when drawn using the specified com.aspose.imaging.graphics.

        Parameters:
        rect - The com.aspose.imaging.Rectangle structure to test.
        g - A com.aspose.imaging.Graphics that represents a graphics context.
        Returns:
        true when any portion of the rect is contained within this com.aspose.imaging.Region; otherwise, false.