Example usage for com.lowagie.text.pdf PdfContentByte setColorStroke

List of usage examples for com.lowagie.text.pdf PdfContentByte setColorStroke

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfContentByte setColorStroke.

Prototype

public void setColorStroke(Color color) 

Source Link

Document

Sets the stroke color.

Usage

From source file:org.mapfish.print.scalebar.ScalebarDrawer.java

License:Open Source License

public void renderImpl(Rectangle rectangle, PdfContentByte dc) {
    dc.saveState();/*from  www.  j  a  v  a 2  s .c  o  m*/
    try {
        //sets the transformation for drawing the labels and do it
        final AffineTransform rotate = getRotationTransform(block.getBarDirection());
        final AffineTransform labelTransform = AffineTransform.getTranslateInstance(rectangle.getLeft(),
                rectangle.getBottom());
        labelTransform.concatenate(rotate);
        labelTransform.translate(leftLabelMargin, maxLabelHeight);
        dc.transform(labelTransform);
        dc.setColorStroke(block.getColorVal());
        dc.setFontAndSize(pdfFont.getCalculatedBaseFont(false), pdfFont.getSize());
        drawLabels(dc);

        dc.restoreState();
        dc.saveState();

        //sets the transformation for drawing the bar and do it
        final AffineTransform lineTransform = AffineTransform.getTranslateInstance(rectangle.getLeft(),
                rectangle.getBottom());
        lineTransform.concatenate(rotate);
        lineTransform.translate(leftLabelMargin, labelDistance + maxLabelHeight);
        dc.transform(lineTransform);
        dc.setLineWidth((float) block.getLineWidth());
        dc.setColorStroke(block.getColorVal());
        drawBar(dc);
    } finally {
        dc.restoreState();
    }
}