summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
commit52107acee7d2ee91c9cdc2d4411d8ae57d6925ba (patch)
treee644b0c555c667d4084980565d5641c7ead3db35
parent22837c7bf088e803ab4ff8f1d6bf26855ade4c26 (diff)
examples: add a simple example using the lgi lua binding
-rwxr-xr-xexamples/lgi.lua37
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()
+