func (l *Line) DrawEndpoints(ctx *cairo.Surface) { ctx.MoveTo(l.start.Float64()) ctx.LineTo(l.end.Float64()) ctx.Stroke() l.start.Draw(ctx) l.end.Draw(ctx) }
func (m *Map) ColourFaces(ctx *cairo.Surface, brush func(*Face) (float64, float64, float64, float64)) { m.Faces.Do(func(f interface{}) { F := f.(*Face) ctx.SetSourceRGBA(brush(F)) e := F.boundary ctx.MoveTo(e.start.Float64()) for f := e.Next(); f != e; f = f.Next() { ctx.LineTo(f.start.Float64()) } ctx.ClosePath() ctx.Fill() }) }
func (m *Map) ColourDebugFaces(ctx *cairo.Surface) { n := float64(m.Faces.Len()) i := 0. m.Faces.Do(func(f interface{}) { F, _ := f.(*Face) if F.Value.(string) == "outer" { return } e := F.boundary ctx.MoveTo(e.start.Float64()) for f := e.Next(); f != e; f = f.Next() { ctx.LineTo(f.start.Float64()) } ctx.ClosePath() if F.Value.(string) == "skeleton" { ctx.SetSourceRGBA(0., 0., 1., 1.) } else { ctx.SetSourceRGBA(i/n, 0., 0., 1.) } ctx.Fill() i = i + 1. }) }