Exemplo n.º 1
0
GList *
gegl_graph_get_connected_output_contexts (GeglGraphTraversal *path,
                                          GeglPad            *output_pad)
{
  GList *result = NULL;
  GSList *targets = gegl_pad_get_connections (output_pad);
  GSList *targets_iter;
  for (targets_iter = targets; targets_iter; targets_iter = g_slist_next (targets_iter))
    {
      GeglNode *target_node = gegl_connection_get_sink_node (targets_iter->data);
      GeglOperationContext *target_context = g_hash_table_lookup (path->contexts, target_node);
      
      /* Only include this target if it's part of the current path */
      if (target_context)
        {
          const gchar *target_pad_name = gegl_pad_get_name (gegl_connection_get_sink_pad (targets_iter->data));
          
          ContextConnection *result_element = g_new0 (ContextConnection, 1);
          result_element->name    = target_pad_name;
          result_element->context = target_context;
          
          result = g_list_prepend (result, result_element);
        }
    }
  return result;
}
Exemplo n.º 2
0
void
gegl_dot_util_add_connection (GString        *string,
                              GeglConnection *connection)
{
  GeglNode *source;
  GeglNode *sink;
  GeglPad  *source_pad;
  GeglPad  *sink_pad;

  source     = gegl_connection_get_source_node (connection);
  sink       = gegl_connection_get_sink_node (connection);
  source_pad = gegl_connection_get_source_pad (connection);
  sink_pad   = gegl_connection_get_sink_pad (connection);

  g_string_append_printf (string, "op_%p:%s -> op_%p:%s;\n",
                          source, gegl_pad_get_name (source_pad),
                          sink,   gegl_pad_get_name (sink_pad));
}
Exemplo n.º 3
0
void
gegl_pad_disconnect (GeglPad        *sink,
                     GeglPad        *source,
                     GeglConnection *connection)
{
  g_return_if_fail (GEGL_IS_PAD (sink));
  g_return_if_fail (GEGL_IS_PAD (source));

  g_assert (sink == gegl_connection_get_sink_pad (connection));
  /*
   *  this happens with ghostpads sometimes,. maybe check for that being
   *  the case, and then do the assert, or bake it into the assert?
   *
     g_assert (source == gegl_connection_get_source_pad (connection));
   */

  sink->connections   = g_slist_remove (sink->connections, connection);
  source->connections = g_slist_remove (source->connections, connection);
}