List of usage examples for com.itextpdf.text.pdf.parser Subpath getStartPoint
public Point2D getStartPoint()
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 w w w . j a va2 s . c om } 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
/** * Converts specified degenerate subpaths to circles. * Note: actually the resultant subpaths are not real circles but approximated. * * @param radius Radius of each constructed circle. * @return {@link java.util.List} consisting of circles constructed on given degenerated subpaths. */// w ww .j ava 2s. c o m private static List<Subpath> convertToCircles(List<Subpath> degenerateSubpaths, double radius) { List<Subpath> circles = new ArrayList<Subpath>(degenerateSubpaths.size()); for (Subpath subpath : degenerateSubpaths) { BezierCurve[] circleSectors = approximateCircle(subpath.getStartPoint(), radius); Subpath circle = new Subpath(); circle.addSegment(circleSectors[0]); circle.addSegment(circleSectors[1]); circle.addSegment(circleSectors[2]); circle.addSegment(circleSectors[3]); circles.add(circle); } return circles; }