diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/obscuren/qml/examples/imgprovider/imgprovider.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/obscuren/qml/examples/imgprovider/imgprovider.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/examples/imgprovider/imgprovider.go b/Godeps/_workspace/src/github.com/obscuren/qml/examples/imgprovider/imgprovider.go deleted file mode 100644 index 533a23b86..000000000 --- a/Godeps/_workspace/src/github.com/obscuren/qml/examples/imgprovider/imgprovider.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "fmt" - "gopkg.in/qml.v1" - "image" - "image/png" - "os" -) - -func main() { - if err := qml.Run(run); err != nil { - fmt.Fprintf(os.Stderr, "error: %v\n", err) - os.Exit(1) - } -} - -func run() error { - engine := qml.NewEngine() - engine.AddImageProvider("pwd", func(id string, width, height int) image.Image { - f, err := os.Open(id) - if err != nil { - panic(err) - } - defer f.Close() - image, err := png.Decode(f) - if err != nil { - panic(err) - } - return image - }) - - component, err := engine.LoadFile("imgprovider.qml") - if err != nil { - return err - } - - win := component.CreateWindow(nil) - win.Show() - win.Wait() - - return nil -} |