Example #1
0
func drawCurve(dc *gg.Context) {
	dc.SetRGBA(0, 0, 0, 0.1)
	dc.FillPreserve()
	dc.SetRGB(0, 0, 0)
	dc.SetLineWidth(12)
	dc.Stroke()
}
Example #2
0
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)
	}
}