Example usage for com.itextpdf.text.pdf.parser Path lineTo

List of usage examples for com.itextpdf.text.pdf.parser Path lineTo

Introduction

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

Prototype

public void lineTo(final float x, final float y) 

Source Link

Document

Appends a straight line segment from the current point to the point (x, y).

Usage

From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java

License:Open Source License

private static void addContour(Path path, List<LongPoint> contour, Boolean close) {
    List<Point2D> floatContour = convertToFloatPoints(contour);
    Iterator<Point2D> iter = floatContour.iterator();

    Point2D point = iter.next();//w w  w  . jav  a2s.co  m
    path.moveTo((float) point.getX(), (float) point.getY());

    while (iter.hasNext()) {
        point = iter.next();
        path.lineTo((float) point.getX(), (float) point.getY());
    }

    if (close) {
        path.closeSubpath();
    }
}

From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java

License:Open Source License

private static float applyDash(Path dashedPath, Point2D segStart, Point2D segEnd, Point2D dashTo,
        boolean isGap) {
    float remainingDist = 0;

    if (!liesOnSegment(segStart, segEnd, dashTo)) {
        remainingDist = (float) dashTo.distance(segEnd);
        dashTo = segEnd;/*from   w  w w . j  a  v  a 2  s.co m*/
    }

    if (isGap) {
        dashedPath.moveTo((float) dashTo.getX(), (float) dashTo.getY());
    } else {
        dashedPath.lineTo((float) dashTo.getX(), (float) dashTo.getY());
    }

    return remainingDist;
}