|
|
|
@ -206,14 +206,12 @@ public final class QrCode {
|
|
|
|
|
public String toSvgString(int border) {
|
|
|
|
|
if (border < 0)
|
|
|
|
|
throw new IllegalArgumentException("Border must be non-negative");
|
|
|
|
|
if (size + border * 2L > Integer.MAX_VALUE)
|
|
|
|
|
throw new IllegalArgumentException("Border too large");
|
|
|
|
|
|
|
|
|
|
long brd = border;
|
|
|
|
|
StringBuilder sb = new StringBuilder()
|
|
|
|
|
.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
|
|
|
|
.append("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n")
|
|
|
|
|
.append(String.format("<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 %1$d %1$d\" stroke=\"none\">\n",
|
|
|
|
|
size + border * 2))
|
|
|
|
|
size + brd * 2))
|
|
|
|
|
.append("\t<rect width=\"100%\" height=\"100%\" fill=\"#FFFFFF\"/>\n")
|
|
|
|
|
.append("\t<path d=\"");
|
|
|
|
|
boolean head = true;
|
|
|
|
@ -224,7 +222,7 @@ public final class QrCode {
|
|
|
|
|
head = false;
|
|
|
|
|
else
|
|
|
|
|
sb.append(" ");
|
|
|
|
|
sb.append(String.format("M%d,%dh1v1h-1z", x + border, y + border));
|
|
|
|
|
sb.append(String.format("M%d,%dh1v1h-1z", x + brd, y + brd));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|