@Override
 public Rectangle2D.Double getDrawingArea() {
   if (cachedDrawingArea == null) {
     if (get(TRANSFORM) == null) {
       cachedDrawingArea = path.getBounds2D();
     } else {
       BezierPath p2 = (BezierPath) path.clone();
       p2.transform(get(TRANSFORM));
       cachedDrawingArea = p2.getBounds2D();
     }
     double strokeTotalWidth = AttributeKeys.getStrokeTotalWidth(this);
     double width = strokeTotalWidth / 2d;
     if (get(STROKE_JOIN) == BasicStroke.JOIN_MITER) {
       width *= get(STROKE_MITER_LIMIT);
     } else if (get(STROKE_CAP) != BasicStroke.CAP_BUTT) {
       width += strokeTotalWidth * 2;
     }
     Geom.grow(cachedDrawingArea, width, width);
   }
   return (Rectangle2D.Double) cachedDrawingArea.clone();
 }
Example #2
0
 @Override
 public Rectangle2D.Double getBounds() {
   Rectangle2D.Double bounds = path.getBounds2D();
   return bounds;
 }