Search in sources :

Example 1 with Matrix

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

the class PdfCleanUpProcessor method applyGsParams.

private void applyGsParams(boolean fill, boolean stroke, NotAppliedGsParams gsParams) {
    for (PdfDictionary extGState : gsParams.extGStates) {
        getCanvas().setExtGState(extGState);
    }
    gsParams.extGStates.clear();
    if (gsParams.ctms.size() > 0) {
        Matrix m = new Matrix();
        for (List<PdfObject> ctm : gsParams.ctms) {
            m = operandsToMatrix(ctm).multiply(m);
        }
        getCanvas().concatMatrix(m.get(Matrix.I11), m.get(Matrix.I12), m.get(Matrix.I21), m.get(Matrix.I22), m.get(Matrix.I31), m.get(Matrix.I32));
        gsParams.ctms.clear();
    }
    if (stroke) {
        for (List<PdfObject> strokeState : gsParams.lineStyleOperators.values()) {
            writeOperands(getCanvas(), strokeState);
        }
        gsParams.lineStyleOperators.clear();
    }
    if (fill) {
        if (gsParams.fillColor != null) {
            getCanvas().setFillColor(gsParams.fillColor);
        }
        gsParams.fillColor = null;
    }
    if (stroke) {
        if (gsParams.strokeColor != null) {
            getCanvas().setStrokeColor(gsParams.strokeColor);
        }
        gsParams.strokeColor = null;
    }
}
Also used : Matrix(com.itextpdf.kernel.geom.Matrix) PdfDictionary(com.itextpdf.kernel.pdf.PdfDictionary) PdfObject(com.itextpdf.kernel.pdf.PdfObject)

Aggregations

Matrix (com.itextpdf.kernel.geom.Matrix)1 PdfDictionary (com.itextpdf.kernel.pdf.PdfDictionary)1 PdfObject (com.itextpdf.kernel.pdf.PdfObject)1