Example usage for com.itextpdf.text BaseColor getGreen

List of usage examples for com.itextpdf.text BaseColor getGreen

Introduction

In this page you can find the example usage for com.itextpdf.text BaseColor getGreen.

Prototype

public int getGreen() 

Source Link

Usage

From source file:com.vectorprint.report.itext.debug.DebugHelper.java

License:Open Source License

public static void debugBackground(PdfContentByte canvas, Rectangle rect, BaseColor color, String prefix,
        EnhancedMap settings, LayerManager layerAware) {
    canvas = canvas.getPdfWriter().getDirectContentUnder();
    int rgb = color.getRed() + color.getBlue() + color.getGreen();
    rect.setBackgroundColor(color);/*from  w w  w. j a  va  2s  .  c  o  m*/
    canvas.rectangle(rect);
    layerAware.startLayerInGroup(DEBUG, canvas);
    debugFont(canvas, settings);
    BaseColor txtColor = (rgb < 150) ? color.brighter().brighter() : color.darker().darker();
    canvas.setColorFill(txtColor);
    canvas.setColorStroke(txtColor);
    canvas.beginText();
    canvas.showTextAligned(Element.ALIGN_LEFT, prefix + color.toString().replace(Color.class.getName(), ""),
            rect.getLeft() + rect.getWidth() / 2, rect.getTop() - rect.getHeight() / 2, 0);
    canvas.endText();
    canvas.endLayer();
}