当前位置: 首页>>代码示例>>Golang>>正文


Golang Length.Points方法代码示例

本文整理汇总了Golang中github.com/gonum/plot/vg.Length.Points方法的典型用法代码示例。如果您正苦于以下问题:Golang Length.Points方法的具体用法?Golang Length.Points怎么用?Golang Length.Points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/gonum/plot/vg.Length的用法示例。


在下文中一共展示了Length.Points方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: New

func New(w, h vg.Length) *Canvas {
	buf := new(bytes.Buffer)
	c := &Canvas{
		svg: svgo.New(buf),
		w:   w,
		h:   h,
		buf: buf,
		ht:  w.Points(),
		stk: []context{context{}},
	}

	// This is like svg.Start, except it uses floats
	// and specifies the units.
	fmt.Fprintf(buf, `<?xml version="1.0"?>
<!-- Generated by SVGo and Plotinum VG -->
<svg width="%.*gin" height="%.*gin"
	xmlns="http://www.w3.org/2000/svg"
	xmlns:xlink="http://www.w3.org/1999/xlink">`+"\n",
		pr, w/vg.Inch,
		pr, h/vg.Inch,
	)

	// Swap the origin to the bottom left.
	// This must be matched with a </g> when saving,
	// before the closing </svg>.
	c.svg.Gtransform(fmt.Sprintf("scale(1, -1) translate(0, -%.*g)", pr, h.Dots(c)))

	vg.Initialize(c)
	return c
}
开发者ID:nolenroyalty,项目名称:bangarang,代码行数:30,代码来源:vgsvg.go

示例2: unit

// unit returns a pdf.Unit, converted from a vg.Length.
func unit(l vg.Length) pdf.Unit {
	return pdf.Unit(l.Points()) * pdf.Pt
}
开发者ID:zzn01,项目名称:plot,代码行数:4,代码来源:vgpdf.go


注:本文中的github.com/gonum/plot/vg.Length.Points方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。