gegl r2822 - in trunk/bindings/vala: . samples



Author: bersace
Date: Thu Dec 11 16:34:40 2008
New Revision: 2822
URL: http://svn.gnome.org/viewvc/gegl?rev=2822&view=rev

Log:
Added Vala binding.

Added:
   trunk/bindings/vala/
   trunk/bindings/vala/AUTHORS
   trunk/bindings/vala/COPYING   (contents, props changed)
   trunk/bindings/vala/ChangeLog
   trunk/bindings/vala/INSTALL   (contents, props changed)
   trunk/bindings/vala/Makefile.am
   trunk/bindings/vala/NEWS
   trunk/bindings/vala/README
   trunk/bindings/vala/autogen.sh   (contents, props changed)
   trunk/bindings/vala/babl-0.0.vapi
   trunk/bindings/vala/configure.ac
   trunk/bindings/vala/gegl-0.0.deps
   trunk/bindings/vala/gegl-0.0.vapi
   trunk/bindings/vala/samples/
   trunk/bindings/vala/samples/Makefile.am
   trunk/bindings/vala/samples/buffer.vala
   trunk/bindings/vala/samples/format.vala
   trunk/bindings/vala/samples/pipeline.vala

Added: trunk/bindings/vala/AUTHORS
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/AUTHORS	Thu Dec 11 16:34:40 2008
@@ -0,0 +1 @@
+Ãtiene Bersac
\ No newline at end of file

Added: trunk/bindings/vala/COPYING
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/COPYING	Thu Dec 11 16:34:40 2008
@@ -0,0 +1 @@
+link /usr/share/automake-1.9/COPYING
\ No newline at end of file

Added: trunk/bindings/vala/INSTALL
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/INSTALL	Thu Dec 11 16:34:40 2008
@@ -0,0 +1 @@
+link /usr/share/automake-1.9/INSTALL
\ No newline at end of file

Added: trunk/bindings/vala/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/Makefile.am	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,12 @@
+SUBDIRS = samples
+
+# babl.vapi: $(top_srcdir)/packages/babl/babl*
+# 	vapigen --library=babl $^
+
+# gegl.vapi: $(top_srcdir)/packages/gegl/gegl*
+# 	vapigen --library=gegl --vapidir=. --pkg=babl --pkg=glib-2.0 $^
+
+vapidir=$(DESTDIR)@vapidir@
+dist_vapi_DATA = \
+	babl-0.0.vapi	\
+	gegl-0.0.vapi	gegl-0.0.deps

Added: trunk/bindings/vala/NEWS
==============================================================================

Added: trunk/bindings/vala/README
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/README	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,8 @@
+This is the vapi for GEGL. The GEGL API coverrage is not complete due
+to API stability and maturity issues.
+
+Currently, it is not yet possible to write GEGL Operation from
+Vala. You can build a pipeline and process it.
+
+See http://live.gnome.org/Vala for more details about Vala programming
+language.

Added: trunk/bindings/vala/autogen.sh
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/autogen.sh	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,204 @@
+#!/bin/sh 
+
+# This script does all the magic calls to automake/autoconf and
+# friends that are needed to configure a cvs checkout.  As described in
+# the file HACKING you need a couple of extra tools to run this script
+# successfully.
+#
+# If you are compiling from a released tarball you don't need these
+# tools and you shouldn't use this script.  Just call ./configure
+# directly.
+
+ACLOCAL=${ACLOCAL-aclocal-1.9}
+AUTOCONF=${AUTOCONF-autoconf}
+AUTOMAKE=${AUTOMAKE-automake-1.9}
+
+AUTOCONF_REQUIRED_VERSION=2.54
+AUTOMAKE_REQUIRED_VERSION=1.7
+
+
+PROJECT="gegl-vala"
+TEST_TYPE=-f
+FILE=samples/Makefile.am
+
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+ORIGDIR=`pwd`
+cd $srcdir
+
+
+check_version ()
+{
+    VERSION_A=$1
+    VERSION_B=$2
+
+    save_ifs="$IFS"
+    IFS=.
+    set dummy $VERSION_A 0 0 0
+    MAJOR_A=$2
+    MINOR_A=$3
+    MICRO_A=$4
+    set dummy $VERSION_B 0 0 0
+    MAJOR_B=$2
+    MINOR_B=$3
+    MICRO_B=$4
+    IFS="$save_ifs"
+
+    if expr "$MAJOR_A" = "$MAJOR_B" > /dev/null; then
+        if expr "$MINOR_A" \> "$MINOR_B" > /dev/null; then
+           echo "yes (version $VERSION_A)"
+        elif expr "$MINOR_A" = "$MINOR_B" > /dev/null; then
+            if expr "$MICRO_A" \>= "$MICRO_B" > /dev/null; then
+               echo "yes (version $VERSION_A)"
+            else
+                echo "Too old (version $VERSION_A)"
+                DIE=1
+            fi
+        else
+            echo "Too old (version $VERSION_A)"
+            DIE=1
+        fi
+    elif expr "$MAJOR_A" \> "$MAJOR_B" > /dev/null; then
+	echo "Major version might be too new ($VERSION_A)"
+    else
+	echo "Too old (version $VERSION_A)"
+	DIE=1
+    fi
+}
+
+echo
+echo "I am testing that you have the tools required to build the"
+echo "$PROJECT project from SVN. This test is not foolproof,"
+echo "so if anything goes wrong, see the file HACKING for more information..."
+echo
+
+DIE=0
+
+
+echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
+if ($AUTOCONF --version) < /dev/null > /dev/null 2>&1; then
+    VER=`$AUTOCONF --version | head -n 1 \
+         | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
+    check_version $VER $AUTOCONF_REQUIRED_VERSION
+else
+    echo
+    echo "  You must have autoconf installed to compile $PROJECT."
+    echo "  Download the appropriate package for your distribution,"
+    echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/";
+    echo
+    DIE=1;
+fi
+
+
+echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... "
+if ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=$AUTOMAKE
+   ACLOCAL=$ACLOCAL
+elif (automake-1.10 --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-1.10
+   ACLOCAL=aclocal-1.10
+elif (automake-1.9 --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-1.9
+   ACLOCAL=aclocal-1.9
+elif (automake-1.8 --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-1.8
+   ACLOCAL=aclocal-1.8
+   AUTOMAKE_REQUIRED_VERSION=1.8.3
+elif (automake-1.7 --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-1.7
+   ACLOCAL=aclocal-1.7
+else
+    echo
+    echo "  You must have automake $AUTOMAKE_REQUIRED_VERSION or newer installed to compile $PROJECT."
+    echo "  Download the appropriate package for your distribution,"
+    echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/";
+    echo
+    DIE=1
+fi
+
+if test x$AUTOMAKE != x; then
+    VER=`$AUTOMAKE --version \
+         | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
+    check_version $VER $AUTOMAKE_REQUIRED_VERSION
+fi
+
+if test "$DIE" -eq 1; then
+    echo
+    echo "Please install/upgrade the missing tools and call me again."
+    echo	
+    exit 1
+fi
+
+
+test $TEST_TYPE $FILE || {
+    echo
+    echo "You must run this script in the top-level $PROJECT directory."
+    echo
+    exit 1
+}
+
+echo
+echo "I am going to run ./configure with the following arguments:"
+echo
+echo "  --enable-maintainer-mode --enable-debug $AUTOGEN_CONFIGURE_ARGS $@"
+echo
+
+if test -z "$*"; then
+    echo "If you wish to pass additional arguments, please specify them "
+    echo "on the $0 command line or set the AUTOGEN_CONFIGURE_ARGS "
+    echo "environment variable."
+    echo
+fi
+
+
+if test -z "$ACLOCAL_FLAGS"; then
+
+    acdir=`$ACLOCAL --print-ac-dir`
+    m4list="glib-2.0.m4 pkg.m4" # glib-gettext.m4 intltool.m4
+
+    for file in $m4list
+    do
+	if [ ! -f "$acdir/$file" ]; then
+	    echo
+	    echo "WARNING: aclocal's directory is $acdir, but..."
+            echo "         no file $acdir/$file"
+            echo "         You may see fatal macro warnings below."
+            echo "         If these files are installed in /some/dir, set the "
+            echo "         ACLOCAL_FLAGS environment variable to \"-I /some/dir\""
+            echo "         or install $acdir/$file."
+            echo
+        fi
+    done
+fi
+
+rm -rf autom4te.cache
+
+$ACLOCAL $ACLOCAL_FLAGS
+RC=$?
+if test $RC -ne 0; then
+   echo "$ACLOCAL gave errors. Please fix the error conditions and try again."
+   exit $RC
+fi
+
+$AUTOMAKE --add-missing -Wno-portability|| exit $?
+$AUTOCONF || exit $?
+
+
+cd $ORIGDIR
+
+echo
+echo "Running ./configure..."
+echo
+
+$srcdir/configure --enable-debug --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@"
+RC=$?
+if test $RC -ne 0; then
+  echo
+  echo "Configure failed or did not finish!"
+  exit $RC
+fi
+
+
+echo
+echo "Now type 'make' to compile $PROJECT."

Added: trunk/bindings/vala/babl-0.0.vapi
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/babl-0.0.vapi	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,19 @@
+/* babl.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "Babl", lower_case_cprefix = "babl_")]
+namespace Babl {
+	[CCode (cname = "Babl", cheader_filename = "babl/babl.h")]
+	public class Format {
+		public Format ();
+	}
+	[CCode (cname = "Babl", cheader_filename = "babl/babl.h")]
+	public class Component {
+		public Component ();
+	}
+	[CCode (cheader_filename = "babl/babl.h")]
+	public static void init ();
+	[CCode (cheader_filename = "babl/babl.h")]
+	public static void destroy ();
+	[CCode (cheader_filename = "babl/babl.h")]
+	public static weak Babl.Format format (string name);
+}

Added: trunk/bindings/vala/configure.ac
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/configure.ac	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,34 @@
+-*- mode: m4 -*-
+AC_PREREQ(2.52)
+
+AC_INIT([gegl-vala], [0.0.2],
+        [http://bugzilla.gnome.org/enter_bug.cgi?product=gegl])
+
+AM_INIT_AUTOMAKE(no-define dist-bzip2)
+
+###############
+# Generic stuff
+###############
+  
+dnl Checks for programs.
+AC_ISC_POSIX
+AM_PROG_CC_STDC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+dnl VALA
+VALA_PROG_VALAC(0.3.1)
+
+vapidir=$(pkg-config --variable vapidir vala-1.0)
+AC_SUBST(vapidir)
+
+PKG_CHECK_MODULES(VALA_TEST, [glib-2.0 gobject-2.0 gegl])
+
+
+
+AC_CONFIG_FILES([
+  Makefile
+  samples/Makefile
+])
+
+AC_OUTPUT

Added: trunk/bindings/vala/gegl-0.0.deps
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/gegl-0.0.deps	Thu Dec 11 16:34:40 2008
@@ -0,0 +1 @@
+babl-0.0

Added: trunk/bindings/vala/gegl-0.0.vapi
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/gegl-0.0.vapi	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,160 @@
+/* gegl.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "Gegl", lower_case_cprefix = "gegl_")]
+namespace Gegl {
+	[CCode (cprefix = "GEGL_BLIT_", has_type_id = "0", cheader_filename = "gegl.h")]
+	public enum BlitFlags {
+		DEFAULT,
+		CACHE,
+		DIRTY
+	}
+	[CCode (cprefix = "GEGL_INTERPOLATION_", has_type_id = "0", cheader_filename = "gegl.h")]
+	public enum Interpolation {
+		NEAREST,
+		LINEAR
+	}
+	[CCode (cprefix = "GEGL_PARAM_PAD_", has_type_id = "0", cheader_filename = "gegl.h")]
+	public enum PadType {
+		OUTPUT,
+		INPUT
+	}
+	[CCode (cheader_filename = "gegl.h")]
+	public class Processor : GLib.Object {
+		[CCode (cname = "gegl_node_new_processor")]
+		public Processor (Gegl.Node sink, Gegl.Rectangle? rect = null);
+		public void destroy ();
+		public void set_rectangle (Gegl.Rectangle rectangle);
+		public bool work (out double progress);
+		[NoAccessorMethod]
+		public weak int chunksize { get; construct; }
+		[NoAccessorMethod]
+		public weak Gegl.Node node { set construct; }
+		[NoAccessorMethod]
+		public weak double progress { get; set; }
+	}
+	[CCode (cheader_filename = "gegl.h")]
+	public class Node : GLib.Object, Gegl.Visitable {
+		public Node ();
+		public Node.from_file (string path);
+		public Node.from_xml (string xmldata, string path_root);
+		public weak Gegl.Node new_child (...);
+		public weak Gegl.Node create_child (string operation);
+		public weak Gegl.Node adopt_child (Gegl.Node child);
+		public weak Gegl.Node add_child (Gegl.Node child);
+		public weak Gegl.Node remove_child (Gegl.Node child);
+		public bool connect_from (string input_pad_name, Gegl.Node source, string output_pad_name);
+		public bool connect_to (string output_pad_name, Gegl.Node sink, string input_pad_name);
+		public void link (Gegl.Node sink);
+		public void link_many (...);
+		public bool disconnect (string input_pad);
+		public weak GLib.SList<Gegl.Node> get_children ();
+		public int get_consumers (string output_pad, out weak Gegl.Node nodes, string pads);
+		public weak string get_operation ();
+		public weak Gegl.Node get_input_proxy (string pad_name);
+		public weak Gegl.Node get_output_proxy (string pad_name);
+		public weak Gegl.Node get_parent ();
+		public weak Gegl.Node get_producer (string input_pad_name, string output_pad_name);
+		public weak Gegl.Node detect (int x, int y);
+		public Gegl.Rectangle get_bounding_box ();
+		public void blit (double scale, Gegl.Rectangle roi, void* format, void* destination_buf, int rowstride, Gegl.BlitFlags flags);
+		public void process ();
+		public weak GLib.ParamSpec find_property (string property_name);
+		public void get (...);
+		public void set (...);
+		public void get_property (string property_name, GLib.Value value);
+		public void set_property (string property_name, GLib.Value value);
+		public weak string to_xml (string path_root);
+		[NoAccessorMethod]
+		public weak string name { get; set construct; }
+		[NoAccessorMethod]
+		public weak string operation { get; set construct; }
+		public signal void computed (Gegl.Rectangle p0);
+		public signal void invalidated (Gegl.Rectangle p0);
+	}
+	[CCode (cheader_filename = "gegl.h")]
+	public class Buffer : GLib.Object {
+		public void copy (Gegl.Rectangle src_rect, Gegl.Buffer dst, Gegl.Rectangle dst_rect);
+		public Gegl.Buffer create_sub_buffer (Gegl.Rectangle extent);
+		public void destroy ();
+		public Gegl.Buffer dup ();
+		public void flush ();
+		public void get (double scale, Gegl.Rectangle rect, void* format, void* dest, int rowstride);
+		public Gegl.Rectangle get_extent ();
+		public static Gegl.Interpolation interpolation_from_string (string str);
+		public static weak Gegl.Buffer load (string path);
+		public Buffer (Gegl.Rectangle extent, void* format);
+		public static weak Gegl.Buffer open (string path);
+		public void sample (double x, double y, double scale, void* dest, void* format, Gegl.Interpolation interpolation);
+		public void sample_cleanup ();
+		public void save (string path, Gegl.Rectangle roi);
+		public void set (Gegl.Rectangle rect, void* format, void* src, int rowstride);
+		public bool set_extent (Gegl.Rectangle extent);
+		[NoAccessorMethod]
+		public weak int abyss_height { get; construct; }
+		[NoAccessorMethod]
+		public weak int abyss_width { get; construct; }
+		[NoAccessorMethod]
+		public weak int abyss_x { get; construct; }
+		[NoAccessorMethod]
+		public weak int abyss_y { get; construct; }
+		[NoAccessorMethod]
+		public weak void* format { get; set construct; }
+		[NoAccessorMethod]
+		public weak int height { get; set construct; }
+		[NoAccessorMethod]
+		public weak string path { get; set construct; }
+		[NoAccessorMethod]
+		public weak int pixels { get; }
+		[NoAccessorMethod]
+		public weak int px_size { get; }
+		[NoAccessorMethod]
+		public weak int shift_x { get; construct; }
+		[NoAccessorMethod]
+		public weak int shift_y { get; construct; }
+		[NoAccessorMethod]
+		public weak int tile_height { get; construct; }
+		[NoAccessorMethod]
+		public weak int tile_width { get; construct; }
+		[NoAccessorMethod]
+		public weak int width { get; set construct; }
+		[NoAccessorMethod]
+		public weak int x { get; set construct; }
+		[NoAccessorMethod]
+		public weak int y { get; set construct; }
+		public signal void changed (Gegl.Rectangle p0);
+	}
+	[CCode (cheader_filename = "gegl.h")]
+	public class Color : GLib.Object {
+		public void get_rgba (float r, float g, float b, float a);
+		public Color (string str);
+		public void set_rgba (float r, float g, float b, float a);
+	}
+	[CCode (cheader_filename = "gegl.h")]
+	public interface Visitable {
+	}
+	[CCode (cheader_filename = "gegl.h")]
+	public struct Rectangle {
+		public int x;
+		public int y;
+		public int width;
+		public int height;
+		public void bounding_box (Gegl.Rectangle src1, Gegl.Rectangle src2);
+		public bool contains (Gegl.Rectangle s);
+		public bool equal (Gegl.Rectangle s);
+		public bool equal_coords (int x, int y, int width, int height);
+		public bool intersect (Gegl.Rectangle src1, Gegl.Rectangle src2);
+		public void set (int x, int y, uint width, uint height);
+	}
+	public const int AUTO_ROWSTRIDE;
+	public const int MAJOR_VERSION;
+	public const int MICRO_VERSION;
+	public const int MINOR_VERSION;
+	[CCode (cheader_filename = "gegl.h")]
+	public static weak GLib.Object config ();
+	[CCode (cheader_filename = "gegl.h")]
+	public static void exit ();
+	[CCode (cheader_filename = "gegl.h")]
+	public static void get_version (int major, int minor, int micro);
+	[CCode (cheader_filename = "gegl.h")]
+	public static void init ([CCode (array_length_pos = 0.9)] ref weak string[] argv);
+}

Added: trunk/bindings/vala/samples/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/samples/Makefile.am	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,69 @@
+
+noinst_PROGRAMS = format pipeline buffer
+
+BUILT_SOURCES = \
+	$(noinst_PROGRAMS:=.vala.stamp)
+
+# BABL
+format_VALASOURCES = format.vala
+format_VALAPKGS = --vapidir=$(top_srcdir) --pkg=babl
+
+format_SOURCES = \
+	$(format_VALASOURCES:.vala=.c) \
+	$(format_VALASOURCES:.vala=.h)
+
+format_CFLAGS = \
+	$(VALA_TEST_CFLAGS)
+format_LDFLAGS = \
+	$(VALA_TEST_LIBS) \
+	-lbabl-0.0
+
+format.vala.stamp: $(format_VALASOURCES)
+	$(VALAC) -C $(format_VALAPKGS) $^
+	touch $@
+
+# PIPELINE
+pipeline_VALASOURCES = pipeline.vala
+pipeline_VALAPKGS = \
+	--pkg=glib-2.0	\
+	--vapidir=$(top_srcdir) --pkg=babl --pkg=gegl
+
+pipeline_SOURCES = \
+	$(pipeline_VALASOURCES:.vala=.c)	\
+	$(pipeline_VALASOURCES:.vala=.h)
+
+pipeline_CFLAGS = \
+	$(VALA_TEST_CFLAGS)
+pipeline_LDFLAGS = \
+	$(VALA_TEST_LIBS) \
+	-lbabl-0.0 -lgegl-0.0
+
+pipeline.vala.stamp: $(pipeline_VALASOURCES)
+	$(VALAC) -C $(pipeline_VALAPKGS) $^
+	touch $@
+
+# BUFFER
+buffer_VALASOURCES = buffer.vala
+buffer_VALAPKGS = \
+	--pkg=glib-2.0	\
+	--vapidir=$(top_srcdir) --pkg=babl --pkg=gegl
+
+buffer_SOURCES = \
+	$(buffer_VALASOURCES:.vala=.c)	\
+	$(buffer_VALASOURCES:.vala=.h)
+
+buffer_CFLAGS = \
+	$(VALA_TEST_CFLAGS)
+buffer_LDFLAGS = \
+	$(VALA_TEST_LIBS) \
+	-lbabl-0.0 -lgegl-0.0
+
+buffer.vala.stamp: $(buffer_VALASOURCES)
+	$(VALAC) -C $(buffer_VALAPKGS) $^
+	touch $@
+
+
+EXTRA_DIST = \
+	$(format_VALASOURCES)	\
+	$(pipeline_VALASOURCES)	\
+	$(buffer_VALASOURCES)

Added: trunk/bindings/vala/samples/buffer.vala
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/samples/buffer.vala	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,32 @@
+/*-*- java -*-*/
+
+using Babl;
+using GLib;
+using Gegl;
+
+public class TestBuffer {
+	static int main (string[] args) {
+		Gegl.Rectangle rect, sub_rect;
+		Gegl.Buffer test0;
+		Gegl.Buffer test1;
+		weak Babl.Format fmt;
+
+		Gegl.init(ref args);
+
+		rect.set(0, 0, 512, 128);
+		sub_rect.set(128, 32, 256, 64);
+
+		fmt = Babl.format("RGBA u8");
+		test0 = new Gegl.Buffer(rect, fmt);
+
+		test1 = test0.dup();
+		test1 = test0.create_sub_buffer(sub_rect);
+
+		test1 = null;
+		test0 = null;
+
+		Gegl.exit();
+
+		return 0;
+	}
+}
\ No newline at end of file

Added: trunk/bindings/vala/samples/format.vala
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/samples/format.vala	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,14 @@
+/*-*- java -*-*/
+
+using GLib;
+using Babl;
+
+public class TestBabl {
+	static int main (string[] args) {
+		Babl.init();
+		weak Babl.Format fmt = Babl.format("R'G'B' u8");
+		GLib.printerr("New Babl.Format created !\n");
+		Babl.destroy();
+		return 0;
+	}
+}
\ No newline at end of file

Added: trunk/bindings/vala/samples/pipeline.vala
==============================================================================
--- (empty file)
+++ trunk/bindings/vala/samples/pipeline.vala	Thu Dec 11 16:34:40 2008
@@ -0,0 +1,62 @@
+/*-*- java -*-*/
+
+using GLib;
+using Gegl;
+
+static int main (string[] args) {
+	Gegl.Node root;
+	weak Gegl.Node color, crop, text, layer, save;
+	Gegl.Processor proc;
+
+	string filename = "pipeline.png";
+
+	Gegl.init(ref args);
+
+	root = new Gegl.Node();
+
+	layer = root.new_child("operation", "gegl:layer",
+			       "x", 2.0,
+			       "y", 4.0,
+			       "opacity", 1.0);
+
+	color = root.new_child("operation", "gegl:color",
+			       "value", new Gegl.Color("rgba(1.0,1.0,1.0,0.5)"));
+
+	crop = root.new_child("operation", "gegl:crop",
+			      "x", 0.0, "y", 0.0,
+			      "width", 512.0,
+			      "height", 128.0);
+	color.link(crop);
+	crop.link(layer);
+
+	save = root.new_child("operation", "gegl:png-save",
+			      "path", filename,
+			      "compression", 9);
+
+	layer.link(save);
+
+	// text
+	text = root.new_child("operation", "gegl:text",
+			      "string", "Hello world !",
+			      "font", "Aniron",
+			      "size", 24.0,
+			      "color", new Gegl.Color("black"));
+
+	text.connect_to("output", layer, "aux");
+		
+	// processor
+	proc = new Gegl.Processor(save);
+	double progress;
+
+	while (proc.work(out progress))
+		GLib.printerr("processing %.2f%%\n", progress*100);
+
+	GLib.printerr("result saved in %s.\n", filename);
+
+	root = null;
+	proc = null;
+
+	Gegl.exit();
+
+	return 0;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]