gimp r27211 - in trunk: . app/core
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27211 - in trunk: . app/core
- Date: Fri, 10 Oct 2008 19:36:18 +0000 (UTC)
Author: mitch
Date: Fri Oct 10 19:36:17 2008
New Revision: 27211
URL: http://svn.gnome.org/viewvc/gimp?rev=27211&view=rev
Log:
2008-10-10 Michael Natterer <mitch gimp org>
* app/core/gimpdrawable.[ch]: add virtual function
GimpDrawable::get_node() which returns a node to be plugged into
the projection.
* app/core/gimplayer.[ch]: remove public get_node() api and
implement the virtual function instead.
* app/core/gimpimage.c: changed accordingly.
Modified:
trunk/ChangeLog
trunk/app/core/gimpdrawable.c
trunk/app/core/gimpdrawable.h
trunk/app/core/gimpimage.c
trunk/app/core/gimplayer.c
trunk/app/core/gimplayer.h
Modified: trunk/app/core/gimpdrawable.c
==============================================================================
--- trunk/app/core/gimpdrawable.c (original)
+++ trunk/app/core/gimpdrawable.c Fri Oct 10 19:36:17 2008
@@ -220,6 +220,7 @@
klass->replace_region = gimp_drawable_real_replace_region;
klass->get_tiles = gimp_drawable_real_get_tiles;
klass->set_tiles = gimp_drawable_real_set_tiles;
+ klass->get_node = NULL;
klass->push_undo = gimp_drawable_real_push_undo;
klass->swap_pixels = gimp_drawable_real_swap_pixels;
}
@@ -1066,6 +1067,17 @@
return drawable->source_node;
}
+GeglNode *
+gimp_drawable_get_node (GimpDrawable *drawable)
+{
+ g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+
+ if (GIMP_DRAWABLE_GET_CLASS (drawable)->get_node)
+ return GIMP_DRAWABLE_GET_CLASS (drawable)->get_node (drawable);
+
+ return NULL;
+}
+
void
gimp_drawable_swap_pixels (GimpDrawable *drawable,
TileManager *tiles,
Modified: trunk/app/core/gimpdrawable.h
==============================================================================
--- trunk/app/core/gimpdrawable.h (original)
+++ trunk/app/core/gimpdrawable.h Fri Oct 10 19:36:17 2008
@@ -95,6 +95,7 @@
GimpImageType type,
gint offset_x,
gint offset_y);
+ GeglNode * (* get_node) (GimpDrawable *drawable);
void (* push_undo) (GimpDrawable *drawable,
const gchar *undo_desc,
@@ -172,6 +173,7 @@
gint offset_y);
GeglNode * gimp_drawable_get_source_node (GimpDrawable *drawable);
+GeglNode * gimp_drawable_get_node (GimpDrawable *drawable);
void gimp_drawable_swap_pixels (GimpDrawable *drawable,
TileManager *tiles,
Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c (original)
+++ trunk/app/core/gimpimage.c Fri Oct 10 19:36:17 2008
@@ -2576,8 +2576,8 @@
for (list = reverse_list; list; list = g_list_next (list))
{
- GimpLayer *layer = list->data;
- GeglNode *node = gimp_layer_get_node (layer);
+ GimpDrawable *layer = list->data;
+ GeglNode *node = gimp_drawable_get_node (layer);
gegl_node_add_child (image->graph, node);
@@ -2612,7 +2612,7 @@
index = gimp_image_get_layer_index (image, layer);
- node = gimp_layer_get_node (layer);
+ node = gimp_drawable_get_node (GIMP_DRAWABLE (layer));
if (index == 0)
{
@@ -2630,7 +2630,7 @@
layer_above = gimp_image_get_layer_by_index (image, index - 1);
- node_above = gimp_layer_get_node (layer_above);
+ node_above = gimp_drawable_get_node (GIMP_DRAWABLE (layer_above));
gegl_node_connect_to (node, "output",
node_above, "input");
@@ -2640,7 +2640,7 @@
if (layer_below)
{
- GeglNode *node_below = gimp_layer_get_node (layer_below);
+ GeglNode *node_below = gimp_drawable_get_node (GIMP_DRAWABLE (layer_below));
gegl_node_connect_to (node_below, "output",
node, "input");
@@ -2658,7 +2658,7 @@
index = gimp_image_get_layer_index (image, layer);
- node = gimp_layer_get_node (layer);
+ node = gimp_drawable_get_node (GIMP_DRAWABLE (layer));
layer_below = gimp_image_get_layer_by_index (image, index + 1);
@@ -2666,9 +2666,11 @@
{
if (layer_below)
{
- GeglNode *node_below = gimp_layer_get_node (layer_below);
+ GeglNode *node_below;
GeglNode *output;
+ node_below = gimp_drawable_get_node (GIMP_DRAWABLE (layer_below));
+
output = gegl_node_get_output_proxy (image->graph, "output");
gegl_node_disconnect (node, "input");
@@ -2682,11 +2684,14 @@
GeglNode *node_above;
layer_above = gimp_image_get_layer_by_index (image, index - 1);
- node_above = gimp_layer_get_node (layer_above);
+
+ node_above = gimp_drawable_get_node (GIMP_DRAWABLE (layer_above));
if (layer_below)
{
- GeglNode *node_below = gimp_layer_get_node (layer_below);
+ GeglNode *node_below;
+
+ node_below = gimp_drawable_get_node (GIMP_DRAWABLE (layer_below));
gegl_node_disconnect (node, "input");
gegl_node_connect_to (node_below, "output",
@@ -3172,7 +3177,8 @@
{
gimp_image_remove_layer_node (image, layer);
- gegl_node_remove_child (image->graph, gimp_layer_get_node (layer));
+ gegl_node_remove_child (image->graph,
+ gimp_drawable_get_node (GIMP_DRAWABLE (layer)));
}
gimp_container_remove (image->layers, GIMP_OBJECT (layer));
Modified: trunk/app/core/gimplayer.c
==============================================================================
--- trunk/app/core/gimplayer.c (original)
+++ trunk/app/core/gimplayer.c Fri Oct 10 19:36:17 2008
@@ -166,6 +166,8 @@
GimpImageType type,
gint offset_x,
gint offset_y);
+static GeglNode * gimp_layer_get_node (GimpDrawable *drawable);
+
static gint gimp_layer_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
@@ -275,6 +277,7 @@
drawable_class->invalidate_boundary = gimp_layer_invalidate_boundary;
drawable_class->get_active_components = gimp_layer_get_active_components;
drawable_class->set_tiles = gimp_layer_set_tiles;
+ drawable_class->get_node = gimp_layer_get_node;
klass->opacity_changed = NULL;
klass->mode_changed = NULL;
@@ -513,6 +516,86 @@
floating_sel_rigor (layer, FALSE);
}
+static GeglNode *
+gimp_layer_get_node (GimpDrawable *drawable)
+{
+ GimpLayer *layer = GIMP_LAYER (drawable);
+ GeglNode *source;
+ gint off_x, off_y;
+ GeglNode *input;
+ GeglNode *output;
+
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
+
+ if (layer->node)
+ return layer->node;
+
+ layer->node = gegl_node_new ();
+
+ source = gimp_drawable_get_source_node (GIMP_DRAWABLE (layer));
+ gegl_node_add_child (layer->node, source);
+
+ if (layer->mask)
+ {
+ GeglNode *mask;
+
+ mask = gimp_drawable_get_source_node (GIMP_DRAWABLE (layer->mask));
+
+ layer->mask_node = gegl_node_new_child (layer->node,
+ "operation", "opacity",
+ NULL);
+ gegl_node_connect_to (mask, "output",
+ layer->mask_node, "aux");
+ gegl_node_connect_to (source, "output",
+ layer->mask_node, "input");
+ }
+
+ gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
+ layer->shift_node = gegl_node_new_child (layer->node,
+ "operation", "shift",
+ "x", (gdouble) off_x,
+ "y", (gdouble) off_y,
+ NULL);
+
+ if (layer->mask_node)
+ gegl_node_connect_to (layer->mask_node, "output",
+ layer->shift_node, "input");
+ else
+ gegl_node_connect_to (source, "output",
+ layer->shift_node, "input");
+
+ layer->opacity_node = gegl_node_new_child (layer->node,
+ "operation", "opacity",
+ "value", layer->opacity,
+ NULL);
+ gegl_node_connect_to (layer->shift_node, "output",
+ layer->opacity_node, "input");
+
+ layer->mode_node = gegl_node_new_child (layer->node,
+ "operation", gimp_layer_mode_to_gegl_operation (layer->mode),
+ NULL);
+ gegl_node_connect_to (layer->opacity_node, "output",
+ layer->mode_node, "aux");
+
+ input = gegl_node_get_input_proxy (layer->node, "input");
+ output = gegl_node_get_output_proxy (layer->node, "output");
+
+ if (gimp_item_get_visible (GIMP_ITEM (layer)))
+ {
+ gegl_node_connect_to (input, "output",
+ layer->mode_node, "input");
+ gegl_node_connect_to (layer->mode_node, "output",
+ output, "input");
+ }
+ else
+ {
+ gegl_node_connect_to (input, "output",
+ output, "input");
+ }
+
+ return layer->node;
+}
+
static void
gimp_layer_removed (GimpItem *item)
{
@@ -1934,85 +2017,6 @@
return (layer->fs.drawable != NULL);
}
-GeglNode *
-gimp_layer_get_node (GimpLayer *layer)
-{
- GeglNode *source;
- gint off_x, off_y;
- GeglNode *input;
- GeglNode *output;
-
- g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
-
- if (layer->node)
- return layer->node;
-
- layer->node = gegl_node_new ();
-
- source = gimp_drawable_get_source_node (GIMP_DRAWABLE (layer));
- gegl_node_add_child (layer->node, source);
-
- if (layer->mask)
- {
- GeglNode *mask;
-
- mask = gimp_drawable_get_source_node (GIMP_DRAWABLE (layer->mask));
-
- layer->mask_node = gegl_node_new_child (layer->node,
- "operation", "opacity",
- NULL);
- gegl_node_connect_to (mask, "output",
- layer->mask_node, "aux");
- gegl_node_connect_to (source, "output",
- layer->mask_node, "input");
- }
-
- gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
- layer->shift_node = gegl_node_new_child (layer->node,
- "operation", "shift",
- "x", (gdouble) off_x,
- "y", (gdouble) off_y,
- NULL);
-
- if (layer->mask_node)
- gegl_node_connect_to (layer->mask_node, "output",
- layer->shift_node, "input");
- else
- gegl_node_connect_to (source, "output",
- layer->shift_node, "input");
-
- layer->opacity_node = gegl_node_new_child (layer->node,
- "operation", "opacity",
- "value", layer->opacity,
- NULL);
- gegl_node_connect_to (layer->shift_node, "output",
- layer->opacity_node, "input");
-
- layer->mode_node = gegl_node_new_child (layer->node,
- "operation", gimp_layer_mode_to_gegl_operation (layer->mode),
- NULL);
- gegl_node_connect_to (layer->opacity_node, "output",
- layer->mode_node, "aux");
-
- input = gegl_node_get_input_proxy (layer->node, "input");
- output = gegl_node_get_output_proxy (layer->node, "output");
-
- if (gimp_item_get_visible (GIMP_ITEM (layer)))
- {
- gegl_node_connect_to (input, "output",
- layer->mode_node, "input");
- gegl_node_connect_to (layer->mode_node, "output",
- output, "input");
- }
- else
- {
- gegl_node_connect_to (input, "output",
- output, "input");
- }
-
- return layer->node;
-}
-
void
gimp_layer_set_opacity (GimpLayer *layer,
gdouble opacity,
Modified: trunk/app/core/gimplayer.h
==============================================================================
--- trunk/app/core/gimplayer.h (original)
+++ trunk/app/core/gimplayer.h Fri Oct 10 19:36:17 2008
@@ -127,8 +127,6 @@
gboolean gimp_layer_is_floating_sel (const GimpLayer *layer);
-GeglNode * gimp_layer_get_node (GimpLayer *layer);
-
void gimp_layer_set_opacity (GimpLayer *layer,
gdouble opacity,
gboolean push_undo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]