Search in sources :

Example 1 with Line

use of com.itextpdf.kernel.geom.Line in project i7j-pdfsweep by itext.

the class PdfCleanUpFilter method constructSquare.

private static Subpath constructSquare(Point squareCenter, double widthHalf, double rotationAngle) {
    // Orthogonal square is the square with sides parallel to one of the axes.
    Point[] ortogonalSquareVertices = { new Point(-widthHalf, -widthHalf), new Point(-widthHalf, widthHalf), new Point(widthHalf, widthHalf), new Point(widthHalf, -widthHalf) };
    Point[] rotatedSquareVertices = getRotatedSquareVertices(ortogonalSquareVertices, rotationAngle, squareCenter);
    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;
}
Also used : Subpath(com.itextpdf.kernel.geom.Subpath) Line(com.itextpdf.kernel.geom.Line) Point(com.itextpdf.kernel.geom.Point)

Aggregations

Line (com.itextpdf.kernel.geom.Line)1 Point (com.itextpdf.kernel.geom.Point)1 Subpath (com.itextpdf.kernel.geom.Subpath)1