org.gnu.gdk

Class Region

public class Region extends MemStruct

Represents a set of pixels on the Screen.
Constructor Summary
Region()
Create a new empty Region.
Region(Point[] points, FillRule rule)
Create a new Region using the poligon defined by a number of points.
Region(Region regionToCopy)
Create a new Region that is a copy of the provided Region
Region(Rectangle rectangle)
Create a new Region containing the area of the Rectangle.
Method Summary
booleancontainsPoint(int x, int y)
Returns true if the provided point is in the Region.
OverlapTypecontainsRectangle(Rectangle rect)
Tests whether a Rectangle is within the Region.
RectanglegetClipbox()
Return the smallest rectangle which includes the entire Region.
Rectangle[]getRectangles()
Obtain the area covered by this Region as a list of Rectangles.
voidintersect(Region region)
Sets the area to the intersection of areas for this Region and the provided Region.
booleanisEmpty()
Returns true if the Region is empty.
booleanisEqual(Region other)
Returns true if the provided Region is the same as this one.
voidoffset(int x, int y)
Move the specified distance.
voidshrink(int x, int y)
Resizes this Regions by the specified amount.
voidsubtract(Region region)
Subtracts the area of the provided Region from this Region.
voidunion(Region region)
Sets the area to the union of areas for this Region and the provided Region.
voidunionWithRect(Rectangle rect)
Sets the area to the union of this Region and the provided Rectangle.
voidxor(Region region)
Sets the area of this Region to the exclusive-OR of the areas of this Region and the provided Region.

Constructor Detail

Region

public Region()
Create a new empty Region.

Region

public Region(Point[] points, FillRule rule)
Create a new Region using the poligon defined by a number of points.

Parameters: points rule

Region

public Region(Region regionToCopy)
Create a new Region that is a copy of the provided Region

Parameters: regionToCopy

Region

public Region(Rectangle rectangle)
Create a new Region containing the area of the Rectangle.

Parameters: rectangle

Method Detail

containsPoint

public boolean containsPoint(int x, int y)
Returns true if the provided point is in the Region.

Parameters: x y

containsRectangle

public OverlapType containsRectangle(Rectangle rect)
Tests whether a Rectangle is within the Region.

Parameters: rect

getClipbox

public Rectangle getClipbox()
Return the smallest rectangle which includes the entire Region.

getRectangles

public Rectangle[] getRectangles()
Obtain the area covered by this Region as a list of Rectangles.

intersect

public void intersect(Region region)
Sets the area to the intersection of areas for this Region and the provided Region.

Parameters: region

isEmpty

public boolean isEmpty()
Returns true if the Region is empty.

isEqual

public boolean isEqual(Region other)
Returns true if the provided Region is the same as this one.

Parameters: other

offset

public void offset(int x, int y)
Move the specified distance.

Parameters: x y

shrink

public void shrink(int x, int y)
Resizes this Regions by the specified amount. Positive values shrink the Region. Negative numbers expand it.

Parameters: x y

subtract

public void subtract(Region region)
Subtracts the area of the provided Region from this Region.

Parameters: region

union

public void union(Region region)
Sets the area to the union of areas for this Region and the provided Region.

Parameters: region

unionWithRect

public void unionWithRect(Rectangle rect)
Sets the area to the union of this Region and the provided Rectangle.

Parameters: rect

xor

public void xor(Region region)
Sets the area of this Region to the exclusive-OR of the areas of this Region and the provided Region.

Parameters: region