Instances of this class represent areas of an x-y coordinate system that are aggregates of the areas covered by a number of polygons.
Application code must explicitly invoke the Region.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.
| field | type | note |
|---|---|---|
| handle | long | the OS resource for the region
(Warning: This field is platform dependent)
IMPORTANT: This field is not 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. |
<init>()Constructs a new empty region.
You must dispose the region when it is no longer required.
| SWTError |
|
|
Constructs a new empty region.
You must dispose the region when it is no longer required.
| name | type | description |
|---|---|---|
| device | org.eclipse.swt.graphics.Device | the device on which to allocate the region |
| IllegalArgumentException |
|
|
| SWTError |
|
|
cocoa_new(org.eclipse.swt.graphics.Device device, long handle)Invokes platform specific functionality to allocate a new region.
IMPORTANT: This method is not part of the public
API for Region. 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 called from
application code.
| name | type | description |
|---|---|---|
| device | org.eclipse.swt.graphics.Device | the device on which to allocate the region |
| handle | long | the handle for the region |
Returns: a new region object containing the specified device and handle
add(int[] pointArray)Adds the given polygon to the collection of polygons the receiver maintains to describe its area.
| name | type | description |
|---|---|---|
| point_array | int[] | points that describe the polygon to merge with the receiver |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Adds the given rectangle to the collection of polygons the receiver maintains to describe its area.
| name | type | description |
|---|---|---|
| rect | org.eclipse.swt.graphics.Rectangle | the rectangle to merge with the receiver |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the rectangle |
| y | int | the y coordinate of the rectangle |
| width | int | the width coordinate of the rectangle |
| height | int | the height coordinate of the rectangle |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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.
| name | type | description |
|---|---|---|
| region | org.eclipse.swt.graphics.Region | the region to merge |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Returns a rectangle which represents the rectangular union of the collection of polygons the receiver maintains to describe its area.
Returns: a bounding rectangle for the region
| SWTException |
|
|
contains(int x, int y)Returns true if the point specified by the
arguments is inside the area specified by the receiver,
and false otherwise.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the point to test for containment |
| y | int | the y coordinate of the point to test for containment |
Returns: true if the region contains the point and false otherwise
| SWTException |
|
|
Returns true if the given point is inside the
area specified by the receiver, and false
otherwise.
| name | type | description |
|---|---|---|
| pt | org.eclipse.swt.graphics.Point | the point to test for containment |
Returns: true if the region contains the point and false otherwise
| IllegalArgumentException |
|
|
| SWTException |
|
|
isDisposed() · also: is_disposedReturns true if the region has been disposed,
and false otherwise.
This method gets the dispose state for the region.
When a region has been disposed, it is an error to
invoke any other method (except #dispose()) using the region.
Returns: true when the region is disposed, and false otherwise
isEmpty() · also: is_emptyReturns true if the receiver does not cover any
area in the (x, y) coordinate plane, and false if
the receiver does cover some area in the plane.
Returns: true if the receiver is empty, and false otherwise
| SWTException |
|
|
equals(Object object)Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
| name | type | description |
|---|---|---|
| object | Object | the object to compare with this object |
Returns: true if the object is the same as this object and false otherwise
hashCode()Returns an integer hash code for the receiver. Any two
objects that return true when passed to
equals must return the same value for this
method.
Returns: the receiver's hash
Intersects the given rectangle to the collection of polygons the receiver maintains to describe its area.
| name | type | description |
|---|---|---|
| rect | org.eclipse.swt.graphics.Rectangle | the rectangle to intersect with the receiver |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the rectangle |
| y | int | the y coordinate of the rectangle |
| width | int | the width coordinate of the rectangle |
| height | int | the height coordinate of the rectangle |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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.
| name | type | description |
|---|---|---|
| region | org.eclipse.swt.graphics.Region | the region to intersect |
| IllegalArgumentException |
|
|
| SWTException |
|
|
intersects(int x, int y, int width, int height)Returns true if the rectangle described by the
arguments intersects with any of the polygons the receiver
maintains to describe its area, and false otherwise.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the origin of the rectangle |
| y | int | the y coordinate of the origin of the rectangle |
| width | int | the width of the rectangle |
| height | int | the height of the rectangle |
Returns: true if the rectangle intersects with the receiver, and false otherwise
| SWTException |
|
|
Returns true if the given rectangle intersects
with any of the polygons the receiver maintains to describe
its area and false otherwise.
| name | type | description |
|---|---|---|
| rect | org.eclipse.swt.graphics.Rectangle | the rectangle to test for intersection |
Returns: true if the rectangle intersects with the receiver, and false otherwise
| IllegalArgumentException |
|
|
| SWTException |
|
|
subtract(int[] pointArray)Subtracts the given polygon from the collection of polygons the receiver maintains to describe its area.
| name | type | description |
|---|---|---|
| point_array | int[] | points that describe the polygon to merge with the receiver |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Subtracts the given rectangle from the collection of polygons the receiver maintains to describe its area.
| name | type | description |
|---|---|---|
| rect | org.eclipse.swt.graphics.Rectangle | the rectangle to subtract from the receiver |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the rectangle |
| y | int | the y coordinate of the rectangle |
| width | int | the width coordinate of the rectangle |
| height | int | the height coordinate of the rectangle |
| IllegalArgumentException |
|
|
| SWTException |
|
|
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.
| name | type | description |
|---|---|---|
| region | org.eclipse.swt.graphics.Region | the region to subtract |
| IllegalArgumentException |
|
|
| SWTException |
|
|
toString()Returns a string containing a concise, human-readable description of the receiver.
Returns: a string representation of the receiver
translate(int x, int y)Translate all of the polygons the receiver maintains to describe its area by the specified point.
| name | type | description |
|---|---|---|
| x | int | the x coordinate of the point to translate |
| y | int | the y coordinate of the point to translate |
| SWTException |
|
|
Translate all of the polygons the receiver maintains to describe its area by the specified point.
| name | type | description |
|---|---|---|
| pt | org.eclipse.swt.graphics.Point | the point to translate |
| IllegalArgumentException |
|
|
| SWTException |
|
|
Returns the Device where this resource was
created.
Returns: Device the device of the receiver
dispose()Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate. This method does nothing if the resource is already disposed.