How to write a Polyline in GoLang

huangapple go评论79阅读模式
英文:

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=&quot;none&quot;`}
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=&quot;none&quot;`}
canvas.Polyline(x, y, s...)

huangapple
  • 本文由 发表于 2014年10月30日 05:50:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/26641273.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定