Commit a274f464 authored by Martin Nordholts's avatar Martin Nordholts

gegl: Add gegl_dot_node_to_png()

Add gegl_dot_node_to_png() which is a debug function supposed to be
called directly from a debugger. E.g. in gdb it is used like this:

  p gegl_dot_node_to_png (node, "/tmp/foo.png")

where 'node' is a node of interest. That will show the graphviz graph
of 'node' and its dependencies.

svn path=/trunk/; revision=3051
parent 22c9e855
2009-04-12 Martin Nordholts <martinn@svn.gnome.org>
Add gegl_dot_node_to_png() which is a debug function supposed to be
called directly from a debugger. E.g. in gdb it is used like this:
p gegl_dot_node_to_png (node, "/tmp/foo.png")
where 'node' is a node of interest. That will show the graphviz graph
of 'node' and its dependencies.
* docs/development.txt
* gegl/gegl-dot.c
* gegl/gegl-dot.h
2009-04-12 Martin Nordholts <martinn@svn.gnome.org>
* gegl/gegl-dot.c: Also add edges to dependency based graphviz dot
......
......@@ -117,6 +117,9 @@ This is the gaussian-blur.xml file:
link:images/gaussian-blur-graph.png[Resulting graph].
You can also just call the function gegl_dot_node_to_png() directly
from within gdb to show the graphviz graph of a node and its
dependencies.
== Tests
......
......@@ -287,3 +287,31 @@ gegl_to_dot (GeglNode *node)
return g_string_free (string, FALSE);
}
/**
* gegl_dot_node_to_png:
* @node: Node to depict graph for.
* @png_path: Path of the png to write.
*
* This is for debug purposes, meant to be invoked directly from a
* debugger.
**/
void
gegl_dot_node_to_png (GeglNode *node,
const gchar *png_path)
{
gchar *dot_string = NULL;
gchar *dot_filename = NULL;
gchar *dot_cmd = NULL;
/* Get dot string */
dot_string = gegl_to_dot (node);
/* Write it to a file */
dot_filename = g_build_filename (g_get_tmp_dir (), "gegl-dot.dot", NULL);
g_file_set_contents (dot_filename, dot_string, -1, NULL);
/* Create a png from it */
dot_cmd = g_strdup_printf ("dot -o %s -Tpng %s", png_path, dot_filename);
system (dot_cmd);
}
......@@ -29,6 +29,8 @@ void gegl_dot_util_add_node_sink_edges (GString *string,
GeglNode *node);
void gegl_dot_util_add_connection (GString *string,
GeglConnection *connection);
void gegl_dot_node_to_png (GeglNode *node,
const gchar *png_path);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment