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

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

Introduction

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

Prototype

public List<Shape> getSegments() 

Source Link

Usage

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

License:Open Source License

private void writePath(Path path, byte[] pathPaintingOperator, PdfContentByte canvas) throws IOException {
    if (path.isEmpty()) {
        return;/*from   w  w w .j  av  a2  s  .c  om*/
    }

    for (Subpath subpath : path.getSubpaths()) {
        writeMoveTo(subpath.getStartPoint(), canvas);

        for (Shape segment : subpath.getSegments()) {
            if (segment instanceof BezierCurve) {
                writeBezierCurve((BezierCurve) segment, canvas);
            } else {
                writeLine((Line) segment, canvas);
            }
        }

        if (subpath.isClosed()) {
            canvas.getInternalBuffer().append(h);
        }
    }

    if (pathPaintingOperator != null) {
        canvas.getInternalBuffer().append(pathPaintingOperator);
    }
}