Example usage for com.itextpdf.text.pdf.parser Line Line

List of usage examples for com.itextpdf.text.pdf.parser Line Line

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf.parser Line Line.

Prototype

public Line(Point2D p1, Point2D p2) 

Source Link

Document

Constructs a new line based on the given coordinates.

Usage

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);/*from w  ww.ja 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;
}