List of usage examples for com.itextpdf.text.pdf.parser Subpath Subpath
public Subpath()
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. *///from w w w . j a v a2s. co 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; }
From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java
License:Open Source License
private static Subpath constructSquare(Point2D squareCenter, double widthHalf, double rotationAngle) { // Orthogonal square is the square with sides parallel to one of the axes. Point2D[] ortogonalSquareVertices = { new Point2D.Double(-widthHalf, -widthHalf), new Point2D.Double(-widthHalf, widthHalf), new Point2D.Double(widthHalf, widthHalf), new Point2D.Double(widthHalf, -widthHalf) }; Point2D[] rotatedSquareVertices = getRotatedSquareVertices(ortogonalSquareVertices, rotationAngle, squareCenter);//ww w . j a v a2 s . c o m Subpath square = new Subpath(); square.addSegment(new Line(rotatedSquareVertices[0], rotatedSquareVertices[1])); square.addSegment(new Line(rotatedSquareVertices[1], rotatedSquareVertices[2])); square.addSegment(new Line(rotatedSquareVertices[2], rotatedSquareVertices[3])); square.addSegment(new Line(rotatedSquareVertices[3], rotatedSquareVertices[0])); return square; }