gegl r3051 - in trunk: . docs gegl
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r3051 - in trunk: . docs gegl
- Date: Sun, 12 Apr 2009 11:40:02 +0000 (UTC)
Author: martinn
Date: Sun Apr 12 11:40:02 2009
New Revision: 3051
URL: http://svn.gnome.org/viewvc/gegl?rev=3051&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/docs/development.txt
trunk/gegl/gegl-dot.c
trunk/gegl/gegl-dot.h
Modified: trunk/docs/development.txt
==============================================================================
--- trunk/docs/development.txt (original)
+++ trunk/docs/development.txt Sun Apr 12 11:40:02 2009
@@ -117,6 +117,9 @@
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
Modified: trunk/gegl/gegl-dot.c
==============================================================================
--- trunk/gegl/gegl-dot.c (original)
+++ trunk/gegl/gegl-dot.c Sun Apr 12 11:40:02 2009
@@ -287,3 +287,31 @@
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);
+}
Modified: trunk/gegl/gegl-dot.h
==============================================================================
--- trunk/gegl/gegl-dot.h (original)
+++ trunk/gegl/gegl-dot.h Sun Apr 12 11:40:02 2009
@@ -29,6 +29,8 @@
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]