Search in sources :

Example 6 with Path

use of org.apache.poi.sl.draw.geom.Path in project poi by apache.

the class DrawFreeformShape method computeOutlines.

protected Collection<Outline> computeOutlines(Graphics2D graphics) {
    List<Outline> lst = new ArrayList<Outline>();
    FreeformShape<?, ?> fsh = getShape();
    Path2D sh = fsh.getPath();
    AffineTransform tx = (AffineTransform) graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
    if (tx == null) {
        tx = new AffineTransform();
    }
    java.awt.Shape canvasShape = tx.createTransformedShape(sh);
    FillStyle fs = fsh.getFillStyle();
    StrokeStyle ss = fsh.getStrokeStyle();
    Path path = new Path(fs != null, ss != null);
    lst.add(new Outline(canvasShape, path));
    return lst;
}
Also used : Path(org.apache.poi.sl.draw.geom.Path) Path2D(java.awt.geom.Path2D) ArrayList(java.util.ArrayList) FillStyle(org.apache.poi.sl.usermodel.FillStyle) AffineTransform(java.awt.geom.AffineTransform) Outline(org.apache.poi.sl.draw.geom.Outline) StrokeStyle(org.apache.poi.sl.usermodel.StrokeStyle)

Aggregations

Outline (org.apache.poi.sl.draw.geom.Outline)6 Path (org.apache.poi.sl.draw.geom.Path)6 AffineTransform (java.awt.geom.AffineTransform)4 Path2D (java.awt.geom.Path2D)3 Rectangle2D (java.awt.geom.Rectangle2D)3 ArrayList (java.util.ArrayList)3 Ellipse2D (java.awt.geom.Ellipse2D)2 DecorationShape (org.apache.poi.sl.usermodel.LineDecoration.DecorationShape)2 DecorationSize (org.apache.poi.sl.usermodel.LineDecoration.DecorationSize)2 Color (java.awt.Color)1 JAXBContext (javax.xml.bind.JAXBContext)1 Context (org.apache.poi.sl.draw.geom.Context)1 CustomGeometry (org.apache.poi.sl.draw.geom.CustomGeometry)1 FillStyle (org.apache.poi.sl.usermodel.FillStyle)1 LineDecoration (org.apache.poi.sl.usermodel.LineDecoration)1 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)1 StrokeStyle (org.apache.poi.sl.usermodel.StrokeStyle)1