public class PathGenerator extends NativeObject implements java.lang.AutoCloseable
Constructor and Description |
---|
PathGenerator(Path path)
Create a new path generator for appending to a path.
|
Modifier and Type | Method and 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 object
|
void |
closeSubpath()
Close the current subpath.
|
static PathGenerator |
createDynamicObject(long handle) |
void |
lineTo(Point target)
Draw a line.
|
void |
moveTo(Point target)
Move the current position.
|
equals, hashCode
public PathGenerator(Path path)
path
- the path objectjava.lang.IllegalArgumentException
- if the path
argument is null
java.lang.IllegalArgumentException
- if the path
object has already been closedpublic static PathGenerator createDynamicObject(long handle)
public void moveTo(Point target)
target
- the target coordinatesjava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if target
is null
public void lineTo(Point target)
target
- the target coordinatesjava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if target
is null
public void bezierTo(Point controlPoint1, Point controlPoint2, Point target)
Append a cubic Bézier curve to the current path.
The curve extends from the current point to the target
position,
using controlPoint1
and controlPoint2
as the Bézier control points.
The current position is changed to the target position.
controlPoint1
- the first bezier control pointcontrolPoint2
- the second bezier control pointtarget
- the target coordinatesjava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if controlPoint1
is null
java.lang.IllegalArgumentException
- if controlPoint2
is null
java.lang.IllegalArgumentException
- if target
is null
public void closeSubpath()
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedpublic void addRectangle(Rectangle rectangle)
rectangle
- the rectangle to be added to the pathjava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if rectangle
is null
public void addCircle(Point center, double radius)
center
- the center of the circleradius
- the radius of the circlejava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if center
is null
public void addEllipse(Rectangle rectangle)
rectangle
- the surrounding rectangle of the ellipsejava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if rectangle
is null
public void addArc(Rectangle rectangle, double alpha1, double alpha2)
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 arcjava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if rectangle
is null
public void addPie(Rectangle rectangle, double alpha1, double alpha2)
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 arcjava.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalStateException
- if the path object has already been closedjava.lang.IllegalArgumentException
- if rectangle
is null
public void close() throws PdfToolboxException, java.io.IOException
close
in interface java.lang.AutoCloseable
PdfToolboxException
- only explicitly stated in a superclassjava.io.IOException