英文:
How to write a Polyline in GoLang
问题
我想在Go语言中使用一组坐标打印一个"Polyline()"函数:
x y
300 250
400 350
250 600
我不理解这个结构:
Polyline(x []int, y []int, s ...string)
请展示如何在Go语言中处理这个折线。
英文:
I want to print a "Polyline()" function in go lang with the set of coordinates:
x y
300 250
400 350
250 600
I don't understand this structure:
Polyline(x []int, y []int, s ...string)
Please show how to carry about that polyline in GoLang
答案1
得分: 1
> package svg
>
> 导入 "github.com/ajstarks/svgo" 包
>
> Package svg 生成符合可缩放矢量图形(Scalable Vector Graphics)1.1 规范(<http://www.w3.org/TR/SVG11/>)的 SVG。输出将发送到指定的 io.Writer。
>
> func (*SVG) Polyline
>
> func (svg *SVG) Polyline(x []int, y []int, s ...string)
>
> Polyline 函数在坐标之间绘制连接线,并可选择添加样式。标准参考链接:http://www.w3.org/TR/SVG11/shapes.html#PolylineElement
例如,
x := []int{300, 400, 250}
y := []int{250, 350, 600}
s := []string{`fill="none"`}
canvas.Polyline(x, y, s...)
英文:
> package svg
>
> import "github.com/ajstarks/svgo"
>
> Package svg generates SVG as defined by the Scalable Vector Graphics
> 1.1 Specification (<http://www.w3.org/TR/SVG11/>). Output goes to the specified io.Writer.
>
> func (*SVG) Polyline
>
> func (svg *SVG) Polyline(x []int, y []int, s ...string)
>
> Polyline draws connected lines between coordinates, with optional
> style. Standard Reference:
> http://www.w3.org/TR/SVG11/shapes.html#PolylineElement
For example,
x := []int{300, 400, 250}
y := []int{250, 350, 600}
s := []string{`fill="none"`}
canvas.Polyline(x, y, s...)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论