Example #1
0
func Triangle(right, left, top point.Coord, c ColorDef) string {
	cType := "tw"
	if c == BLACK {
		cType = "tb"
	}
	return fmt.Sprintf(triTemplate,
		twop(right.Xf()), twop(right.Yf()),
		twop(left.Xf()), twop(left.Yf()),
		twop(top.Xf()), twop(top.Yf()),
		cType)
}
Example #2
0
func Circle(pt point.Coord, r float64, c ColorDef) string {
	return fmt.Sprintf(circleTemplate, c, twop(pt.Xf()), twop(pt.Yf()), twop(r))
}
Example #3
0
func Cross(tl, bl, br, tr point.Coord, c ColorDef) string {
	cType := "xw"
	if c == BLACK {
		cType = "xb"
	}
	return fmt.Sprintf(crossTemplate,
		twop(tl.Xf()), twop(tl.Yf()),
		twop(br.Xf()), twop(br.Yf()),
		twop(bl.Xf()), twop(bl.Yf()),
		twop(tr.Xf()), twop(tr.Yf()),
		cType)
}
Example #4
0
func Line(s, e point.Coord) string {
	return fmt.Sprintf(lineTemplate,
		twop(s.Xf()), twop(s.Yf()), twop(e.Xf()), twop(e.Yf()))
}
Example #5
0
func WhiteDisc(pt point.Coord, r float64) string {
	return fmt.Sprintf(discTemplate, twop(pt.Xf()), twop(pt.Yf()), twop(r))
}
Example #6
0
func Text(pt point.Coord, size float64, chars string, c ColorDef) string {
	fsize := twop(size) - 2
	return fmt.Sprintf(textTemplate, chars,
		twop(pt.Xf()), twop(pt.Yf()-fsize/3), c)
}
Example #7
0
func Square(tl, bl, br, tr point.Coord, c ColorDef) string {
	cType := "qw"
	if c == BLACK {
		cType = "qb"
	}
	return fmt.Sprintf(squareTemplate,
		twop(tl.Xf()), twop(tl.Yf()),
		twop(bl.Xf()), twop(bl.Yf()),
		twop(br.Xf()), twop(br.Yf()),
		twop(tr.Xf()), twop(tr.Yf()),
		cType)
}