github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/p/demo/svg/z0_filetest.gno (about)

     1  // PKGPATH: gno.land/p/demo/svg_test
     2  package svg_test
     3  
     4  import "gno.land/p/demo/svg"
     5  
     6  func main() {
     7  	canvas := svg.Canvas{Width: 500, Height: 500}
     8  	canvas.DrawRectangle(50, 50, 100, 100, "red")
     9  	canvas.DrawCircle(100, 100, 50, "blue")
    10  	canvas.DrawText(100, 100, "hello world!", "magenta")
    11  	println(canvas)
    12  }
    13  
    14  // Output:
    15  // <svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"><rect x="50" y="50" width="100" height="100" fill="red" /><circle cx="100" cy="100" r="50" fill="blue" /><text x="100" y="100" fill="magenta">hello world!</text></svg>