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

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

Introduction

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

Prototype

int LINE_CAP_ROUND

To view the source code for com.lowagie.text.pdf PdfContentByte LINE_CAP_ROUND.

Click Source Link

Document

A possible line cap value

Usage

From source file:nl.dykema.jxmlnote.report.pdf.PdfChunk.java

License:Open Source License

public Chunk setUnderline(Color c, float thinkness, float yposition) {
    super.setUnderline(new BaseColor(c), thinkness, 0.0f, yposition, 0.0f, PdfContentByte.LINE_CAP_ROUND);
    return this;
}

From source file:org.mapfish.print.map.renderers.vector.LineStringRenderer.java

License:Open Source License

protected static void applyStyle(RenderingContext context, PdfContentByte dc, PJsonObject style,
        PdfGState state) {// w w w .j av a2 s.c  o  m
    if (style == null)
        return;
    if (style.optString("strokeColor") != null) {
        dc.setColorStroke(ColorWrapper.convertColor(style.getString("strokeColor")));
    }
    if (style.optString("strokeOpacity") != null) {
        state.setStrokeOpacity(style.getFloat("strokeOpacity"));
    }
    final float width = style.optFloat("strokeWidth", 1) * context.getStyleFactor();
    dc.setLineWidth(width);
    final String linecap = style.optString("strokeLinecap");
    if (linecap != null) {
        if (linecap.equalsIgnoreCase("butt")) {
            dc.setLineCap(PdfContentByte.LINE_CAP_BUTT);
        } else if (linecap.equalsIgnoreCase("round")) {
            dc.setLineCap(PdfContentByte.LINE_CAP_ROUND);
        } else if (linecap.equalsIgnoreCase("square")) {
            dc.setLineCap(PdfContentByte.LINE_CAP_PROJECTING_SQUARE);
        } else {
            throw new InvalidValueException("strokeLinecap", linecap);
        }
    }
    final String dashStyle = style.optString("strokeDashstyle");
    if (dashStyle != null) {
        if (dashStyle.equalsIgnoreCase("dot")) {
            final float[] def = new float[] { 0.1f, 2 * width };
            dc.setLineDash(def, 0);
        } else if (dashStyle.equalsIgnoreCase("dash")) {
            final float[] def = new float[] { 2 * width, 2 * width };
            dc.setLineDash(def, 0);
        } else if (dashStyle.equalsIgnoreCase("dashdot")) {
            final float[] def = new float[] { 3 * width, 2 * width, 0.1f, 2 * width };
            dc.setLineDash(def, 0);
        } else if (dashStyle.equalsIgnoreCase("longdash")) {
            final float[] def = new float[] { 4 * width, 2 * width };
            dc.setLineDash(def, 0);
        } else if (dashStyle.equalsIgnoreCase("longdashdot")) {
            final float[] def = new float[] { 5 * width, 2 * width, 0.1f, 2 * width };
            dc.setLineDash(def, 0);
        } else if (dashStyle.equalsIgnoreCase("solid")) {

        } else {
            throw new InvalidValueException("strokeDashstyle", dashStyle);
        }
    }
}

From source file:org.oss.pdfreporter.pdf.Page.java

License:Open Source License

private int translateLineCap(LineCap lineCap) {
    switch (lineCap) {
    case BUTT_END:
        return PdfContentByte.LINE_CAP_BUTT;
    case ROUND_END:
        return PdfContentByte.LINE_CAP_ROUND;
    case PROJECTING_SCUARE_END:
        return PdfContentByte.LINE_CAP_PROJECTING_SQUARE;
    }/*from w  w  w  . j  ava2  s. c o m*/
    throw new NotImplementedException("LineCap: " + lineCap + " is unknown.");
}