Class Region

Class Region

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)

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

[JsonObject(MemberSerialization.OptIn)]
public sealed class Region

Inheritance

objectRegion

Inherited Members

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

Region()

Initializes a new Aspose.Imaging.Region.

public Region()

Region(RectangleF)

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

public Region(RectangleF rect)

Parameters

rect RectangleF

A Aspose.Imaging.RectangleF structure that defines the interior of the new Aspose.Imaging.Region.

Region(Rectangle)

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

public Region(Rectangle rect)

Parameters

rect Rectangle

A Aspose.Imaging.Rectangle structure that defines the interior of the new Aspose.Imaging.Region.

Region(GraphicsPath)

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

public Region(GraphicsPath path)

Parameters

path GraphicsPath

A Aspose.Imaging.GraphicsPath that defines the new Aspose.Imaging.Region.

Exceptions

ArgumentNullException

path is null.

Methods

Complement(RectangleF)

Updates this Aspose.Imaging.Region to contain the portion of the specified Aspose.Imaging.RectangleF structure that does not intersect with this Aspose.Imaging.Region.

public void Complement(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to complement this Aspose.Imaging.Region.

Complement(Rectangle)

Updates this Aspose.Imaging.Region to contain the portion of the specified Aspose.Imaging.Rectangle structure that does not intersect with this Aspose.Imaging.Region.

public void Complement(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to complement this Aspose.Imaging.Region.

Complement(GraphicsPath)

Updates this Aspose.Imaging.Region to contain the portion of the specified Aspose.Imaging.GraphicsPath that does not intersect with this Aspose.Imaging.Region.

public void Complement(GraphicsPath path)

Parameters

path GraphicsPath

The Aspose.Imaging.GraphicsPath to complement this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

path isnull.

Complement(Region)

Updates this Aspose.Imaging.Region to contain the portion of the specified Aspose.Imaging.Region that does not intersect with this Aspose.Imaging.Region.

public void Complement(Region region)

Parameters

region Region

The Aspose.Imaging.Region object to complement this Aspose.Imaging.Region object.

Exceptions

ArgumentNullException

region isnull.

DeepClone()

Creates an exact deep copy of this Aspose.Imaging.Region.

public Region DeepClone()

Returns

Region

The Aspose.Imaging.Region that this method creates.

Equals(object)

Check if objects are equal.

public override bool Equals(object obj)

Parameters

obj object

The other object.

Returns

bool

The equality comparison result.

Equals(Region, Graphics)

Tests whether the specified Aspose.Imaging.Region is identical to this Aspose.Imaging.Region on the specified drawing surface.

public bool Equals(Region region, Graphics g)

Parameters

region Region

The Aspose.Imaging.Region to test.

g Graphics

A Aspose.Imaging.Graphics that represents a drawing surface.

Returns

bool

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.

Exceptions

ArgumentNullException

g or region is null.

Exclude(RectangleF)

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

public void Exclude(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to exclude from this Aspose.Imaging.Region.

Exclude(Rectangle)

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

public void Exclude(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to exclude from this Aspose.Imaging.Region.

Exclude(GraphicsPath)

Updates this Aspose.Imaging.Region to contain only the portion of its interior that does not intersect with the specified Aspose.Imaging.GraphicsPath.

public void Exclude(GraphicsPath path)

Parameters

path GraphicsPath

The Aspose.Imaging.GraphicsPath to exclude from this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

path is null.

Exclude(Region)

Updates this Aspose.Imaging.Region to contain only the portion of its interior that does not intersect with the specified Aspose.Imaging.Region.

public void Exclude(Region region)

Parameters

region Region

The Aspose.Imaging.Region to exclude from this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

region is null.

GetHashCode()

Get hash code of the current object.

public override int GetHashCode()

Returns

int

The hash code.

Intersect(RectangleF)

Updates this Aspose.Imaging.Region to the intersection of itself with the specified Aspose.Imaging.RectangleF structure.

public void Intersect(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to intersect with this Aspose.Imaging.Region.

Intersect(Rectangle)

Updates this Aspose.Imaging.Region to the intersection of itself with the specified Aspose.Imaging.Rectangle structure.

public void Intersect(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to intersect with this Aspose.Imaging.Region.

Intersect(GraphicsPath)

Updates this Aspose.Imaging.Region to the intersection of itself with the specified Aspose.Imaging.GraphicsPath.

public void Intersect(GraphicsPath path)

Parameters

path GraphicsPath

The Aspose.Imaging.GraphicsPath to intersect with this Aspose.Imaging.Region.

Intersect(Region)

Updates this Aspose.Imaging.Region to the intersection of itself with the specified Aspose.Imaging.Region.

public void Intersect(Region region)

Parameters

region Region

The Aspose.Imaging.Region to intersect with this Aspose.Imaging.Region.

IsEmpty(Graphics)

Tests whether this Aspose.Imaging.Region has an empty interior on the specified drawing surface.

public bool IsEmpty(Graphics g)

Parameters

g Graphics

A Aspose.Imaging.Graphics that represents a drawing surface.

Returns

bool

true if the interior of this Aspose.Imaging.Region is empty when the transformation associated with g is applied; otherwise, false.

Exceptions

ArgumentNullException

g is null.

IsInfinite(Graphics)

Tests whether this Aspose.Imaging.Region has an infinite interior on the specified drawing surface.

public bool IsInfinite(Graphics g)

Parameters

g Graphics

A Aspose.Imaging.Graphics that represents a drawing surface.

Returns

bool

true if the interior of this Aspose.Imaging.Region is infinite when the transformation associated with g is applied; otherwise, false.

Exceptions

ArgumentNullException

g is null.

IsVisible(float, float)

Tests whether the specified point is contained within this Aspose.Imaging.Region.

public bool IsVisible(float x, float y)

Parameters

x float

The x-coordinate of the point to test.

y float

The y-coordinate of the point to test.

Returns

bool

True when the specified point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(PointF)

Tests whether the specified Aspose.Imaging.PointF structure is contained within this Aspose.Imaging.Region.

public bool IsVisible(PointF point)

Parameters

point PointF

The Aspose.Imaging.PointF structure to test.

Returns

bool

true when point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(float, float, Graphics)

Tests whether the specified point is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(float x, float y, Graphics g)

Parameters

x float

The x-coordinate of the point to test.

y float

The y-coordinate of the point to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

True when the specified point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(PointF, Graphics)

Tests whether the specified Aspose.Imaging.PointF structure is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(PointF point, Graphics g)

Parameters

point PointF

The Aspose.Imaging.PointF structure to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(float, float, float, float)

Tests whether any portion of the specified rectangle is contained within this Aspose.Imaging.Region.

public bool IsVisible(float x, float y, float width, float height)

Parameters

x float

The x-coordinate of the upper-left corner of the rectangle to test.

y float

The y-coordinate of the upper-left corner of the rectangle to test.

width float

The width of the rectangle to test.

height float

The height of the rectangle to test.

Returns

bool

true when any portion of the specified rectangle is contained within this Aspose.Imaging.Region object; otherwise, false.

IsVisible(RectangleF)

Tests whether any portion of the specified Aspose.Imaging.RectangleF structure is contained within this Aspose.Imaging.Region.

public bool IsVisible(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to test.

Returns

bool

true when any portion of rect is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(float, float, float, float, Graphics)

Tests whether any portion of the specified rectangle is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(float x, float y, float width, float height, Graphics g)

Parameters

x float

The x-coordinate of the upper-left corner of the rectangle to test.

y float

The y-coordinate of the upper-left corner of the rectangle to test.

width float

The width of the rectangle to test.

height float

The height of the rectangle to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when any portion of the specified rectangle is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(RectangleF, Graphics)

Tests whether any portion of the specified Aspose.Imaging.RectangleF structure is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(RectangleF rect, Graphics g)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when rect is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(int, int, Graphics)

Tests whether the specified point is contained within this Aspose.Imaging.Region object when drawn using the specified Aspose.Imaging.Graphics object.

public bool IsVisible(int x, int y, Graphics g)

Parameters

x int

The x-coordinate of the point to test.

y int

The y-coordinate of the point to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when the specified point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(Point)

Tests whether the specified Aspose.Imaging.Point structure is contained within this Aspose.Imaging.Region.

public bool IsVisible(Point point)

Parameters

point Point

The Aspose.Imaging.Point structure to test.

Returns

bool

true when point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(Point, Graphics)

Tests whether the specified Aspose.Imaging.Point structure is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(Point point, Graphics g)

Parameters

point Point

The Aspose.Imaging.Point structure to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when point is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(int, int, int, int)

Tests whether any portion of the specified rectangle is contained within this Aspose.Imaging.Region.

public bool IsVisible(int x, int y, int width, int height)

Parameters

x int

The x-coordinate of the upper-left corner of the rectangle to test.

y int

The y-coordinate of the upper-left corner of the rectangle to test.

width int

The width of the rectangle to test.

height int

The height of the rectangle to test.

Returns

bool

true when any portion of the specified rectangle is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(Rectangle)

Tests whether any portion of the specified Aspose.Imaging.Rectangle structure is contained within this Aspose.Imaging.Region.

public bool IsVisible(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to test.

Returns

bool

This method returns true when any portion of rect is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(int, int, int, int, Graphics)

Tests whether any portion of the specified rectangle is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(int x, int y, int width, int height, Graphics g)

Parameters

x int

The x-coordinate of the upper-left corner of the rectangle to test.

y int

The y-coordinate of the upper-left corner of the rectangle to test.

width int

The width of the rectangle to test.

height int

The height of the rectangle to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when any portion of the specified rectangle is contained within this Aspose.Imaging.Region; otherwise, false.

IsVisible(Rectangle, Graphics)

Tests whether any portion of the specified Aspose.Imaging.Rectangle structure is contained within this Aspose.Imaging.Region when drawn using the specified Aspose.Imaging.Graphics.

public bool IsVisible(Rectangle rect, Graphics g)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to test.

g Graphics

A Aspose.Imaging.Graphics that represents a graphics context.

Returns

bool

true when any portion of the rect is contained within this Aspose.Imaging.Region; otherwise, false.

MakeEmpty()

Initializes this Aspose.Imaging.Region to an empty interior.

public void MakeEmpty()

MakeInfinite()

Initializes this Aspose.Imaging.Region object to an infinite interior.

public void MakeInfinite()

Transform(Matrix)

Transforms this Aspose.Imaging.Region by the specified Aspose.Imaging.Matrix.

public void Transform(Matrix matrix)

Parameters

matrix Matrix

The Aspose.Imaging.Matrix by which to transform this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

matrix is null.

Translate(float, float)

Offsets the coordinates of this Aspose.Imaging.Region by the specified amount.

public void Translate(float dx, float dy)

Parameters

dx float

The amount to offset this Aspose.Imaging.Region horizontally.

dy float

The amount to offset this Aspose.Imaging.Region vertically.

Translate(int, int)

Offsets the coordinates of this Aspose.Imaging.Region by the specified amount.

public void Translate(int dx, int dy)

Parameters

dx int

The amount to offset this Aspose.Imaging.Region horizontally.

dy int

The amount to offset this Aspose.Imaging.Region vertically.

Union(RectangleF)

Updates this Aspose.Imaging.Region to the union of itself and the specified Aspose.Imaging.RectangleF structure.

public void Union(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to unite with this Aspose.Imaging.Region.

Union(Rectangle)

Updates this Aspose.Imaging.Region to the union of itself and the specified Aspose.Imaging.Rectangle structure.

public void Union(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to unite with this Aspose.Imaging.Region.

Union(GraphicsPath)

Updates this Aspose.Imaging.Region to the union of itself and the specified Aspose.Imaging.GraphicsPath.

public void Union(GraphicsPath path)

Parameters

path GraphicsPath

The Aspose.Imaging.GraphicsPath to unite with this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

path is null.

Union(Region)

Updates this Aspose.Imaging.Region to the union of itself and the specified Aspose.Imaging.Region.

public void Union(Region region)

Parameters

region Region

The Aspose.Imaging.Region to unite with this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

region is null.

Xor(RectangleF)

Updates this Aspose.Imaging.Region to the union minus the intersection of itself with the specified Aspose.Imaging.RectangleF structure.

public void Xor(RectangleF rect)

Parameters

rect RectangleF

The Aspose.Imaging.RectangleF structure to xor with this Aspose.Imaging.Region.

Xor(Rectangle)

Updates this Aspose.Imaging.Region to the union minus the intersection of itself with the specified Aspose.Imaging.Rectangle structure.

public void Xor(Rectangle rect)

Parameters

rect Rectangle

The Aspose.Imaging.Rectangle structure to xor with this Aspose.Imaging.Region.

Xor(GraphicsPath)

Updates this Aspose.Imaging.Region to the union minus the intersection of itself with the specified Aspose.Imaging.GraphicsPath.

public void Xor(GraphicsPath path)

Parameters

path GraphicsPath

The Aspose.Imaging.GraphicsPath to xor with this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

path is null.

Xor(Region)

Updates this Aspose.Imaging.Region to the union minus the intersection of itself with the specified Aspose.Imaging.Region.

public void Xor(Region region)

Parameters

region Region

The Aspose.Imaging.Region to xor with this Aspose.Imaging.Region.

Exceptions

ArgumentNullException

region is null.