diff options
Diffstat (limited to 'vendor/github.com/fogleman/gg/examples/lines.go')
| -rw-r--r-- | vendor/github.com/fogleman/gg/examples/lines.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/github.com/fogleman/gg/examples/lines.go b/vendor/github.com/fogleman/gg/examples/lines.go new file mode 100644 index 0000000..9581dd6 --- /dev/null +++ b/vendor/github.com/fogleman/gg/examples/lines.go @@ -0,0 +1,31 @@ +package main + +import ( + "math/rand" + + "github.com/fogleman/gg" +) + +func main() { + const W = 1024 + const H = 1024 + dc := gg.NewContext(W, H) + dc.SetRGB(0, 0, 0) + dc.Clear() + for i := 0; i < 1000; i++ { + x1 := rand.Float64() * W + y1 := rand.Float64() * H + x2 := rand.Float64() * W + y2 := rand.Float64() * H + r := rand.Float64() + g := rand.Float64() + b := rand.Float64() + a := rand.Float64()*0.5 + 0.5 + w := rand.Float64()*4 + 1 + dc.SetRGBA(r, g, b, a) + dc.SetLineWidth(w) + dc.DrawLine(x1, y1, x2, y2) + dc.Stroke() + } + dc.SavePNG("out.png") +} |
