本文整理汇总了Golang中code/google/com/p/plotinum/vg.Path.Arc方法的典型用法代码示例。如果您正苦于以下问题:Golang Path.Arc方法的具体用法?Golang Path.Arc怎么用?Golang Path.Arc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/plotinum/vg.Path
的用法示例。
在下文中一共展示了Path.Arc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DrawGlyph
// DrawGlyph implements the GlyphDrawer interface.
func (c CircleGlyph) DrawGlyph(da *DrawArea, sty GlyphStyle, pt Point) {
var p vg.Path
p.Move(pt.X+sty.Radius, pt.Y)
p.Arc(pt.X, pt.Y, sty.Radius, 0, 2*math.Pi)
p.Close()
da.Fill(p)
}
示例2: Plot
func (pt *Dots) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
da.SetColor(pt.Color)
for i := range pt.Y {
// Transform the data x, y coordinate of this bubble
// to the corresponding drawing coordinate.
x := trX(pt.X[i])
y := trY(pt.Y[i])
// Get the radius of this bubble. The radius
// is specified in drawing units (i.e., its size
// is given as the final size at which it will
// be drawn) so it does not need to be transformed.
rad := vg.Length(2)
// Fill a circle centered at x,y on the draw area.
var p vg.Path
p.Move(x+rad, y)
p.Arc(x, y, rad, 0, 2*math.Pi)
p.Close()
da.Fill(p)
}
}
示例3: 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)
}
}
示例4: DrawArcs
// DrawArcs draws some arcs to the canvas.
// The canvas is assumed to be 4 inches square.
func DrawArcs(c vg.Canvas) {
green := color.RGBA{G: 255, A: 255}
var p vg.Path
p.Move(vg.Inches(3), vg.Inches(2))
p.Arc(vg.Inches(2), vg.Inches(2), vg.Inches(1), 0, 2*math.Pi)
c.SetColor(color.RGBA{B: 255, A: 255})
c.Fill(p)
p = vg.Path{}
p.Move(vg.Inches(4), vg.Inches(2))
p.Line(vg.Inches(3), vg.Inches(2))
p.Arc(vg.Inches(2), vg.Inches(2), vg.Inches(1), 0, 5*math.Pi/2)
p.Line(vg.Inches(2), vg.Inches(4))
c.SetColor(color.RGBA{R: 255, A: 255})
c.SetLineWidth(vg.Points(3))
c.Stroke(p)
p = vg.Path{}
p.Move(vg.Inches(0), vg.Inches(2))
p.Line(vg.Inches(1), vg.Inches(2))
p.Arc(vg.Inches(2), vg.Inches(2), vg.Inches(1), math.Pi, -7*math.Pi/2)
p.Line(vg.Inches(2), vg.Inches(0))
c.SetColor(color.Black)
c.SetLineWidth(vg.Points(1))
c.Stroke(p)
p = vg.Path{}
p.Move(vg.Inches(0), vg.Inches(1))
p.Arc(vg.Inches(1), vg.Inches(1), vg.Inches(1), math.Pi, math.Pi/2)
c.SetLineWidth(vg.Points(3))
c.SetColor(green)
c.Stroke(p)
p = vg.Path{}
p.Move(vg.Inches(1), vg.Inches(0))
p.Arc(vg.Inches(1), vg.Inches(1), vg.Inches(1), 3*math.Pi/2, -math.Pi/2)
c.SetLineWidth(vg.Points(1))
c.SetColor(color.Black)
c.Stroke(p)
p = vg.Path{}
p.Move(vg.Inches(3), vg.Inches(2))
p.Arc(vg.Inches(3), vg.Inches(3), vg.Inches(1), 3*math.Pi/2, 3*math.Pi/2)
c.SetLineWidth(vg.Points(3))
c.SetColor(green)
c.Stroke(p)
p = vg.Path{}
p.Move(vg.Inches(2), vg.Inches(3))
p.Arc(vg.Inches(3), vg.Inches(3), vg.Inches(1), math.Pi, -3*math.Pi/2)
c.SetLineWidth(vg.Points(1))
c.SetColor(color.Black)
c.Stroke(p)
}