Table of Contents

Class Region

Namespace
Aspose.Imaging
Assembly
Aspose.Imaging.dll

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

public sealed class Region
Inheritance
Region
Inherited Members

Constructors

Region()

Initializes a new Region.

public Region()

Region(GraphicsPath)

Initializes a new Region with the specified GraphicsPath.

public Region(GraphicsPath path)

Parameters

path GraphicsPath

A GraphicsPath that defines the new Region.

Exceptions

ArgumentNullException

path is null.

Region(Rectangle)

Initializes a new Region from the specified Rectangle structure.

public Region(Rectangle rect)

Parameters

rect Rectangle

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

Region(RectangleF)

Initializes a new Region from the specified RectangleF structure.

public Region(RectangleF rect)

Parameters

rect RectangleF

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

Methods

Complement(GraphicsPath)

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

public void Complement(GraphicsPath path)

Parameters

path GraphicsPath

The GraphicsPath to complement this Region.

Exceptions

ArgumentNullException

path isnull.

Complement(Rectangle)

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

public void Complement(Rectangle rect)

Parameters

rect Rectangle

The Rectangle structure to complement this Region.

Complement(RectangleF)

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

public void Complement(RectangleF rect)

Parameters

rect RectangleF

The RectangleF structure to complement this Region.

Complement(Region)

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

public void Complement(Region region)

Parameters

region Region

The Region object to complement this Region object.

Exceptions

ArgumentNullException

region isnull.

DeepClone()

Creates an exact deep copy of this Region.

public Region DeepClone()

Returns

Region

The Region that this method creates.

Equals(Region, Graphics)

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

public bool Equals(Region region, Graphics g)

Parameters

region Region

The Region to test.

g Graphics

A 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.

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.

Exclude(GraphicsPath)

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

public void Exclude(GraphicsPath path)

Parameters

path GraphicsPath

The GraphicsPath to exclude from this Region.

Exceptions

ArgumentNullException

path is null.

Exclude(Rectangle)

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

public void Exclude(Rectangle rect)

Parameters

rect Rectangle

The Rectangle structure to exclude from this Region.

Exclude(RectangleF)

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

public void Exclude(RectangleF rect)

Parameters

rect RectangleF

The RectangleF structure to exclude from this Region.

Exclude(Region)

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

public void Exclude(Region region)

Parameters

region Region

The Region to exclude from this Region.

Exceptions

ArgumentNullException

region is null.

GetHashCode()

Get hash code of the current object.

public override int GetHashCode()

Returns

int

The hash code.

Intersect(GraphicsPath)

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

public void Intersect(GraphicsPath path)

Parameters

path GraphicsPath

The GraphicsPath to intersect with this Region.

Intersect(Rectangle)

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

public void Intersect(Rectangle rect)

Parameters

rect Rectangle

The Rectangle structure to intersect with this Region.

Intersect(RectangleF)

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

public void Intersect(RectangleF rect)

Parameters

rect RectangleF

The RectangleF structure to intersect with this Region.

Intersect(Region)

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

public void Intersect(Region region)

Parameters

region Region

The Region to intersect with this Region.

IsEmpty(Graphics)

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

public bool IsEmpty(Graphics g)

Parameters

g Graphics

A Graphics that represents a drawing surface.

Returns

bool

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

Exceptions

ArgumentNullException

g is null.

IsInfinite(Graphics)

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

public bool IsInfinite(Graphics g)

Parameters

g Graphics

A Graphics that represents a drawing surface.

Returns

bool

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

Exceptions

ArgumentNullException

g is null.

IsVisible(Point)

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

public bool IsVisible(Point point)

Parameters

point Point

The Point structure to test.

Returns

bool

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

IsVisible(Point, Graphics)

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

public bool IsVisible(Point point, Graphics g)

Parameters

point Point

The Point structure to test.

g Graphics

A Graphics that represents a graphics context.

Returns

bool

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

IsVisible(PointF)

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

public bool IsVisible(PointF point)

Parameters

point PointF

The PointF structure to test.

Returns

bool

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

IsVisible(PointF, Graphics)

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

public bool IsVisible(PointF point, Graphics g)

Parameters

point PointF

The PointF structure to test.

g Graphics

A Graphics that represents a graphics context.

Returns

bool

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

IsVisible(Rectangle)

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

public bool IsVisible(Rectangle rect)

Parameters

rect Rectangle

The Rectangle structure to test.

Returns

bool

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

IsVisible(Rectangle, Graphics)

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

public bool IsVisible(Rectangle rect, Graphics g)

Parameters

rect Rectangle

The Rectangle structure to test.

g Graphics

A Graphics that represents a graphics context.

Returns

bool

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

IsVisible(RectangleF)

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

public bool IsVisible(RectangleF rect)

Parameters

rect RectangleF

The RectangleF structure to test.

Returns

bool

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

IsVisible(RectangleF, Graphics)

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

public bool IsVisible(RectangleF rect, Graphics g)

Parameters

rect RectangleF

The RectangleF structure to test.

g Graphics

A Graphics that represents a graphics context.

Returns

bool

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

IsVisible(int, int, Graphics)

Tests whether the specified point is contained within this Region object when drawn using the specified 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 Graphics that represents a graphics context.

Returns

bool

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

IsVisible(int, int, int, int)

Tests whether any portion of the specified rectangle is contained within this 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 Region; otherwise, false.

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

Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified 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 Graphics that represents a graphics context.

Returns

bool

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

IsVisible(float, float)

Tests whether the specified point is contained within this 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 Region; otherwise, false.

IsVisible(float, float, Graphics)

Tests whether the specified point is contained within this Region when drawn using the specified 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 Graphics that represents a graphics context.

Returns

bool

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

IsVisible(float, float, float, float)

Tests whether any portion of the specified rectangle is contained within this 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 Region object; otherwise, false.

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

Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified 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 Graphics that represents a graphics context.

Returns

bool

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

MakeEmpty()

Initializes this Region to an empty interior.

public void MakeEmpty()

MakeInfinite()

Initializes this Region object to an infinite interior.

public void MakeInfinite()

Transform(Matrix)

Transforms this Region by the specified Matrix.

public void Transform(Matrix matrix)

Parameters

matrix Matrix

The Matrix by which to transform this Region.

Exceptions

ArgumentNullException

matrix is null.

Translate(int, int)

Offsets the coordinates of this Region by the specified amount.

public void Translate(int dx, int dy)

Parameters

dx int

The amount to offset this Region horizontally.

dy int

The amount to offset this Region vertically.

Translate(float, float)

Offsets the coordinates of this Region by the specified amount.

public void Translate(float dx, float dy)

Parameters

dx float

The amount to offset this Region horizontally.

dy float

The amount to offset this Region vertically.

Union(GraphicsPath)

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

public void Union(GraphicsPath path)

Parameters

path GraphicsPath

The GraphicsPath to unite with this Region.

Exceptions

ArgumentNullException

path is null.

Union(Rectangle)

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

public void Union(Rectangle rect)

Parameters

rect Rectangle

The Rectangle structure to unite with this Region.

Union(RectangleF)

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

public void Union(RectangleF rect)

Parameters

rect RectangleF

The RectangleF structure to unite with this Region.

Union(Region)

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

public void Union(Region region)

Parameters

region Region

The Region to unite with this Region.

Exceptions

ArgumentNullException

region is null.

Xor(GraphicsPath)

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

public void Xor(GraphicsPath path)

Parameters

path GraphicsPath

The GraphicsPath to xor with this Region.

Exceptions

ArgumentNullException

path is null.

Xor(Rectangle)

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

public void Xor(Rectangle rect)

Parameters

rect Rectangle

The Rectangle structure to xor with this Region.

Xor(RectangleF)

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

public void Xor(RectangleF rect)

Parameters

rect RectangleF

The RectangleF structure to xor with this Region.

Xor(Region)

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

public void Xor(Region region)

Parameters

region Region

The Region to xor with this Region.

Exceptions

ArgumentNullException

region is null.