本文整理匯總了Golang中github.com/Tradnaiofh/plotinum/vg.Path.Line方法的典型用法代碼示例。如果您正苦於以下問題:Golang Path.Line方法的具體用法?Golang Path.Line怎麽用?Golang Path.Line使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Tradnaiofh/plotinum/vg.Path
的用法示例。
在下文中一共展示了Path.Line方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DrawGlyph
// DrawGlyph implements the Glyph interface.
func (PyramidGlyph) DrawGlyph(da *DrawArea, sty GlyphStyle, pt Point) {
r := sty.Radius + (sty.Radius-sty.Radius*sinπover6)/2
var p vg.Path
p.Move(pt.X, pt.Y+r)
p.Line(pt.X-r*cosπover6, pt.Y-r*sinπover6)
p.Line(pt.X+r*cosπover6, pt.Y-r*sinπover6)
p.Close()
da.Fill(p)
}
示例2: 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)
}
示例3: 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)
}
}
示例4: Plot
// Plot draws the Line, implementing the plot.Plotter
// interface.
func (pts *Line) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
ps := make([]plot.Point, len(pts.XYs))
for i, p := range pts.XYs {
ps[i].X = trX(p.X)
ps[i].Y = trY(p.Y)
}
if pts.ShadeColor != nil && len(ps) > 0 {
da.SetColor(*pts.ShadeColor)
minY := trY(plt.Y.Min)
var pa vg.Path
pa.Move(ps[0].X, minY)
for i := range pts.XYs {
pa.Line(ps[i].X, ps[i].Y)
}
pa.Line(ps[len(pts.XYs)-1].X, minY)
pa.Close()
da.Fill(pa)
}
da.StrokeLines(pts.LineStyle, da.ClipLinesXY(ps)...)
}