本文整理汇总了Golang中github.com/vron/plotinum/vg.Path类的典型用法代码示例。如果您正苦于以下问题:Golang Path类的具体用法?Golang Path怎么用?Golang Path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Path类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DrawGlyph
// DrawGlyph implements the Glyph interface.
func (BoxGlyph) DrawGlyph(da *DrawArea, sty GlyphStyle, pt Point) {
x := (sty.Radius-sty.Radius*cosπover4)/2 + sty.Radius*cosπover4
var p vg.Path
p.Move(pt.X-x, pt.Y-x)
p.Line(pt.X+x, pt.Y-x)
p.Line(pt.X+x, pt.Y+x)
p.Line(pt.X-x, pt.Y+x)
p.Close()
da.Fill(p)
}
示例2: StrokeLines
// StrokeLines draws a line connecting a set of points
// in the given DrawArea.
func (da *DrawArea) StrokeLines(sty LineStyle, lines ...[]Point) {
if len(lines) == 0 {
return
}
da.setLineStyle(sty)
for _, l := range lines {
if len(l) == 0 {
continue
}
var p vg.Path
p.Move(l[0].X, l[0].Y)
for _, pt := range l[1:] {
p.Line(pt.X, pt.Y)
}
da.Stroke(p)
}
}
示例3: FillPolygon
// FillPolygon fills a polygon with the given color.
func (da *DrawArea) FillPolygon(clr color.Color, pts []Point) {
if len(pts) == 0 {
return
}
da.SetColor(clr)
var p vg.Path
p.Move(pts[0].X, pts[0].Y)
for _, pt := range pts[1:] {
p.Line(pt.X, pt.Y)
}
p.Close()
da.Fill(p)
}
示例4: Plot
// Plot implements the Plot method of the plot.Plotter interface.
func (bs *Bubbles) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
da.SetColor(bs.Color)
for _, d := range bs.XYZs {
x := trX(d.X)
y := trY(d.Y)
if !da.Contains(plot.Point{x, y}) {
continue
}
rad := bs.radius(d.Z)
// draw a circle centered at x, y
var p vg.Path
p.Move(x+rad, y)
p.Arc(x, y, rad, 0, 2*math.Pi)
p.Close()
da.Fill(p)
}
}