예제 #1
0
func (g *Generator) genStarPoints(mt *core.Movetree) *Generator {
	sp := getStarPoints(mt.Intersections())
	for _, pt := range sp {
		c := g.c.CoordMap[pt.String()]
		g.b.WriteString(StarPoint(c, g.c.Radius*.15))
	}
	return g
}
예제 #2
0
// Generate an EPS image for a baduk Movetree.
func Generate(mt *core.Movetree, side int) []byte {
	g := &Generator{
		side:    side,
		c:       ConstructCoords(mt.Intersections(), side),
		bstones: make(map[string]bool),
		wstones: make(map[string]bool),
	}
	g.header().content(mt).footer()
	return g.b.Bytes()
}
예제 #3
0
func (g *Generator) genLines(mt *core.Movetree) *Generator {
	ints := mt.Intersections()
	for i := 0; i < ints; i++ {
		rowStart, _ := g.c.CoordMap[(&point.IntPt{i, 0}).String()]
		rowEnd, _ := g.c.CoordMap[(&point.IntPt{i, ints - 1}).String()]
		g.b.WriteString(Line(rowStart, rowEnd))
		colStart := g.c.CoordMap[(&point.IntPt{0, i}).String()]
		colEnd := g.c.CoordMap[(&point.IntPt{ints - 1, i}).String()]
		g.b.WriteString(Line(colStart, colEnd))
	}
	g.b.WriteString(Stroke(0.5))
	return g
}