當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Path.Close方法代碼示例

本文整理匯總了Golang中code/google/com/p/plotinum/vg.Path.Close方法的典型用法代碼示例。如果您正苦於以下問題:Golang Path.Close方法的具體用法?Golang Path.Close怎麽用?Golang Path.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在code/google/com/p/plotinum/vg.Path的用法示例。


在下文中一共展示了Path.Close方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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)
}
開發者ID:jen6,項目名稱:plotinum,代碼行數:8,代碼來源:draw.go

示例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)
	}
}
開發者ID:knodos,項目名稱:kmodel,代碼行數:25,代碼來源:dots.go

示例3: pathRectangle

func pathRectangle(top vg.Length, right vg.Length, bottom vg.Length, left vg.Length) vg.Path {
	p := vg.Path{}
	p.Move(left, top)
	p.Line(right, top)
	p.Line(right, bottom)
	p.Line(left, bottom)
	p.Close()
	return p
}
開發者ID:onsi,項目名稱:analyzer,代碼行數:9,代碼來源:shared.go

示例4: 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)
}
開發者ID:jen6,項目名稱:plotinum,代碼行數:15,代碼來源:draw.go

示例5: 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)
	}
}
開發者ID:jackielii,項目名稱:go-plotinum,代碼行數:23,代碼來源:bubbles.go

示例6: DrawFonts

// DrawFonts draws some text in all of the various
// fonts along with a box to make sure that their
// sizes are computed correctly.
func DrawFonts(c vg.Canvas) {
	y := vg.Points(0)
	var fonts []string
	for fname := range vg.FontMap {
		fonts = append(fonts, fname)
	}
	sort.Strings(fonts)
	for _, fname := range fonts {
		font, err := vg.MakeFont(fname, 20)
		if err != nil {
			panic(err)
		}

		w := font.Width(fname + "Xqg")
		h := font.Extents().Ascent

		c.FillString(font, 0, y-font.Extents().Descent, fname+"Xqg")
		fmt.Println(fname)

		var path vg.Path
		path.Move(0, y+h)
		path.Line(w, y+h)
		path.Line(w, y)
		path.Line(0, y)
		path.Close()
		c.Stroke(path)

		path = vg.Path{}
		c.SetColor(color.RGBA{B: 255, A: 255})
		c.SetLineDash([]vg.Length{vg.Points(5), vg.Points(3)}, 0)
		path.Move(0, y-font.Extents().Descent)
		path.Line(w, y-font.Extents().Descent)
		c.Stroke(path)
		c.SetColor(color.Black)
		c.SetLineDash([]vg.Length{}, 0)

		y += h
	}
}
開發者ID:vron,項目名稱:plotinum,代碼行數:42,代碼來源:main.go

示例7: 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)...)
}
開發者ID:jen6,項目名稱:plotinum,代碼行數:26,代碼來源:line.go


注:本文中的code/google/com/p/plotinum/vg.Path.Close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。