Search in sources :

Example 1 with LineDecoration

use of org.apache.poi.sl.usermodel.LineDecoration in project poi by apache.

the class DrawSimpleShape method drawDecoration.

protected void drawDecoration(Graphics2D graphics, Paint line, BasicStroke stroke) {
    if (line == null) {
        return;
    }
    graphics.setPaint(line);
    List<Outline> lst = new ArrayList<Outline>();
    LineDecoration deco = getShape().getLineDecoration();
    Outline head = getHeadDecoration(graphics, deco, stroke);
    if (head != null) {
        lst.add(head);
    }
    Outline tail = getTailDecoration(graphics, deco, stroke);
    if (tail != null) {
        lst.add(tail);
    }
    for (Outline o : lst) {
        java.awt.Shape s = o.getOutline();
        Path p = o.getPath();
        graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
        if (p.isFilled()) {
            graphics.fill(s);
        }
        if (p.isStroked()) {
            graphics.draw(s);
        }
    }
}
Also used : LineDecoration(org.apache.poi.sl.usermodel.LineDecoration) Path(org.apache.poi.sl.draw.geom.Path) ArrayList(java.util.ArrayList) Outline(org.apache.poi.sl.draw.geom.Outline)

Aggregations

ArrayList (java.util.ArrayList)1 Outline (org.apache.poi.sl.draw.geom.Outline)1 Path (org.apache.poi.sl.draw.geom.Path)1 LineDecoration (org.apache.poi.sl.usermodel.LineDecoration)1