List of usage examples for com.itextpdf.text.pdf.parser Subpath isClosed
public boolean isClosed()
boolean value indicating whether the subpath must be closed or not. From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpContentOperator.java
License:Open Source License
private void writePath(Path path, byte[] pathPaintingOperator, PdfContentByte canvas) throws IOException { if (path.isEmpty()) { return;/*from ww w . j a va2 s. c o m*/ } for (Subpath subpath : path.getSubpaths()) { writeMoveTo(subpath.getStartPoint(), canvas); for (Shape segment : subpath.getSegments()) { if (segment instanceof BezierCurve) { writeBezierCurve((BezierCurve) segment, canvas); } else { writeLine((Line) segment, canvas); } } if (subpath.isClosed()) { canvas.getInternalBuffer().append(h); } } if (pathPaintingOperator != null) { canvas.getInternalBuffer().append(pathPaintingOperator); } }
From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java
License:Open Source License
/** * Adds all subpaths of the path to the {@link ClipperOffset} object with one * note: it doesn't add degenerate subpaths. * * @return {@link java.util.List} consisting of all degenerate subpaths of the path. *///from ww w . j a v a2 s .c om private static List<Subpath> addPath(ClipperOffset offset, Path path, JoinType joinType, EndType endType) { List<Subpath> degenerateSubpaths = new ArrayList<Subpath>(); for (Subpath subpath : path.getSubpaths()) { if (subpath.isDegenerate()) { degenerateSubpaths.add(subpath); continue; } if (!subpath.isSinglePointClosed() && !subpath.isSinglePointOpen()) { EndType et; if (subpath.isClosed()) { // Offsetting is never used for path being filled et = EndType.CLOSED_LINE; } else { et = endType; } List<Point2D> linearApproxPoints = subpath.getPiecewiseLinearApproximation(); offset.addPath(convertToIntPoints(linearApproxPoints), joinType, et); } } return degenerateSubpaths; }
From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java
License:Open Source License
private static void addPath(Clipper clipper, Path path) { for (Subpath subpath : path.getSubpaths()) { if (!subpath.isSinglePointClosed() && !subpath.isSinglePointOpen()) { List<Point2D> linearApproxPoints = subpath.getPiecewiseLinearApproximation(); clipper.addPath(convertToIntPoints(linearApproxPoints), PolyType.SUBJECT, subpath.isClosed()); }/* www. jav a2s. c o m*/ } }