app: add gimp_gegl_node_{set,get}_underlying_oepration()

... which allow setting/getting the "underlying operation" node of
a graph node.  For example, GimpDrawableFilter constructs a complex
graph around a given operation node, which would be the underlying
operation of the graph.  This allows querying the properties of the
underlying operation, given only the graph.

In recursive cases, gimp_gegl_node_get_underlying_operation()
returns the most-nested underlying operation; when no underlying
operation has been set, gimp_gegl_node_get_underlying_operation()
returns the input node.
This commit is contained in:
Ell 2019-03-27 14:58:30 -04:00
parent ff13e55c16
commit eb5e473665
2 changed files with 48 additions and 17 deletions

View File

@ -177,6 +177,33 @@ gimp_gegl_node_get_format (GeglNode *node,
return format;
}
void
gimp_gegl_node_set_underlying_operation (GeglNode *node,
GeglNode *operation)
{
g_return_if_fail (GEGL_IS_NODE (node));
g_return_if_fail (operation == NULL || GEGL_IS_NODE (operation));
g_object_set_data (G_OBJECT (node),
"gimp-gegl-node-underlying-operation", operation);
}
GeglNode *
gimp_gegl_node_get_underlying_operation (GeglNode *node)
{
GeglNode *operation;
g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
operation = g_object_get_data (G_OBJECT (node),
"gimp-gegl-node-underlying-operation");
if (operation)
return gimp_gegl_node_get_underlying_operation (operation);
else
return node;
}
gboolean
gimp_gegl_param_spec_has_key (GParamSpec *pspec,
const gchar *key,

View File

@ -22,29 +22,33 @@
#define __GIMP_GEGL_UTILS_H__
GType gimp_gegl_get_op_enum_type (const gchar *operation,
const gchar *property);
GType gimp_gegl_get_op_enum_type (const gchar *operation,
const gchar *property);
GeglColor * gimp_gegl_color_new (const GimpRGB *rgb,
const Babl *space);
GeglColor * gimp_gegl_color_new (const GimpRGB *rgb,
const Babl *space);
void gimp_gegl_progress_connect (GeglNode *node,
GimpProgress *progress,
const gchar *text);
void gimp_gegl_progress_connect (GeglNode *node,
GimpProgress *progress,
const gchar *text);
gboolean gimp_gegl_node_is_source_operation (GeglNode *node);
gboolean gimp_gegl_node_is_point_operation (GeglNode *node);
gboolean gimp_gegl_node_is_source_operation (GeglNode *node);
gboolean gimp_gegl_node_is_point_operation (GeglNode *node);
const Babl * gimp_gegl_node_get_format (GeglNode *node,
const gchar *pad_name);
const Babl * gimp_gegl_node_get_format (GeglNode *node,
const gchar *pad_name);
gboolean gimp_gegl_param_spec_has_key (GParamSpec *pspec,
const gchar *key,
const gchar *value);
void gimp_gegl_node_set_underlying_operation (GeglNode *node,
GeglNode *operation);
GeglNode * gimp_gegl_node_get_underlying_operation (GeglNode *node);
void gimp_gegl_rectangle_align_to_tile_grid (GeglRectangle *dest,
const GeglRectangle *src,
GeglBuffer *buffer);
gboolean gimp_gegl_param_spec_has_key (GParamSpec *pspec,
const gchar *key,
const gchar *value);
void gimp_gegl_rectangle_align_to_tile_grid (GeglRectangle *dest,
const GeglRectangle *src,
GeglBuffer *buffer);
#endif /* __GIMP_GEGL_UTILS_H__ */