diff options
author | Martin Ashby <martin@martin-laptop.lan> | 2018-05-28 16:58:04 +0100 |
---|---|---|
committer | Martin Ashby <martin@martin-laptop.lan> | 2018-05-28 16:58:04 +0100 |
commit | 5afaaf0432d4c9b6c2d840492eff184af41c961e (patch) | |
tree | 592fd4eb0f2b8f3046efae32e98015745db2f402 | |
parent | 28f0ac19eb3b42601b0511131b5e39c77b80da9c (diff) | |
download | unicornpaint-5afaaf0432d4c9b6c2d840492eff184af41c961e.tar.gz unicornpaint-5afaaf0432d4c9b6c2d840492eff184af41c961e.tar.bz2 unicornpaint-5afaaf0432d4c9b6c2d840492eff184af41c961e.tar.xz unicornpaint-5afaaf0432d4c9b6c2d840492eff184af41c961e.zip |
TestGif.go tests showing a simple animated
GIF using new Unicorn2 interface
-rw-r--r-- | TestGif.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/TestGif.go b/TestGif.go new file mode 100644 index 0000000..ab4e33a --- /dev/null +++ b/TestGif.go @@ -0,0 +1,33 @@ +// +build ignore + +package main + +import ( + "bytes" + "image/gif" + "log" + + "github.com/MFAshby/unicornpaint/unicorn" +) + +func main() { + un, err := unicorn.NewUnicorn2() + if err != nil { + log.Fatalf("Error getting a unicorn :( %v", err) + } + + data, err := unicorn.Asset("data/sample2.gif") + if err != nil { + log.Fatalf("Error getting rain %v", err) + } + + g, err := gif.DecodeAll(bytes.NewReader(data)) + if err != nil { + log.Fatalf("Error decoding gif %v", err) + } + + un.SetGif(g) + stopChan := un.StartRender() + un.MainLoop() + stopChan <- true +} |