-
Notifications
You must be signed in to change notification settings - Fork 13
/
combos.go
67 lines (55 loc) · 1.15 KB
/
combos.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"github.com/buchanae/ink/color"
. "github.com/buchanae/ink/dd"
"github.com/buchanae/ink/gfx"
"github.com/buchanae/ink/rand"
)
func Ink(doc gfx.Doc) {
rand.SeedNow()
center := XY{0.5, 0.5}
grid := Grid{
Rows: 32,
Cols: 16,
Rect: RectCenter(center, XY{.5, .97}),
}
sub := Grid{Rows: 3, Cols: 3}
var bold []Strokeable
var strokes []Strokeable
for i, cell := range grid.Cells() {
r := cell.Rect.Shrink(0.003)
bold = append(bold, r)
for j, sc := range sub.Cells() {
sr := sc.Rect
xr := Rect{
A: r.Interpolate(sr.A),
B: r.Interpolate(sr.B),
}
strokes = append(strokes, xr)
// TODO interleaving a stroke
// causes all the batching to fail
// TODO move these things to an examples
// folder demonstrating performance
// issues
//doc.Shader(stk)
mask := 1 << j
if i&mask == mask {
gfx.Fill{xr, color.Black}.Draw(doc)
}
}
}
for _, stk := range strokes {
gfx.Stroke{
Shape: stk,
Width: 0.0002,
Color: color.Black,
}.Draw(doc)
}
for _, stk := range bold {
gfx.Stroke{
Shape: stk,
Width: 0.0009,
Color: color.Black,
}.Draw(doc)
}
}