Example usage for com.itextpdf.awt.geom AffineTransform getTranslateInstance

List of usage examples for com.itextpdf.awt.geom AffineTransform getTranslateInstance

Introduction

In this page you can find the example usage for com.itextpdf.awt.geom AffineTransform getTranslateInstance.

Prototype

public static AffineTransform getTranslateInstance(double mx, double my) 

Source Link

Usage

From source file:com.vectorprint.report.itext.style.stylers.Underline.java

License:Open Source License

@Override
public void draw(Rectangle rect, String genericTag) throws VectorPrintException {
    if (genericTag == null) {
        if (log.isLoggable(Level.FINE)) {
            log.fine("not drawing underline because genericTag is null (no data for underline)");
        }/*www  . j  av a 2s  .  c o m*/
        return;
    }
    DelayedData delayed = getDelayed(genericTag);
    PdfContentByte canvas = getPreparedCanvas();
    try {
        com.itextpdf.text.Font f = delayed.getChunk().getFont();
        canvas.setColorStroke((getColor() == null) ? f.getColor() : itextHelper.fromColor(getColor()));
        canvas.setLineWidth(getLineWidth());
        if (delayed.getChunk().getTextRise() != 0) {
            canvas.transform(AffineTransform.getTranslateInstance(0, delayed.getChunk().getTextRise()));
        }
        HashMap<String, Object> attributes = delayed.getChunk().getAttributes();
        if (attributes != null && attributes.containsKey(Chunk.SKEW)) {
            log.warning("lines under skewed text may not be at the correct position");
        }
        canvas.moveTo(rect.getLeft(), rect.getBottom());
        canvas.lineTo(rect.getLeft() + rect.getWidth(), rect.getBottom());
        canvas.stroke();
    } catch (Exception ex) {
        resetCanvas(canvas);
        throw new VectorPrintException(ex);
    }
    resetCanvas(canvas);
}

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

License:Open Source License

private static Point2D[] getRotatedSquareVertices(Point2D[] orthogonalSquareVertices, double angle,
        Point2D squareCenter) {// ww w  .j  av  a2s .  c om
    Point2D[] rotatedSquareVertices = new Point2D[orthogonalSquareVertices.length];

    AffineTransform.getRotateInstance(angle).transform(orthogonalSquareVertices, 0, rotatedSquareVertices, 0,
            rotatedSquareVertices.length);
    AffineTransform.getTranslateInstance(squareCenter.getX(), squareCenter.getY())
            .transform(rotatedSquareVertices, 0, rotatedSquareVertices, 0, orthogonalSquareVertices.length);

    return rotatedSquareVertices;
}