-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
245 lines (176 loc) · 5.1 KB
/
main.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
package main
import (
"math"
"math/rand"
"github.com/fogleman/gg"
)
const W = 1920.0
const H = 1080.0
const step = 20.0
var colorPalettes = map[string][]string{
"Palette1": {"2B2E4A", "E84545", "903749", "53354A"},
"Palette2": {"2e4252", "738e85", "bebba1", "e5dab9"},
"Palette3": {"0f0f1b", "565a75", "c6b7be", "fafbf6"},
"Palette4": {"46425e", "5b768d", "d17c7c", "f6c6a8"},
"Palette5": {"090110", "1a1e25", "3d3e32", "6f653d"},
"Palette6": {"99B898", "FECEAB", "FF847C", "E84A5F"},
}
func draw_line() {
dc := gg.NewContext(W, H)
dc.SetRGB(1, 1, 1)
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.DrawLine(i, j, i+step, j+step)
dc.SetLineWidth(5.0)
dc.Stroke()
}
}
dc.SavePNG("draw_lines.png")
}
func draw_line_color() {
palette := "Palette1"
dc := gg.NewContext(W, H)
dc.SetHexColor(colorPalettes[palette][0])
dc.Clear()
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.DrawLine(i, j, i+step, j+step)
dc.SetLineWidth(5.0)
color_index := rand.Intn(3) + 1
dc.SetHexColor(colorPalettes[palette][color_index])
dc.Stroke()
}
}
dc.SavePNG("draw_line_color.png")
}
func draw_line_palette() {
dc := gg.NewContext(W, H)
for palette, colors := range colorPalettes {
dc.SetHexColor(colors[0])
dc.Clear()
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.DrawLine(i, j, i+step, j+step)
dc.SetLineWidth(5.0)
color_index := rand.Intn(3) + 1
dc.SetHexColor(colors[color_index])
dc.Stroke()
}
}
dc.SavePNG("draw_line_palette_" + palette + ".png")
}
}
func draw_line_rotate() {
dc := gg.NewContext(W, H)
for palette, colors := range colorPalettes {
dc.SetHexColor(colors[0])
dc.Clear()
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.Push()
dc.RotateAbout(gg.Radians(90.0*float64(rand.Intn(4))), (i+i+step)*0.5, (j+j+step)*0.5)
// dc.DrawLine(i, j, i+i+step/2, i+j+step/2) // Weird
// dc.DrawLine(i, j, i+step, j+step) //Minions
dc.DrawLine((i+i+step)*0.5, (j+j+step)*0.5, i+step, j+step) //straight
// fmt.Printf("%v, %v, %v, %v", i, j, i+step, j+step)
dc.SetLineWidth(5.0)
color_index := rand.Intn(3) + 1
dc.SetHexColor(colors[color_index])
dc.Stroke()
dc.Pop()
}
}
dc.SavePNG("draw_line_rotate_" + palette + ".png")
}
}
func draw_line_stroke() {
dc := gg.NewContext(W, H)
for palette, colors := range colorPalettes {
dc.SetHexColor(colors[0])
dc.Clear()
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.Push()
dc.RotateAbout(gg.Radians(90.0*float64(rand.Intn(4))), (i+i+step)*0.5, (j+j+step)*0.5)
// dc.DrawLine(i, j, i+i+step/2, i+j+step/2) // Weird
dc.DrawLine(i, j, i+step, j+step) //Minions
// dc.DrawLine((i+i+step)*0.5, (j+j+step)*0.5, i+step, j+step) //straight
dc.SetLineWidth(rand.Float64()*10 + 1.0)
color_index := rand.Intn(3) + 1
dc.SetHexColor(colors[color_index])
dc.Stroke()
dc.Pop()
}
}
dc.SavePNG("draw_line_stroke_" + palette + ".png")
}
}
func draw_line_mixed() {
dc := gg.NewContext(W, H)
for palette, colors := range colorPalettes {
dc.SetHexColor(colors[0])
dc.Clear()
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.Push()
dc.RotateAbout(gg.Radians(90.0*float64(rand.Intn(4))), (i+i+step)*0.5, (j+j+step)*0.5)
// dc.DrawLine(i, j, i+i+step/2, i+j+step/2) // Weird
dc.DrawLine(i, j, i+step, j+step) //Minions
// dc.DrawLine((i+i+step)*0.5, (j+j+step)*0.5, i+step, j+step) //straight
if i < W/4 {
dc.SetLineWidth(rand.Float64()*4 + 0.4)
} else if i < W/3 {
dc.SetLineWidth(rand.Float64()*6 + 0.6)
} else if i < W/2 {
dc.SetLineWidth(rand.Float64()*8 + 0.8)
} else {
dc.SetLineWidth(rand.Float64()*10 + 1.0)
}
color_index := rand.Intn(3) + 1
dc.SetHexColor(colors[color_index])
dc.Stroke()
dc.Pop()
}
}
dc.SavePNG("draw_line_mixed_" + palette + ".png")
}
}
func draw_lines_circles() {
dc := gg.NewContext(W, H)
step := 40.0 //Updated step for just this function because smaller value is making it chaotic
count := 1.0
for palette, colors := range colorPalettes {
dc.SetHexColor(colors[0])
dc.Clear()
for i := 0.0; i < W; i += step {
for j := 0.0; j < H; j += step {
dc.Push()
dc.RotateAbout(gg.Radians(90.0*float64(rand.Intn(4))), (i+i+step)*0.5, (j+j+step)*0.5)
color_index := rand.Intn(3) + 1
if math.Remainder(count, 2) == 0.0 {
// dc.DrawLine(i, j, i+i+step/2, i+j+step/2) // Weird
// dc.DrawLine(i, j, i+step, j+step) //Minions
dc.DrawLine((i+i+step)*0.5, (j+j+step)*0.5, i+step, j+step) //straight
} else {
dc.DrawCircle(i, j, 10.0)
}
dc.SetLineWidth(5.0)
dc.SetHexColor(colors[color_index])
dc.Stroke()
dc.Pop()
count += 1.0
}
}
dc.SavePNG("draw_lines_circles_" + palette + ".png")
}
}
func main() {
//Uncomment the name of the you want to generate wallpapers of
// draw_line()
// draw_line_color()
// draw_line_palette()
// draw_line_rotate()
// draw_line_stroke()
// draw_line_mixed()
draw_lines_circles()
}