Пример #1
0
 private static void parseFill(SShape shape, Elem root) {
   if (!root.hasAttr("fill")) {
     shape.setFillPaint(FlatColor.BLACK);
     return;
   }
   String sfill = root.attr("fill");
   if (sfill.equals("none")) {
     shape.setFillPaint(null);
     return;
   }
   if (sfill.startsWith("#")) {
     shape.setFillPaint(new FlatColor(sfill));
     return;
   }
   u.p("trouble parsing fill: " + sfill);
 }
Пример #2
0
  private static void parseStroke(SShape shape, Elem root) {
    if (!root.hasAttr("stroke")) {
      shape.setStrokeWidth(1);
      shape.setStrokePaint(null);
    }
    String sstroke = root.attr("stroke");
    if (sstroke.equals("none")) {
      shape.setStrokePaint(null);
    }
    if (sstroke.startsWith("#")) {
      shape.setStrokePaint(new FlatColor(sstroke));
    }

    if (!root.hasAttr("stroke-width")) {
      shape.setStrokeWidth(1);
    } else {
      String sstrokeWidth = root.attr("stroke-width");
      double strokeWidth = Double.parseDouble(sstrokeWidth);
      shape.setStrokeWidth(strokeWidth);
    }
  }