diff options
author | Øyvind Kolås <pippin@gimp.org> | 2015-06-09 22:58:05 +0200 |
---|---|---|
committer | Øyvind Kolås <pippin@gimp.org> | 2015-06-09 22:58:05 +0200 |
commit | 52107acee7d2ee91c9cdc2d4411d8ae57d6925ba (patch) | |
tree | e644b0c555c667d4084980565d5641c7ead3db35 | |
parent | 22837c7bf088e803ab4ff8f1d6bf26855ade4c26 (diff) |
examples: add a simple example using the lgi lua binding
-rwxr-xr-x | examples/lgi.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/lgi.lua b/examples/lgi.lua new file mode 100755 index 00000000..3b8b6f8f --- /dev/null +++ b/examples/lgi.lua @@ -0,0 +1,37 @@ +#!/usr/bin/env luajit + +local lgi = require 'lgi' +local GObject = lgi.GObject -- +local Gegl = lgi.Gegl + +Gegl.init(arg) +local graph = Gegl.Node() + +local src = graph:create_child("gegl:load") + +src:set_property("path", GObject.Value(GObject.Type.STRING, "data/surfer.png")) + +local crop = graph:create_child('gegl:crop') +crop:set_property("x", GObject.Value(GObject.Type.INT, 0)) +crop:set_property("y", GObject.Value(GObject.Type.INT, 0)) +crop:set_property("width", GObject.Value(GObject.Type.INT, 300)) +crop:set_property("height", GObject.Value(GObject.Type.INT, 122)) + +local dst = graph:create_child("gegl:save") + +dst:set_property("path", GObject.Value(GObject.Type.STRING, "lgi.png")) + +local text = graph:create_child("gegl:text") +local white = Gegl.Color() +white:set_rgba(1,1,1,1) +text:set_property("string", GObject.Value(GObject.Type.STRING, "luajit + lgi + GEGL test")) +text:set_property("color", GObject.Value(GObject.Type.OBJECT, white)) + +local over = graph:create_child("gegl:over") + +src:connect_to("output", crop, "input") +crop:connect_to("output", over, "input") +text:connect_to("output", over, "aux") +over:connect_to("output", dst, "input") +dst:process() + |