Example #1
0
 public void drawDashedLine(int d, int x1, int y1, int x2, int y2) {
   Stroke s = getStroke();
   float w = 1;
   int c = BasicStroke.CAP_BUTT;
   int j = BasicStroke.JOIN_MITER;
   float ml = 0;
   float[] dp = {d, d};
   if (s instanceof BasicStroke) {
     BasicStroke b = (BasicStroke) s;
     w = b.getLineWidth();
     c = b.getEndCap();
     j = b.getLineJoin();
     ml = b.getMiterLimit();
   }
   setStroke(new BasicStroke(w, c, j, ml, dp, 0));
   drawLine(x1, y1, x2, y2);
   setStroke(s);
 }
 private void writePathElement(IXMLElement parent, SVGPathFigure f) throws IOException {
     GrowStroke growStroke = new GrowStroke((float) (getStrokeTotalWidth(f) / 2d), (float) getStrokeTotalWidth(f));
     BasicStroke basicStroke = new BasicStroke((float) getStrokeTotalWidth(f));
     for (Figure child : f.getChildren()) {
         SVGBezierFigure bezier = (SVGBezierFigure) child;
         IXMLElement elem = parent.createElement("area");
         if (bezier.isClosed()) {
             writePolyAttributes(elem, f, growStroke.
                     createStrokedShape(bezier.getBezierPath())
                     );
         } else {
             writePolyAttributes(elem, f, basicStroke.
                     createStrokedShape(bezier.getBezierPath())
                     );
         }
         parent.addChild(elem);
     }
 }
Example #3
0
  /** [Internal] */
  public String obj2str(Object o) {
    if (o == null) return "-null-";
    String s = "";
    if (o instanceof Object[]) {
      Object[] a = (Object[]) o;
      for (Object ox : a) s = s + " " + ox;
    } else if (o instanceof BasicStroke) {
      BasicStroke o1 = (BasicStroke) o;
      s =
          "BasicStroke("
              + o1.getLineWidth()
              + ","
              + o1.getDashPhase()
              + ","
              + o1.getLineJoin()
              + ","
              + o1.getMiterLimit()
              + ","
              + o1.getEndCap();

    } else s = "" + o;
    return s;
  }