|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.graphics.Resource
org.eclipse.swt.graphics.Region
public final class 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.
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 Summary | |
---|---|
long |
handle
the OS resource for the region (Warning: This field is platform dependent) |
Constructor Summary | |
---|---|
Region()
Constructs a new empty region. |
|
Region(Device device)
Constructs a new empty region. |
Method Summary | |
---|---|
void |
add(int[] pointArray)
Adds the given polygon to the collection of polygons the receiver maintains to describe its area. |
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. |
void |
add(Rectangle rect)
Adds the given rectangle to the collection of polygons the receiver maintains to describe its area. |
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. |
boolean |
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. |
boolean |
contains(Point pt)
Returns true if the given point is inside the
area specified by the receiver, and false
otherwise. |
boolean |
equals(java.lang.Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. |
Rectangle |
getBounds()
Returns a rectangle which represents the rectangular union of the collection of polygons the receiver maintains to describe its area. |
static Region |
gtk_new(Device device,
long handle)
|
int |
hashCode()
Returns an integer hash code for the receiver. |
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. |
void |
intersect(Rectangle rect)
Intersects the given rectangle to the collection of polygons the receiver maintains to describe its area. |
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. |
boolean |
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. |
boolean |
intersects(Rectangle rect)
Returns true if the given rectangle intersects
with any of the polygons the receiver maintains to describe
its area and false otherwise. |
boolean |
isDisposed()
Returns true if the region has been disposed,
and false otherwise. |
boolean |
isEmpty()
Returns 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. |
void |
subtract(int[] pointArray)
Subtracts the given polygon from the collection of polygons the receiver maintains to describe its area. |
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. |
void |
subtract(Rectangle rect)
Subtracts the given rectangle from the collection of polygons the receiver maintains to describe its area. |
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. |
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
void |
translate(int x,
int y)
Translate all of the polygons the receiver maintains to describe its area by the specified point. |
void |
translate(Point pt)
Translate all of the polygons the receiver maintains to describe its area by the specified point. |
Methods inherited from class org.eclipse.swt.graphics.Resource |
---|
dispose, getDevice |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public long handle
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.
Constructor Detail |
---|
public Region()
SWTError
- public Region(Device device)
You must dispose the region when it is no longer required.
device
- the device on which to allocate the region
java.lang.IllegalArgumentException
- SWTError
- Resource.dispose()
Method Detail |
---|
public void add(int[] pointArray)
pointArray
- points that describe the polygon to merge with the receiver
java.lang.IllegalArgumentException
- SWTException
- public void add(Rectangle rect)
rect
- the rectangle to merge with the receiver
java.lang.IllegalArgumentException
- SWTException
- public void add(int x, int y, int width, int height)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width coordinate of the rectangleheight
- the height coordinate of the rectangle
java.lang.IllegalArgumentException
- SWTException
- public void add(Region region)
region
- the region to merge
java.lang.IllegalArgumentException
- SWTException
- public boolean contains(int x, int y)
true
if the point specified by the
arguments is inside the area specified by the receiver,
and false
otherwise.
x
- the x coordinate of the point to test for containmenty
- the y coordinate of the point to test for containment
true
if the region contains the point and false
otherwise
SWTException
- public boolean contains(Point pt)
true
if the given point is inside the
area specified by the receiver, and false
otherwise.
pt
- the point to test for containment
true
if the region contains the point and false
otherwise
java.lang.IllegalArgumentException
- SWTException
- public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the object to compare with this object
true
if the object is the same as this object and false
otherwisehashCode()
public Rectangle getBounds()
SWTException
- Rectangle.union(org.eclipse.swt.graphics.Rectangle)
public static Region gtk_new(Device device, long handle)
public int hashCode()
true
when passed to
equals
must return the same value for this
method.
hashCode
in class java.lang.Object
equals(java.lang.Object)
public void intersect(Rectangle rect)
rect
- the rectangle to intersect with the receiver
java.lang.IllegalArgumentException
- SWTException
- public void intersect(int x, int y, int width, int height)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width coordinate of the rectangleheight
- the height coordinate of the rectangle
java.lang.IllegalArgumentException
- SWTException
- public void intersect(Region region)
region
- the region to intersect
java.lang.IllegalArgumentException
- SWTException
- public boolean intersects(int x, int y, int width, int height)
true
if the rectangle described by the
arguments intersects with any of the polygons the receiver
maintains to describe its area, and false
otherwise.
x
- the x coordinate of the origin of the rectangley
- the y coordinate of the origin of the rectanglewidth
- the width of the rectangleheight
- the height of the rectangle
true
if the rectangle intersects with the receiver, and false
otherwise
SWTException
- Rectangle.intersects(Rectangle)
public boolean intersects(Rectangle rect)
true
if the given rectangle intersects
with any of the polygons the receiver maintains to describe
its area and false
otherwise.
rect
- the rectangle to test for intersection
true
if the rectangle intersects with the receiver, and false
otherwise
java.lang.IllegalArgumentException
- SWTException
- Rectangle.intersects(Rectangle)
public boolean isDisposed()
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 using the region.
isDisposed
in class Resource
true
when the region is disposed, and false
otherwisepublic boolean isEmpty()
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.
true
if the receiver is empty, and false
otherwise
SWTException
- public void subtract(int[] pointArray)
pointArray
- points that describe the polygon to merge with the receiver
java.lang.IllegalArgumentException
- SWTException
- public void subtract(Rectangle rect)
rect
- the rectangle to subtract from the receiver
java.lang.IllegalArgumentException
- SWTException
- public void subtract(int x, int y, int width, int height)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width coordinate of the rectangleheight
- the height coordinate of the rectangle
java.lang.IllegalArgumentException
- SWTException
- public void subtract(Region region)
region
- the region to subtract
java.lang.IllegalArgumentException
- SWTException
- public void translate(int x, int y)
x
- the x coordinate of the point to translatey
- the y coordinate of the point to translate
SWTException
- public void translate(Point pt)
pt
- the point to translate
java.lang.IllegalArgumentException
- SWTException
- public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |