Package com.pdftools.toolbox.pdf.content
Class PathGenerator
- java.lang.Object
-
- com.pdftools.toolbox.internal.NativeBase
-
- com.pdftools.toolbox.internal.NativeObject
-
- com.pdftools.toolbox.pdf.content.PathGenerator
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class PathGenerator extends NativeObject implements java.lang.AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description PathGenerator(Path path)
Create a new path generator for appending to a path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArc(Rectangle rectangle, double alpha1, double alpha2)
Add an elliptical arc to the current path.void
addCircle(Point center, double radius)
Append a circle to the current path as a complete subpath.void
addEllipse(Rectangle rectangle)
Add an ellipse to the current path as a complete subpath.void
addPie(Rectangle rectangle, double alpha1, double alpha2)
Add an elliptical piece of pie to the current path as a complete subpath.void
addRectangle(Rectangle rectangle)
Append a rectangle to the current path as a complete subpath.void
bezierTo(Point controlPoint1, Point controlPoint2, Point target)
Draw a bezier curve.void
close()
Close the objectvoid
closeSubpath()
Close the current subpath.void
lineTo(Point target)
Draw a line.void
moveTo(Point target)
Move the current position.-
Methods inherited from class com.pdftools.toolbox.internal.NativeObject
equals, hashCode
-
-
-
-
Constructor Detail
-
PathGenerator
public PathGenerator(Path path)
Create a new path generator for appending to a path.
- Parameters:
path
- the path object- Throws:
java.lang.IllegalArgumentException
- ifpath
isnull
-
-
Method Detail
-
moveTo
public void moveTo(Point target)
Move the current position.
Begin a new subpath by moving the current point to the specified coordinates, omitting any connecting line segment. If the previous path construction operator in the current path was also MoveTo, the new MoveTo overrides it; no vestige of the previous MoveTo operation remains in the path.- Parameters:
target
- the target coordinates- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- iftarget
isnull
-
lineTo
public void lineTo(Point target)
Draw a line.
Append a straight line segment from the current point to the target coordinates. The current position is changed to the target position.- Parameters:
target
- the target coordinates- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- iftarget
isnull
-
bezierTo
public void bezierTo(Point controlPoint1, Point controlPoint2, Point target)
Draw a bezier curve.
Append a cubic Bézier curve to the current path. The curve extends from the current point to the
target
position, usingcontrolPoint1
andcontrolPoint2
as the Bézier control points.The current position is changed to the target position.
- Parameters:
controlPoint1
- the first bezier control pointcontrolPoint2
- the second bezier control pointtarget
- the target coordinates- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- ifcontrolPoint1
isnull
java.lang.IllegalArgumentException
- ifcontrolPoint2
isnull
java.lang.IllegalArgumentException
- iftarget
isnull
-
closeSubpath
public void closeSubpath()
Close the current subpath.
Close the current subpath by appending a straight line segment from the current point to the starting point of the subpath. This operator terminates the current subpath; appending another segment to the current path will begin a new subpath, even if the new segment begins at the endpoint reached by the closeSubpath() operation. If the current subpath has already been closed, CloseSubpath() does nothing.- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closed
-
addRectangle
public void addRectangle(Rectangle rectangle)
Append a rectangle to the current path as a complete subpath.
- Parameters:
rectangle
- the rectangle to be added to the path- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- ifrectangle
isnull
-
addCircle
public void addCircle(Point center, double radius)
Append a circle to the current path as a complete subpath.
- Parameters:
center
- the center of the circleradius
- the radius of the circle- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- ifcenter
isnull
-
addEllipse
public void addEllipse(Rectangle rectangle)
Add an ellipse to the current path as a complete subpath.
- Parameters:
rectangle
- the surrounding rectangle of the ellipse- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- ifrectangle
isnull
-
addArc
public void addArc(Rectangle rectangle, double alpha1, double alpha2)
Add an elliptical arc to the current path.
- Parameters:
rectangle
- the surrounding rectangle of the ellipsealpha1
- the angle between the x-axis and the begin of the arcalpha2
- the angle between the x-axis and the end of the arc- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- ifrectangle
isnull
-
addPie
public void addPie(Rectangle rectangle, double alpha1, double alpha2)
Add an elliptical piece of pie to the current path as a complete subpath.
- Parameters:
rectangle
- the surrounding rectangle of the ellipsealpha1
- the angle between the x-axis and the begin of the arcalpha2
- the angle between the x-axis and the end of the arc- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- ifrectangle
isnull
-
close
public void close() throws ToolboxException, java.io.IOException
Close the object
Release all native resources associated with the object.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
ToolboxException
- only explicitly stated in a superclassjava.io.IOException
-
-