gegl r2315 - in trunk: . examples examples/data



Author: ok
Date: Sat May 17 22:26:01 2008
New Revision: 2315
URL: http://svn.gnome.org/viewvc/gegl?rev=2315&view=rev

Log:
2008-05-17  Ãyvind KolÃs  <pippin gimp org>

	* examples/2gegl.c: renamed to:
	* examples/2geglbuffer.c:
	* examples/clock.c: renamed to:
	* examples/geglbuffer-clock.c:
	* examples/geglbuffer-add-image.c: added.
	* examples/multiplayer-paint.sh: make use of new files.
	* examples/Makefile.am: added subdir data
	* examples/data: added
	* examples/data/Makefile.am: added
	* examples/data/surfer.png: added
	* configure.ac: added examples/data/Makefile


Added:
   trunk/examples/2geglbuffer.c
      - copied unchanged from r2303, /trunk/examples/2gegl.c
   trunk/examples/data/
   trunk/examples/data/Makefile.am
   trunk/examples/data/surfer.png   (contents, props changed)
   trunk/examples/geglbuffer-add-image.c
   trunk/examples/geglbuffer-clock.c
      - copied unchanged from r2303, /trunk/examples/clock.c
Removed:
   trunk/examples/2gegl.c
   trunk/examples/clock.c
Modified:
   trunk/ChangeLog
   trunk/examples/Makefile.am
   trunk/examples/multiplayer-paint.sh

Modified: trunk/examples/Makefile.am
==============================================================================
--- trunk/examples/Makefile.am	(original)
+++ trunk/examples/Makefile.am	Sat May 17 22:26:01 2008
@@ -1,5 +1,6 @@
 #include $(top_srcdir)/operations/Makefile-common.am
 
+SUBDIRS = data
 CFILES = $(wildcard $(srcdir)/*.c)
 bins   = $(subst $(srcdir)/,,$(CFILES:.c=))
 EXTRA_DIST = $(wildcard *.c)

Added: trunk/examples/data/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/examples/data/Makefile.am	Sat May 17 22:26:01 2008
@@ -0,0 +1 @@
+EXTRA_DIST=$(wildcard *.png) $(wildcard *.jpg)

Added: trunk/examples/data/surfer.png
==============================================================================
Binary file. No diff available.

Added: trunk/examples/geglbuffer-add-image.c
==============================================================================
--- (empty file)
+++ trunk/examples/geglbuffer-add-image.c	Sat May 17 22:26:01 2008
@@ -0,0 +1,64 @@
+#include <gegl.h>
+#include <glib/gprintf.h>
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+  GeglBuffer *buffer; /* instantiate a graph */
+  GeglNode   *gegl;   /* the gegl graph we're using as a node factor */
+  GeglNode   *write_buffer,
+             *shift,
+             *load;
+  gchar *in_file;
+  gchar *buf_file;
+  gdouble x;
+  gdouble y;
+
+  gegl_init (&argc, &argv);  /* initialize the GEGL library */
+
+
+  if (argv[1]==NULL ||
+      argv[2]==NULL ||
+      argv[3]==NULL ||
+      argv[4]==NULL)
+    {
+      g_print ("\nUsage: %s <gegl buffer> <image file> <x> <y>\n"
+               "\nWrites an image into the GeglBuffer at the specified coordinates\n",
+               argv[0]);
+      return -1;
+    }
+  buf_file = argv[1];
+  in_file = argv[2];
+  x = atof (argv[3]);
+  y = atof (argv[4]);
+
+  buffer = gegl_buffer_open (buf_file);
+  gegl = gegl_node_new ();
+
+  write_buffer = gegl_node_new_child (gegl,
+                                    "operation", "write-buffer",
+                                    "buffer", buffer,
+                                    NULL);
+  shift      = gegl_node_new_child (gegl,
+                                    "operation", "shift",
+                                    "x", x,
+                                    "y", y,
+                                    NULL);
+  load        = gegl_node_new_child (gegl,
+                                   "operation", "load",
+                                   "path", in_file,
+                                   NULL);
+
+  gegl_node_link_many (load, shift, write_buffer, NULL);
+  gegl_node_process (write_buffer);
+
+  /* free resources used by the graph and the nodes it owns */
+  g_object_unref (gegl);
+  g_object_unref (buffer);
+
+  /* free resources globally used by GEGL */
+  gegl_exit ();
+
+  return 0;
+}

Modified: trunk/examples/multiplayer-paint.sh
==============================================================================
--- trunk/examples/multiplayer-paint.sh	(original)
+++ trunk/examples/multiplayer-paint.sh	Sat May 17 22:26:01 2008
@@ -1,11 +1,12 @@
 #!/bin/sh
 
-./2gegl data/car-stack.jpg test.gegl
-./clock test.gegl &
+./2geglbuffer data/surfer.png test.gegl
+./geglbuffer-add-image test.gegl data/surfer.png 64 64
+./geglbuffer-clock test.gegl &
+
 ./gegl-paint test.gegl &
 ./gegl-paint test.gegl &
-gegl -x '<gegl><open-buffer path="test.gegl"/></gegl>'
-
-killall -9 clock gegl-paint lt-clock lt-gegl-paint
 
+gegl -x '<gegl><open-buffer path="test.gegl"/></gegl>'
 
+killall -9 geglbuffer-clock gegl-paint lt-geglbuffer-clock lt-gegl-paint



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