public Rectangle2D.Double getDrawingArea() {
   double strokeTotalWidth = AttributeKeys.getStrokeTotalWidth(this);
   double width = strokeTotalWidth / 2d;
   if (STROKE_JOIN.get(this) == BasicStroke.JOIN_MITER) {
     width *= STROKE_MITER_LIMIT.get(this);
   } else if (STROKE_CAP.get(this) != BasicStroke.CAP_BUTT) {
     width += strokeTotalWidth * 2;
   }
   width++;
   Rectangle2D.Double r = getBounds();
   Geom.grow(r, width, width);
   return r;
 }
示例#2
0
  /** Sets SVG default values. */
  public static void setDefaults(Figure f) {
    // Fill properties
    // http://www.w3.org/TR/SVGMobile12/painting.html#FillProperties
    FILL_COLOR.basicSet(f, Color.black);
    WINDING_RULE.basicSet(f, WindingRule.NON_ZERO);

    // Stroke properties
    // http://www.w3.org/TR/SVGMobile12/painting.html#StrokeProperties
    STROKE_COLOR.basicSet(f, null);
    STROKE_WIDTH.basicSet(f, 1d);
    STROKE_CAP.basicSet(f, BasicStroke.CAP_BUTT);
    STROKE_JOIN.basicSet(f, BasicStroke.JOIN_MITER);
    STROKE_MITER_LIMIT.basicSet(f, 4d);
    IS_STROKE_MITER_LIMIT_FACTOR.basicSet(f, false);
    STROKE_DASHES.basicSet(f, null);
    STROKE_DASH_PHASE.basicSet(f, 0d);
    IS_STROKE_DASH_FACTOR.basicSet(f, false);
  }