[gegl] examples: add a simple example using the lgi lua binding
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] examples: add a simple example using the lgi lua binding
- Date: Tue, 9 Jun 2015 20:59:45 +0000 (UTC)
commit 52107acee7d2ee91c9cdc2d4411d8ae57d6925ba
Author: Øyvind Kolås <pippin gimp org>
Date: Tue Jun 9 22:58:05 2015 +0200
examples: add a simple example using the lgi lua binding
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 0000000..3b8b6f8
--- /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()
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]