/** 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); }
public void draw(Graphics2D g) { if (AttributeKeys.FILL_COLOR.get(this) != null) { g.setColor(AttributeKeys.FILL_COLOR.get(this)); drawFill(g); } if (STROKE_COLOR.get(this) != null && STROKE_WIDTH.get(this) > 0d) { g.setStroke(AttributeKeys.getStroke(this)); g.setColor(STROKE_COLOR.get(this)); drawStroke(g); } if (TEXT_COLOR.get(this) != null) { if (TEXT_SHADOW_COLOR.get(this) != null && TEXT_SHADOW_OFFSET.get(this) != null) { Dimension2DDouble d = TEXT_SHADOW_OFFSET.get(this); g.translate(d.width, d.height); g.setColor(TEXT_SHADOW_COLOR.get(this)); drawText(g); g.translate(-d.width, -d.height); } g.setColor(TEXT_COLOR.get(this)); drawText(g); } }