gimp r28069 - in trunk: app/actions menus
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r28069 - in trunk: app/actions menus
- Date: Mon, 23 Feb 2009 20:43:30 +0000 (UTC)
Author: martinn
Date: Mon Feb 23 20:43:30 2009
New Revision: 28069
URL: http://svn.gnome.org/viewvc/gimp?rev=28069&view=rev
Log:
Add a Show Image Graph item to the Debug menu
Add a Show Image Graph item to the Debug menu that creates a new image
showing the GEGL graph for the image. Would benefit from an enhanced
gegl:introspect op with a clearer graph, but still quite interesting
in its current shape.
Modified:
trunk/app/actions/debug-actions.c
trunk/app/actions/debug-commands.c
trunk/app/actions/debug-commands.h
trunk/menus/image-menu.xml.in
Modified: trunk/app/actions/debug-actions.c
==============================================================================
--- trunk/app/actions/debug-actions.c (original)
+++ trunk/app/actions/debug-actions.c Mon Feb 23 20:43:30 2009
@@ -49,6 +49,12 @@
G_CALLBACK (debug_benchmark_projection_cmd_callback),
NULL },
+ { "debug-show-image-graph", NULL,
+ "Show Image _Graph", NULL,
+ "Creates a new image showing the GEGL graph of this image",
+ G_CALLBACK (debug_show_image_graph_cmd_callback),
+ NULL },
+
{ "debug-dump-items", NULL,
"_Dump Items", NULL, NULL,
G_CALLBACK (debug_dump_menus_cmd_callback),
Modified: trunk/app/actions/debug-commands.c
==============================================================================
--- trunk/app/actions/debug-commands.c (original)
+++ trunk/app/actions/debug-commands.c Mon Feb 23 20:43:30 2009
@@ -32,9 +32,13 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
+#include "core/gimplayer.h"
#include "core/gimppickable.h"
+#include "core/gimpprojectable.h"
#include "core/gimpprojection.h"
+#include "gegl/gimp-gegl-utils.h"
+
#include "widgets/gimpmenufactory.h"
#include "widgets/gimpuimanager.h"
@@ -49,6 +53,7 @@
/* local function prototypes */
static gboolean debug_benchmark_projection (GimpImage *image);
+static gboolean debug_show_image_graph (GimpImage *source_image);
static void debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
@@ -88,6 +93,16 @@
}
void
+debug_show_image_graph_cmd_callback (GtkAction *action,
+ gpointer data)
+{
+ GimpImage *source_image = NULL;
+ return_if_no_image (source_image, data);
+
+ g_idle_add ((GSourceFunc) debug_show_image_graph, g_object_ref (source_image));
+}
+
+void
debug_dump_menus_cmd_callback (GtkAction *action,
gpointer data)
{
@@ -208,6 +223,64 @@
return FALSE;
}
+static gboolean
+debug_show_image_graph (GimpImage *source_image)
+{
+ Gimp *gimp = source_image->gimp;
+ GimpProjectable *projectable = GIMP_PROJECTABLE (source_image);
+ GeglNode *image_graph = gimp_projectable_get_graph (projectable);
+ GimpImage *new_image = NULL;
+ TileManager *tiles = NULL;
+ GimpLayer *layer = NULL;
+ GeglNode *introspect = NULL;
+ GeglNode *sink = NULL;
+ GeglBuffer *buffer = NULL;
+ gchar *new_name = NULL;
+
+ /* Setup and process the introspection graph */
+ introspect = gegl_node_new_child (NULL,
+ "operation", "gegl:introspect",
+ "node", image_graph,
+ NULL);
+ sink = gegl_node_new_child (NULL,
+ "operation", "gegl:buffer-sink",
+ "buffer", &buffer,
+ NULL);
+ gegl_node_link_many (introspect, sink, NULL);
+ gegl_node_process (sink);
+
+ /* Create a new image of the result */
+ tiles = gimp_buffer_to_tiles (buffer);
+ new_name = g_strdup_printf ("%s GEGL graph",
+ gimp_object_get_name (GIMP_OBJECT (source_image)));
+ new_image = gimp_create_image (gimp,
+ tile_manager_width (tiles),
+ tile_manager_height (tiles),
+ GIMP_RGB,
+ FALSE);
+ gimp_object_set_name (GIMP_OBJECT (new_image),
+ new_name);
+ layer = gimp_layer_new_from_tiles (tiles,
+ new_image,
+ GIMP_RGBA_IMAGE,
+ new_name,
+ 1.0,
+ GIMP_NORMAL_MODE);
+ gimp_image_add_layer (new_image, layer, 0, FALSE);
+ gimp_create_display (gimp, new_image, GIMP_UNIT_PIXEL, 1.0);
+
+ /* Cleanup */
+ g_object_unref (new_image);
+ g_free (new_name);
+ tile_manager_unref (tiles);
+ g_object_unref (buffer);
+ g_object_unref (sink);
+ g_object_unref (introspect);
+ g_object_unref (source_image);
+
+ return FALSE;
+}
+
static void
debug_dump_menus_recurse_menu (GtkWidget *menu,
gint depth,
Modified: trunk/app/actions/debug-commands.h
==============================================================================
--- trunk/app/actions/debug-commands.h (original)
+++ trunk/app/actions/debug-commands.h Mon Feb 23 20:43:30 2009
@@ -36,6 +36,8 @@
gpointer data);
void debug_benchmark_projection_cmd_callback (GtkAction *action,
gpointer data);
+void debug_show_image_graph_cmd_callback (GtkAction *action,
+ gpointer data);
#endif /* ENABLE_DEBUG_MENU */
Modified: trunk/menus/image-menu.xml.in
==============================================================================
--- trunk/menus/image-menu.xml.in (original)
+++ trunk/menus/image-menu.xml.in Mon Feb 23 20:43:30 2009
@@ -27,6 +27,7 @@
<menu action="debug-menu" name="Debug">
<menuitem action="debug-mem-profile" />
<menuitem action="debug-benchmark-projection" />
+ <menuitem action="debug-show-image-graph" />
<separator />
<menuitem action="debug-dump-items" />
<menuitem action="debug-dump-managers" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]