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
ConstructorsConstructorDescriptionRegion(MemorySegment address) Constructor used internally to instantiate a java Region object for a nativecairo_region_tinstance -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsPoint(int x, int y) Checks whether (x,y) is contained in this region.containsRectangle(RectangleInt rectangle) Checks whetherrectangleis inside, outside or partially contained in this regioncopy()Allocates a new region object copying the area from this region.static Regioncreate()Allocates a new empty region object.static Regioncreate(RectangleInt rectangle) Allocates a new region object containingrectangle.static Regioncreate(RectangleInt[] rects) Allocates a new region object containing the union of all givenrects.voiddestroy()Invokes the cleanup action that is normally invoked during garbage collection.booleanCompares whether this region is equivalent toother.voidgetExtents(RectangleInt extents) Gets the bounding rectangle of region as aRectangleIntvoidgetRectangle(int nth, RectangleInt rectangle) Returns thenthrectangle from this region.static org.gnome.glib.TypegetType()Get the CairoRegion GTypevoidintersect(RectangleInt rectangle) Computes the intersection of this region withrectangleand places the result in this regionvoidComputes the intersection of this region withotherand places the result in this regionbooleanisEmpty()Checks whether this region is empty.intReturns the number of rectangles contained in this region.status()Checks whether an error has previous occurred for this region object.voidsubtract(RectangleInt rectangle) Subtractsrectanglefrom this region and places the result in this regionvoidSubtractsotherfrom this region and places the result in this regionvoidtranslate(int dx, int dy) Translates this region by (dx,dy).voidunion(RectangleInt rectangle) Computes the union of this region withrectangleand places the result in this regionvoidComputes the union of this region withotherand places the result in this regionvoidxor(RectangleInt rectangle) Computes the exclusive difference of this region withrectangleand places the result in this region.voidComputes the exclusive difference of this region withotherand places the result in this region.
-
Constructor Details
-
Region
Constructor used internally to instantiate a java Region object for a nativecairo_region_tinstance- Parameters:
address- the memory address of the nativecairo_region_tinstance
-
-
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.SUCCESSorStatus.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 thenthrectangle 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:
trueif region is empty,falseif 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:
trueif (x,y) is contained in this region,falseif it is not.- Since:
- 1.10
-
containsRectangle
Checks whetherrectangleis inside, outside or partially contained in this region- Parameters:
rectangle- aRectangleInt- Returns:
RegionOverlap.INifrectangleis entirely inside this region,RegionOverlap.OUTifrectangleis entirely outside this region, orRegionOverlap.PARTifrectangleis partially inside and partially outside this region.- Since:
- 1.10
-
equal
Compares whether this region is equivalent toother.nullas an argument is equal to itself, but not to any non-nullregion.- Parameters:
other- aRegionornull- Returns:
trueif both regions contained the same coverage,falseif 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 withrectangleand places the result in this region- Parameters:
rectangle- aRectangle- Since:
- 1.10
-
subtract
-
subtract
Subtractsrectanglefrom this region and places the result in this region- Parameters:
rectangle- aRectangle- Since:
- 1.10
-
union
-
union
Computes the union of this region withrectangleand places the result in this region- Parameters:
rectangle- aRectangle- Since:
- 1.10
-
xor
-
xor
Computes the exclusive difference of this region withrectangleand 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
-