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


Golang gg.Context类代码示例

本文整理汇总了Golang中github.com/fogleman/gg.Context的典型用法代码示例。如果您正苦于以下问题:Golang Context类的具体用法?Golang Context怎么用?Golang Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: drawCurve

func drawCurve(dc *gg.Context) {
	dc.SetRGBA(0, 0, 0, 0.1)
	dc.FillPreserve()
	dc.SetRGB(0, 0, 0)
	dc.SetLineWidth(12)
	dc.Stroke()
}
开发者ID:yuer1727,项目名称:gospace,代码行数:7,代码来源:bezier.go

示例2: randomCubic

func randomCubic(dc *gg.Context) {
	x0, y0 := point()
	x1, y1 := point()
	x2, y2 := point()
	x3, y3 := point()
	dc.MoveTo(x0, y0)
	dc.CubicTo(x1, y1, x2, y2, x3, y3)
	drawCurve(dc)
	dc.MoveTo(x0, y0)
	dc.LineTo(x1, y1)
	dc.LineTo(x2, y2)
	dc.LineTo(x3, y3)
	drawPoints(dc)
}
开发者ID:yuer1727,项目名称:gospace,代码行数:14,代码来源:test_bezier.go

示例3: randomQuadratic

func randomQuadratic(dc *gg.Context) {
	x0, y0 := point()
	x1, y1 := point()
	x2, y2 := point()
	dc.MoveTo(x0, y0)
	dc.QuadraticTo(x1, y1, x2, y2)
	drawCurve(dc)
	dc.MoveTo(x0, y0)
	dc.LineTo(x1, y1)
	//dc.LineTo(x2, y2)
	drawPoints(dc)
}
开发者ID:yuer1727,项目名称:gospace,代码行数:12,代码来源:test_bezier.go

示例4: GraphUpdater

func GraphUpdater(dc *gg.Context) {

	ticker := time.NewTicker(1 * time.Second)
	defer ticker.Stop()
	for {
		select {
		case job := <-Queue:
			intVal, _ := strconv.Atoi(job)
			dc.DrawCircle(float64(TimerVal), float64(1000-(intVal)), 5)

			dc.Fill()
			dc.SavePNG("out.png")
			if TimerVal >= 1000 {
				TimerVal = 0
				dc.Clear()
			}
		case <-ticker.C:
			TimerVal = TimerVal + 1
		}
	}
}
开发者ID:jahantech,项目名称:Gograph,代码行数:21,代码来源:main.go

示例5: drawStartPoint

func drawStartPoint(dc *gg.Context) {
	dc.SetRGBA(0, 1, 0, 1)
	dc.SetLineWidth(20)
	dc.Stroke()
}
开发者ID:yuer1727,项目名称:gospace,代码行数:5,代码来源:test_bezier.go

示例6: drawPoints

func drawPoints(dc *gg.Context) {
	dc.SetRGBA(1, 0, 0, 1)
	dc.SetLineWidth(2)
	dc.Stroke()
}
开发者ID:yuer1727,项目名称:gospace,代码行数:5,代码来源:test_bezier.go

示例7: draw

func (m *Marker) draw(gc *gg.Context, trans *transformer) {
	gc.ClearPath()
	gc.SetLineJoin(gg.LineJoinRound)
	gc.SetLineWidth(1.0)

	radius := 0.5 * m.Size
	x, y := trans.ll2p(m.Position)
	gc.DrawArc(x, y-m.Size, radius, (90.0+60.0)*math.Pi/180.0, (360.0+90.0-60.0)*math.Pi/180.0)
	gc.LineTo(x, y)
	gc.ClosePath()
	gc.SetColor(m.Color)
	gc.FillPreserve()
	gc.SetRGB(0, 0, 0)
	gc.Stroke()

	if m.Label != "" {
		if Luminance(m.Color) >= 0.5 {
			gc.SetColor(color.RGBA{0x00, 0x00, 0x00, 0xff})
		} else {
			gc.SetColor(color.RGBA{0xff, 0xff, 0xff, 0xff})
		}
		gc.DrawStringAnchored(m.Label, x, y-m.Size, 0.5, 0.5)
	}
}
开发者ID:flopp,项目名称:go-staticmaps,代码行数:24,代码来源:marker.go

示例8: draw

func (p *Path) draw(gc *gg.Context, trans *transformer) {
	if len(p.Positions) <= 1 {
		return
	}

	gc.ClearPath()
	gc.SetLineWidth(p.Weight)
	gc.SetLineCap(gg.LineCapRound)
	gc.SetLineJoin(gg.LineJoinRound)
	for _, ll := range p.Positions {
		gc.LineTo(trans.ll2p(ll))
	}
	gc.SetColor(p.Color)
	gc.Stroke()
}
开发者ID:flopp,项目名称:go-staticmaps,代码行数:15,代码来源:path.go


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