java.lang.Object
io.github.jwharm.cairobindings.Proxy
org.freedesktop.cairo.Region
A
Region
represents a set of integer-aligned rectangles.
Regions are a simple graphical data type representing an area of integer-aligned rectangles. They are often used on raster surfaces to track areas of interest, such as change or clip areas.
It allows set-theoretical operations like union(org.freedesktop.cairo.Region)
and
intersect(org.freedesktop.cairo.Region)
to be performed on them.
- Since:
- 1.10
-
Constructor Summary
ConstructorDescriptionRegion
(MemorySegment address) Constructor used internally to instantiate a java Region object for a nativecairo_region_t
instance -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsPoint
(int x, int y) Checks whether (x
,y
) is contained in this region.containsRectangle
(RectangleInt rectangle) Checks whetherrectangle
is inside, outside or partially contained in this regioncopy()
Allocates a new region object copying the area from this region.static Region
create()
Allocates a new empty region object.static Region
create
(RectangleInt rectangle) Allocates a new region object containingrectangle
.static Region
create
(RectangleInt[] rects) Allocates a new region object containing the union of all givenrects
.void
destroy()
Invokes the cleanup action that is normally invoked during garbage collection.boolean
Compares whether this region is equivalent toother
.void
getExtents
(RectangleInt extents) Gets the bounding rectangle of region as aRectangleInt
void
getRectangle
(int nth, RectangleInt rectangle) Returns thenth
rectangle from this region.static org.gnome.glib.Type
getType()
Get the CairoRegion GTypevoid
intersect
(RectangleInt rectangle) Computes the intersection of this region withrectangle
and places the result in this regionvoid
Computes the intersection of this region withother
and places the result in this regionboolean
isEmpty()
Checks whether this region is empty.int
Returns the number of rectangles contained in this region.status()
Checks whether an error has previous occurred for this region object.void
subtract
(RectangleInt rectangle) Subtractsrectangle
from this region and places the result in this regionvoid
Subtractsother
from this region and places the result in this regionvoid
translate
(int dx, int dy) Translates this region by (dx
,dy
).void
union
(RectangleInt rectangle) Computes the union of this region withrectangle
and places the result in this regionvoid
Computes the union of this region withother
and places the result in this regionvoid
xor
(RectangleInt rectangle) Computes the exclusive difference of this region withrectangle
and places the result in this region.void
Computes the exclusive difference of this region withother
and places the result in this region.
-
Constructor Details
-
Region
Constructor used internally to instantiate a java Region object for a nativecairo_region_t
instance- Parameters:
address
- the memory address of the nativecairo_region_t
instance
-
-
Method Details
-
destroy
public void destroy()Invokes the cleanup action that is normally invoked during garbage collection. If the instance is "owned" by the user, thedestroy()
function is run to dispose the native instance. -
create
Allocates a new empty region object.- Returns:
- A newly allocated Region
- Since:
- 1.10
-
create
Allocates a new region object containingrectangle
.- Parameters:
rectangle
- aRectangleInt
- Returns:
- A newly allocated Region
- Since:
- 1.10
-
create
Allocates a new region object containing the union of all givenrects
.- Parameters:
rects
- an array of rectangles- Returns:
- A newly allocated Region
- Since:
- 1.10
-
copy
Allocates a new region object copying the area from this region.- Returns:
- A newly allocated Region
- Since:
- 1.10
-
status
Checks whether an error has previous occurred for this region object.- Returns:
Status.SUCCESS
orStatus.NO_MEMORY
- Since:
- 1.10
-
getExtents
Gets the bounding rectangle of region as aRectangleInt
- Parameters:
extents
- rectangle into which to store the extents- Since:
- 1.10
-
numRectangles
public int numRectangles()Returns the number of rectangles contained in this region.- Returns:
- The number of rectangles contained in this region.
- Since:
- 1.10
-
getRectangle
Returns thenth
rectangle from this region.- Parameters:
nth
- a number indicating which rectangle should be returnedrectangle
- a RectangleInt- Since:
- 1.10
-
isEmpty
public boolean isEmpty()Checks whether this region is empty.- Returns:
true
if region is empty,false
if it isn't.- Since:
- 1.10
-
containsPoint
public boolean containsPoint(int x, int y) Checks whether (x
,y
) is contained in this region.- Parameters:
x
- the x coordinate of a pointy
- the y coordinate of a point- Returns:
true
if (x
,y
) is contained in this region,false
if it is not.- Since:
- 1.10
-
containsRectangle
Checks whetherrectangle
is inside, outside or partially contained in this region- Parameters:
rectangle
- aRectangleInt
- Returns:
RegionOverlap.IN
ifrectangle
is entirely inside this region,RegionOverlap.OUT
ifrectangle
is entirely outside this region, orRegionOverlap.PART
ifrectangle
is partially inside and partially outside this region.- Since:
- 1.10
-
equal
Compares whether this region is equivalent toother
.null
as an argument is equal to itself, but not to any non-null
region.- Parameters:
other
- aRegion
ornull
- Returns:
true
if both regions contained the same coverage,false
if it is not or any region is in an error status.- Since:
- 1.10
-
translate
public void translate(int dx, int dy) Translates this region by (dx
,dy
).- Parameters:
dx
- Amount to translate in the x directiondy
- Amount to translate in the y direction- Since:
- 1.10
-
intersect
-
intersect
Computes the intersection of this region withrectangle
and places the result in this region- Parameters:
rectangle
- aRectangle
- Since:
- 1.10
-
subtract
-
subtract
Subtractsrectangle
from this region and places the result in this region- Parameters:
rectangle
- aRectangle
- Since:
- 1.10
-
union
-
union
Computes the union of this region withrectangle
and places the result in this region- Parameters:
rectangle
- aRectangle
- Since:
- 1.10
-
xor
-
xor
Computes the exclusive difference of this region withrectangle
and places the result in this region. That is, this region will be set to contain all areas that are either in this region or inrectangle
, but not in both.- Parameters:
rectangle
- aRectangle
- Since:
- 1.10
-
getType
public static org.gnome.glib.Type getType()Get the CairoRegion GType- Returns:
- the GType
-