Region

Instances of this class represent areas of an x-y coordinate system that are aggregates of the areas covered by a number of polygons. <p> Application code must explicitly invoke the <code>Region.dispose()</code> method to release the operating system resources managed by each instance when those instances are no longer required. </p>

@see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: GraphicsExample</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

Constructors

this
this()

Constructs a new empty region.

this
this(Device device)

Constructs a new empty region. <p> You must dispose the region when it is no longer required. </p>

Members

Functions

add
void add(int[] pointArray)

Adds the given polygon to the collection of polygons the receiver maintains to describe its area.

add
void add(Rectangle rect)

Adds the given rectangle to the collection of polygons the receiver maintains to describe its area.

add
void add(int x, int y, int width, int height)

Adds the given rectangle to the collection of polygons the receiver maintains to describe its area.

add
void add(Region region)

Adds all of the polygons which make up the area covered by the argument to the collection of polygons the receiver maintains to describe its area.

contains
bool contains(int x, int y)

Returns <code>true</code> if the point specified by the arguments is inside the area specified by the receiver, and <code>false</code> otherwise.

contains
bool contains(Point pt)

Returns <code>true</code> if the given point is inside the area specified by the receiver, and <code>false</code> otherwise.

getBounds
Rectangle getBounds()

Returns a rectangle which represents the rectangular union of the collection of polygons the receiver maintains to describe its area.

intersect
void intersect(Rectangle rect)

Intersects the given rectangle to the collection of polygons the receiver maintains to describe its area.

intersect
void intersect(int x, int y, int width, int height)

Intersects the given rectangle to the collection of polygons the receiver maintains to describe its area.

intersect
void intersect(Region region)

Intersects all of the polygons which make up the area covered by the argument to the collection of polygons the receiver maintains to describe its area.

intersects
bool intersects(int x, int y, int width, int height)

Returns <code>true</code> if the rectangle described by the arguments intersects with any of the polygons the receiver maintains to describe its area, and <code>false</code> otherwise.

intersects
bool intersects(Rectangle rect)

Returns <code>true</code> if the given rectangle intersects with any of the polygons the receiver maintains to describe its area and <code>false</code> otherwise.

isDisposed
bool isDisposed()

Returns <code>true</code> if the region has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the region. When a region has been disposed, it is an error to invoke any other method using the region.

isEmpty
bool isEmpty()

Returns <code>true</code> if the receiver does not cover any area in the (x, y) coordinate plane, and <code>false</code> if the receiver does cover some area in the plane.

opEquals
equals_t opEquals(Object object)

Compares the argument to the receiver, and returns true if they represent the <em>same</em> object using a class specific comparison.

subtract
void subtract(int[] pointArray)

Subtracts the given polygon from the collection of polygons the receiver maintains to describe its area.

subtract
void subtract(Rectangle rect)

Subtracts the given rectangle from the collection of polygons the receiver maintains to describe its area.

subtract
void subtract(int x, int y, int width, int height)

Subtracts the given rectangle from the collection of polygons the receiver maintains to describe its area.

subtract
void subtract(Region region)

Subtracts all of the polygons which make up the area covered by the argument from the collection of polygons the receiver maintains to describe its area.

toHash
hash_t toHash()

Returns an integer hash code for the receiver. Any two objects that return <code>true</code> when passed to <code>equals</code> must return the same value for this method.

toString
String toString()

Returns a string containing a concise, human-readable description of the receiver.

translate
void translate(int x, int y)

Translate all of the polygons the receiver maintains to describe its area by the specified point.

translate
void translate(Point pt)

Translate all of the polygons the receiver maintains to describe its area by the specified point.

Variables

handle
GdkRegion* handle;

the OS resource for the region (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. </p>

Inherited Members

From Resource

device
Device device;

the device where this resource was created

dispose
void dispose()

Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate.

getDevice
Device getDevice()

Returns the <code>Device</code> where this resource was created.

isDisposed
bool isDisposed()

Returns <code>true</code> if the resource has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the resource. When a resource has been disposed, it is an error to invoke any other method using the resource.

Meta