[gegl] examples: Don't use gegl_graph() helper in gegl-convert
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] examples: Don't use gegl_graph() helper in gegl-convert
- Date: Sun, 17 Nov 2013 17:49:17 +0000 (UTC)
commit db9f4a4fb89a7e6baf2d47eaf6f01e7101ff0935
Author: Daniel Sabo <DanielSabo gmail com>
Date: Sun Nov 17 09:04:21 2013 -0800
examples: Don't use gegl_graph() helper in gegl-convert
examples/gegl-convert.c | 36 ++++++++++++++++++++++++++++--------
1 files changed, 28 insertions(+), 8 deletions(-)
---
diff --git a/examples/gegl-convert.c b/examples/gegl-convert.c
index 8161f8e..4201556 100644
--- a/examples/gegl-convert.c
+++ b/examples/gegl-convert.c
@@ -4,7 +4,7 @@ gint
main (gint argc,
gchar **argv)
{
- GeglNode *graph, *sink;
+ GeglNode *graph, *src, *sink;
GeglBuffer *buffer = NULL;
gegl_init (&argc, &argv);
@@ -16,24 +16,44 @@ main (gint argc,
return 1;
}
- graph = gegl_graph (sink=gegl_node ("gegl:buffer-sink", "buffer", &buffer, NULL,
- gegl_node ("gegl:load", "path", argv[1], NULL)));
+ graph = gegl_node_new ();
+ src = gegl_node_new_child (graph,
+ "operation", "gegl:load",
+ "path", argv[1],
+ NULL);
+ sink = gegl_node_new_child (graph,
+ "operation", "gegl:buffer-sink",
+ "buffer", &buffer,
+ NULL);
+
+ gegl_node_link_many (src, sink, NULL);
+
gegl_node_process (sink);
g_object_unref (graph);
+
+ /* FIXME: Currently a buffer will always be returned, even if the source is missing */
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)));
+ graph = gegl_node_new ();
+ src = gegl_node_new_child (graph,
+ "operation", "gegl:buffer-source",
+ "buffer", buffer,
+ NULL);
+ sink = gegl_node_new_child (graph,
+ "operation", "gegl:save",
+ "path", argv[2],
+ NULL);
+
+ gegl_node_link_many (src, sink, NULL);
+
gegl_node_process (sink);
+ g_object_unref (graph);
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]