z1_filetest.gno
0.67 Kb ยท 19 lines
1// PKGPATH: gno.land/p/demo/svg_test
2package svg_test
3
4import "gno.land/p/demo/svg"
5
6func main() {
7 canvas := svg.Canvas{
8 Width: 500, Height: 500,
9 Elems: []svg.Elem{
10 svg.Rectangle{X: 50, Y: 50, Width: 100, Height: 100, Fill: "red"},
11 svg.Circle{CX: 50, CY: 50, R: 100, Fill: "red"},
12 svg.Text{X: 100, Y: 100, Text: "hello world!", Fill: "magenta"},
13 },
14 }
15 println(canvas)
16}
17
18// Output:
19// <svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox=""><rect x="50" y="50" width="100" height="100" rx="0" ry="0" fill="red" /><circle cx="50" cy="50" r="100" fill="red" /><text x="100" y="100" dx="0" dy="0" rotate="" fill="magenta" >hello world!</text></svg>