Re: [Gegl-developer] having trouble with gegl_node_to_xml
Am 28.08.2011 13:59, schrieb Jon Nordby:
> On 28 August 2011 13:36, Joerg Beyer wrote:
>> Am 28.08.2011 12:40, schrieb Jon Nordby:
>>> On 28 August 2011 10:34, Joerg Beyer 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
#include
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:
>>
>>
>>
>> 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
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
Re: [Gegl-developer] having trouble with gegl_node_to_xml
On 28 August 2011 13:36, Joerg Beyer wrote:
> Am 28.08.2011 12:40, schrieb Jon Nordby:
>> On 28 August 2011 10:34, Joerg Beyer 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
>>> #include
>>>
>>> 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:
>
>
>
> 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."
> Joerg
>
>>
>>> g_object_unref (gegl);
>>>
>>> gegl_exit ();
>>> return 0;
>>> }
>>>
>>> These are the library version ldd told me:
>>>
>>> linux-gate.so.1 => (0xb78a1000)
>>> libgegl-0.1.so.0 => /usr/lib/libgegl-0.1.so.0 (0xb782c000)
>>> libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb76cb000)
>>> libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
>>> (0xb7683000)
>>> libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0
>>> (0xb767e000)
>>> libgio-2.0.so.0 => /usr/lib/i386-linux-gnu/libgio-2.0.so.0 (0xb757b000)
>>> libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0
>>> (0xb7577000)
>>> librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb756e000)
>>> libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb7496000)
>>> libbabl-0.1.so.0 => /usr/local/lib/libbabl-0.1.so.0 (0xb7448000)
>>> libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7422000)
>>> libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7409000)
>>> /lib/ld-linux.so.2 (0xb78a2000)
>>> libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb73f4000)
>>> libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb73de000)
>>> libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xb73c3000)
>>> libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb73bf000)
>>> libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb738)
>>>
>>>
>>> And I hoped, that xmltext would be string, containing a xml tree for
>>> this little gegl operation. unfortunally all I got where a handful of
>>> binary bytes - not the xml text (somthing like "") I
>>> hoped for.
>>>
>>> Any hints for me?
>>>
>>> thanks in advance
>>> Joerg
>>>
>>> ___
>>> Gegl-developer mailing list
>>> [email protected]
>>> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
>>>
>>
>>
>
>
--
Jon Nordby - www.jonnor.com
___
Gegl-developer mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
Re: [Gegl-developer] having trouble with gegl_node_to_xml
Am 28.08.2011 12:40, schrieb Jon Nordby:
> On 28 August 2011 10:34, Joerg Beyer 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
>> #include
>>
>> 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:
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?
Joerg
>
>>g_object_unref (gegl);
>>
>>gegl_exit ();
>>return 0;
>> }
>>
>> These are the library version ldd told me:
>>
>>linux-gate.so.1 => (0xb78a1000)
>>libgegl-0.1.so.0 => /usr/lib/libgegl-0.1.so.0 (0xb782c000)
>>libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb76cb000)
>>libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
>> (0xb7683000)
>>libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0
>> (0xb767e000)
>>libgio-2.0.so.0 => /usr/lib/i386-linux-gnu/libgio-2.0.so.0 (0xb757b000)
>>libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0
>> (0xb7577000)
>>librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb756e000)
>>libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb7496000)
>>libbabl-0.1.so.0 => /usr/local/lib/libbabl-0.1.so.0 (0xb7448000)
>>libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7422000)
>>libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7409000)
>>/lib/ld-linux.so.2 (0xb78a2000)
>>libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb73f4000)
>>libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb73de000)
>>libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xb73c3000)
>>libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb73bf000)
>>libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb738)
>>
>>
>> And I hoped, that xmltext would be string, containing a xml tree for
>> this little gegl operation. unfortunally all I got where a handful of
>> binary bytes - not the xml text (somthing like "") I
>> hoped for.
>>
>> Any hints for me?
>>
>>thanks in advance
>>Joerg
>>
>> ___
>> Gegl-developer mailing list
>> [email protected]
>> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
>>
>
>
___
Gegl-developer mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
Re: [Gegl-developer] having trouble with gegl_node_to_xml
On 28 August 2011 10:34, Joerg Beyer 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
> #include
>
> 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
> g_object_unref (gegl);
>
> gegl_exit ();
> return 0;
> }
>
> These are the library version ldd told me:
>
> linux-gate.so.1 => (0xb78a1000)
> libgegl-0.1.so.0 => /usr/lib/libgegl-0.1.so.0 (0xb782c000)
> libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb76cb000)
> libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
> (0xb7683000)
> libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0
> (0xb767e000)
> libgio-2.0.so.0 => /usr/lib/i386-linux-gnu/libgio-2.0.so.0 (0xb757b000)
> libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0
> (0xb7577000)
> librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb756e000)
> libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb7496000)
> libbabl-0.1.so.0 => /usr/local/lib/libbabl-0.1.so.0 (0xb7448000)
> libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7422000)
> libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7409000)
> /lib/ld-linux.so.2 (0xb78a2000)
> libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb73f4000)
> libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb73de000)
> libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xb73c3000)
> libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb73bf000)
> libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb738)
>
>
> And I hoped, that xmltext would be string, containing a xml tree for
> this little gegl operation. unfortunally all I got where a handful of
> binary bytes - not the xml text (somthing like "") I
> hoped for.
>
> Any hints for me?
>
> thanks in advance
> Joerg
>
> ___
> Gegl-developer mailing list
> [email protected]
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
>
--
Jon Nordby - www.jonnor.com
___
Gegl-developer mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer

