add opacity to svg-export

This commit is contained in:
helmut.neemann 2016-06-27 15:52:50 +02:00
parent 7f7dd18595
commit f86e9b7693

View File

@ -109,7 +109,7 @@ public class GraphicSVG implements Graphic, Closeable {
// if (style.isDashed())
// addStrokeDash(w, style.getDashArray());
if (style.isFilled() && p.isClosed())
w.write(" stroke=\"" + getColor(style) + "\" stroke-width=\"" + getStrokeWidth(style) + "\" fill=\"" + getColor(style) + "\"/>\n");
w.write(" stroke=\"" + getColor(style) + "\" stroke-width=\"" + getStrokeWidth(style) + "\" fill=\"" + getColor(style) + "\" fill-opacity=\""+getOpacity(style)+"\"/>\n");
else
w.write(" stroke=\"" + getColor(style) + "\" stroke-width=\"" + getStrokeWidth(style) + "\" fill=\"none\"/>\n");
} catch (IOException e) {
@ -203,6 +203,12 @@ public class GraphicSVG implements Graphic, Closeable {
return "#" + Integer.toHexString(style.getColor().getRGB()).substring(2);
}
private String getOpacity(Style style) {
double op = style.getColor().getAlpha() / 255.0;
return Double.toString(op);
}
/**
* Escapes a given string to XML
*