Am 28.08.2011 13:59, schrieb Jon Nordby: > On 28 August 2011 13:36, Joerg Beyer <j.beyer@xxxxxx> wrote: >> Am 28.08.2011 12:40, schrieb Jon Nordby: >>> On 28 August 2011 10:34, Joerg Beyer <j.beyer@xxxxxx> wrote: >>>> hello, >>>> >>>> I am having trouble to save gegl operations to repeat them later. I >>>> think, that gegl_node_to_xml is the operation I am looking for, but this >>>> can be wrong. >>>> >>>> I wrote this small program: >>>> >>>> #include <stdio.h> >>>> #include <gegl.h> >>>> >>>> gint >>>> main (gint argc, >>>> gchar **argv) >>>> { >>>> GeglNode *gegl, *gn_load, *gn_save, *gn_op; >>>> gchar* xmltext; >>>> >>>> g_thread_init (NULL); >>>> gegl_init (&argc, &argv); >>>> >>>> >>>> gegl = gegl_node_new (); >>>> gn_load = gegl_node_new_child(gegl, "operation", "gegl:load", >>>> "path", "bsp-900x600.jpg", NULL); >>>> gn_save = gegl_node_new_child(gegl, "operation", "gegl:jpg-save", >>>> "path", "out.jpg", NULL); >>>> gn_op = gegl_node_new_child(gegl, "operation", >>>> "gegl:unsharp-mask", "std-dev", 1.2, "scale", 8.0, NULL); >>>> gegl_node_link_many (gn_load, gn_op, gn_save, NULL); >>>> gegl_node_process (gn_save); >>>> >>>> gegl_node_to_xml(gegl, xmltext); >>>> printf("xmltext: %s\n", xmltext); >>> You probably want to do xmltext = gegl_node_to_xml(gegl, pwd); or >>> similar. Where pwd is the current working directory. See the >>> documentation at http://gegl.org/api.html#gegl_node_to_xml >> when I change it this way: >> >> xmltext = gegl_node_to_xml(gegl, "/home/joerg/src/geglex"); >> printf("xmltext: %s\n", xmltext); >> >> then I get only an empty node as output: >> >> xmltext: <?xml version='1.0' encoding='UTF-8'?> >> <gegl> >> </gegl> >> >> is this the expected output? I thought, that the node named "gegl" would >> contain the other nodes (gn_load, gn_op and gn_save) but I am new to >> gegl and may be wrong. I tried to print the complete transformation to xml. >> >> What would give the entire tree of the operations? > I don't think you read the documentation I linked you ;) > "To export a gegl graph, connect the internal output node to an output > proxy (see gegl_node_get_output_proxy.) and use the proxy node as the > basis for the serialization." > thanks for your answers. well, I read the API docs of this functions, but since I am not familiar with the conventions used (what is a pad, how are the nodes connected - I saw the glossary...) I have my difficulties to understand them. I also found no simple example - gegl_node_to_xml appears 19 times in the gegl sources, but is used only in gegl (and I am not sure how) and the in bindings. A google search for other source code snippets does not show other use cases. Are there small programs, smaller and simpler than gimp, that use gegl? I would try and read them for better understanding. yours Joerg _______________________________________________ Gegl-developer mailing list Gegl-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer