java.lang.Object
io.github.jwharm.cairobindings.Proxy
org.freedesktop.cairo.Path
- All Implemented Interfaces:
Iterable<PathElement>
A data structure for holding a path. This data structure serves as the return
value for
Context.copyPath() and Context.copyPathFlat() as
well the input value for Context.appendPath(Path).
The Path class implements Iterable. The iterator loops through the
cairo_path_data_t segments in native memory and returns
PathElement instances. You can use
record patterns in a switch
expression to process the elements:
Path path = cr.copyPath();
for (PathElement element : path) {
switch (element) {
case PathElement.MoveTo(double x, double y) -> doMoveToThings(x, y);
case PathElement.LineTo(double x, double y) -> doLineToThings(x, y);
case PathElement.CurveTo(double x1, double y1, double x2, double y2, double x3, double y3) -> doCurveToThings(x1, y1, x2, y2, x3, y3);
case PathElement.ClosePath() -> doClosePathThings();
}
}
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionPath(MemorySegment address) Constructor used internally to instantiate a java Path object for a nativecairo_path_tinstance -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Path
Constructor used internally to instantiate a java Path object for a nativecairo_path_tinstance- Parameters:
address- the memory address of the nativecairo_path_tinstance
-
-
Method Details
-
status
Read the current error status from the Path- Returns:
- the current error status
-
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. -
iterator
Iterates through the path.- Specified by:
iteratorin interfaceIterable<PathElement>- Returns:
- an iterator that produces
PathElementrecord instances of type MoveTo, LineTo, CurveTo or ClosePath for all elements in the path.
-