summaryrefslogtreecommitdiff
path: root/vendor/github.com/fogleman/gg/examples/tiling.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/fogleman/gg/examples/tiling.go')
-rw-r--r--vendor/github.com/fogleman/gg/examples/tiling.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/fogleman/gg/examples/tiling.go b/vendor/github.com/fogleman/gg/examples/tiling.go
new file mode 100644
index 0000000..9688722
--- /dev/null
+++ b/vendor/github.com/fogleman/gg/examples/tiling.go
@@ -0,0 +1,21 @@
+package main
+
+import "github.com/fogleman/gg"
+
+func main() {
+ const NX = 4
+ const NY = 3
+ im, err := gg.LoadPNG("examples/gopher.png")
+ if err != nil {
+ panic(err)
+ }
+ w := im.Bounds().Size().X
+ h := im.Bounds().Size().Y
+ dc := gg.NewContext(w*NX, h*NY)
+ for y := 0; y < NY; y++ {
+ for x := 0; x < NX; x++ {
+ dc.DrawImage(im, x*w, y*h)
+ }
+ }
+ dc.SavePNG("out.png")
+}