[gegl] examples: added gegl convert a GEGL backed format converter
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] examples: added gegl convert a GEGL backed format converter
- Date: Sat, 24 Jul 2010 00:53:29 +0000 (UTC)
commit 734ca1f1e5abe9b63ec471b0d53ac1d285bedbd9
Author: �yvind Kolås <pippin gimp org>
Date: Sat Jul 24 01:52:39 2010 +0100
examples: added gegl convert a GEGL backed format converter
examples/gegl-convert.c | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/examples/gegl-convert.c b/examples/gegl-convert.c
new file mode 100644
index 0000000..8161f8e
--- /dev/null
+++ b/examples/gegl-convert.c
@@ -0,0 +1,39 @@
+#include <gegl.h>
+
+gint
+main (gint argc,
+ gchar **argv)
+{
+ GeglNode *graph, *sink;
+ GeglBuffer *buffer = NULL;
+
+ gegl_init (&argc, &argv);
+
+ if (argc != 3)
+ {
+ g_print ("GEGL based image conversion tool\n");
+ g_print ("Usage: %s <imageA> <imageB>\n", argv[0]);
+ return 1;
+ }
+
+ graph = gegl_graph (sink=gegl_node ("gegl:buffer-sink", "buffer", &buffer, NULL,
+ gegl_node ("gegl:load", "path", argv[1], NULL)));
+ gegl_node_process (sink);
+ g_object_unref (graph);
+ if (!buffer)
+ {
+ g_print ("Failed to open %s\n", argv[1]);
+ return 1;
+ }
+
+ graph = gegl_graph (sink=gegl_node ("gegl:save",
+ "path", argv[2], NULL,
+ gegl_node ("gegl:buffer-source", "buffer", buffer, NULL)));
+ gegl_node_process (sink);
+
+ g_object_unref (buffer);
+ g_object_unref (buffer); /* XXX: why is two unrefs needed here? */
+ g_object_unref (graph);
+ gegl_exit ();
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]