[Gegl-developer] node creation API
Victor Bogado
bogado at bogado.net
Fri Sep 1 05:39:05 PDT 2006
It seems to me that when creating a gegl_node the user will always set
the class, and more he will need to this before setting any other
property.
Since this is always required why do he need to state this verbosely? I
mean, look at this code, from the gegl-demo :
---- anim.c ----
GeglGraph *gegl = g_object_new (GEGL_TYPE_GRAPH, NULL);
GeglNode *display = gegl_graph_create_node (gegl,
"class", "display",
"window_title", "GEGL demo",
NULL);
GeglNode *background = gegl_graph_create_node (gegl,
"class", "jpg-load",
"path", "data/vinci-womb.jpg",
"name", "background",
NULL);
GeglNode *load = gegl_graph_create_node (gegl,
"class", "png-load",
"path", "data/gegl.png",
NULL);
--------
I think that this function should receive the "class" as a first
parameter. So this would become :
---- alternative.c ----
GeglGraph *gegl = g_object_new (GEGL_TYPE_GRAPH, NULL);
GeglNode *display = gegl_graph_create_node (gegl, "display",
"window_title", "GEGL demo",
NULL);
GeglNode *background = gegl_graph_create_node (gegl, "jpg-load",
"path", "data/vinci-womb.jpg",
"name", "background",
NULL);
--------
This would not only keep the string "class" from appearing several times
in the code, but it would prevent the user from committing the mistake
of not setting the class, or setting the class out of the order.
More information about the Gegl-developer
mailing list