use of com.itextpdf.kernel.geom.IShape in project i7j-pdfsweep by itext.
the class PdfCleanUpProcessor method writePath.
private void writePath(Path path) {
PdfCanvas canvas = getCanvas();
for (Subpath subpath : path.getSubpaths()) {
canvas.moveTo((float) subpath.getStartPoint().getX(), (float) subpath.getStartPoint().getY());
for (IShape segment : subpath.getSegments()) {
if (segment instanceof BezierCurve) {
List<Point> basePoints = segment.getBasePoints();
Point p2 = basePoints.get(1);
Point p3 = basePoints.get(2);
Point p4 = basePoints.get(3);
canvas.curveTo((float) p2.getX(), (float) p2.getY(), (float) p3.getX(), (float) p3.getY(), (float) p4.getX(), (float) p4.getY());
} else {
// segment is Line
Point destination = segment.getBasePoints().get(1);
canvas.lineTo((float) destination.getX(), (float) destination.getY());
}
}
if (subpath.isClosed()) {
canvas.closePath();
}
}
}
Aggregations