Last active
December 5, 2016 14:59
-
-
Save LukeMcNemee/8d53f770b778720266b0 to your computer and use it in GitHub Desktop.
svg snippets for Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//svg header | |
public void toSvg(BufferedWriter bw) throws IOException { | |
bw.append("<svg xmlns=\"http://www.w3.org/2000/svg\">\n"); | |
for (GraphicsObject g : graphics) { | |
g.toSvg(bw); | |
} | |
bw.append("</svg>\n"); | |
} | |
//svg for circle | |
public void toSvg(BufferedWriter bw) throws IOException { | |
bw.append("<circle cx=\""+ cx +"\" cy=\""+cy+"\" r=\""+r+"\" stroke=\"" +stroke+ "\" stroke-width=\""+ strokeWidth+"\" fill=\""+ fill+"\"/>\n"); | |
} | |
//svg for rectangle | |
public void toSvg(BufferedWriter bw) throws IOException { | |
bw.append("<rect x=\""+ x +"\" y=\""+y+"\" height=\""+height+"\" width=\""+width+"\" stroke=\"" +stroke+ "\" stroke-width=\""+ strokeWidth+"\" fill=\""+ fill+"\"/>\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment