Example usage for com.itextpdf.text.pdf.parser Subpath isSinglePointClosed

List of usage examples for com.itextpdf.text.pdf.parser Subpath isSinglePointClosed

Introduction

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

Prototype

public boolean isSinglePointClosed() 

Source Link

Usage

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

License:Open Source License

/**
 * Adds all subpaths of the path to the {@link ClipperOffset} object with one
 * note: it doesn't add degenerate subpaths.
 *
 * @return {@link java.util.List} consisting of all degenerate subpaths of the path.
 *//*ww w  . ja v a  2  s .  c  om*/
private static List<Subpath> addPath(ClipperOffset offset, Path path, JoinType joinType, EndType endType) {
    List<Subpath> degenerateSubpaths = new ArrayList<Subpath>();

    for (Subpath subpath : path.getSubpaths()) {
        if (subpath.isDegenerate()) {
            degenerateSubpaths.add(subpath);
            continue;
        }

        if (!subpath.isSinglePointClosed() && !subpath.isSinglePointOpen()) {
            EndType et;

            if (subpath.isClosed()) {
                // Offsetting is never used for path being filled
                et = EndType.CLOSED_LINE;
            } else {
                et = endType;
            }

            List<Point2D> linearApproxPoints = subpath.getPiecewiseLinearApproximation();
            offset.addPath(convertToIntPoints(linearApproxPoints), joinType, et);
        }
    }

    return degenerateSubpaths;
}

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

License:Open Source License

private static void addPath(Clipper clipper, Path path) {
    for (Subpath subpath : path.getSubpaths()) {
        if (!subpath.isSinglePointClosed() && !subpath.isSinglePointOpen()) {
            List<Point2D> linearApproxPoints = subpath.getPiecewiseLinearApproximation();
            clipper.addPath(convertToIntPoints(linearApproxPoints), PolyType.SUBJECT, subpath.isClosed());
        }//from  ww  w.j  a  v a 2 s . c o  m
    }
}