[gegl] core: introspection annotations for gegl_node_get_children



commit e09076f9f899cfc21f3509f0c173e48b7614aedd
Author: �yvind Kolås <pippin gimp org>
Date:   Sun Apr 24 12:38:47 2011 +0100

    core: introspection annotations for gegl_node_get_children

 examples/introspection.py |   40 +++++++++++++++++++++++++++++++++++++---
 gegl/gegl.h               |   24 +++---------------------
 2 files changed, 40 insertions(+), 24 deletions(-)
---
diff --git a/examples/introspection.py b/examples/introspection.py
index 315b914..3539b52 100755
--- a/examples/introspection.py
+++ b/examples/introspection.py
@@ -12,9 +12,43 @@ GObject introspection."""
 import gi
 from gi.repository import Gegl
 
+# extend GEGL binding with some utility function that makes it possible
+# to lookup a node among the children of a node giving one with a specified name.
+
+def locate_by_type(self, opname):
+  for i in self.get_children():
+     if i.get_operation() == opname:
+        return i
+Gegl.Node.locate_by_type = locate_by_type
+
 if __name__ == '__main__':
-    # Right now just a sanity check
+    Gegl.init(0,"")
     node = Gegl.Node.new()
-    print dir(node)
+    node = Gegl.Node.new_from_xml("""
+      <gegl>
+        <gegl:save path='/tmp/a.png'/>
+        <gegl:crop width='512' height='512'/>
+        <!--<gegl:over >
+          <gegl:translate x='30' y='30'/>
+          <gegl:dropshadow radius='1.5' x='3' y='3'/>
+          <gegl:text size='80' color='white'
+><params><param name='string'>GEGL
+ I
+ R</param></params></gegl:text>
+        </gegl:over>-->
+ 
+        <gegl:over>
+        <gegl:vignette amount='1.0' radius='0.71' width='0.8' color='#0000' gamma='1.0'/>
+        <gegl:crop width='512' height='512'/>
+        <!-- <gegl:unsharp-mask std-dev='30'/> -->
+        <!-- <gegl:stress /> -->
+        <gegl:color value='red'/>
+        <!-- <gegl:load path='/home/pippin/images/lena.png'/> -->
+        </gegl:over>
+        <gegl:color value='black'/>
+        <!-- <gegl:checkerboard /> -->
+ 
+      </gegl>
+""", "/");
 
-    print dir(Gegl.Matrix3)
+    node.locate_by_type('gegl:save').process()
diff --git a/gegl/gegl.h b/gegl/gegl.h
index c4d8af5..ebea328 100644
--- a/gegl/gegl.h
+++ b/gegl/gegl.h
@@ -468,26 +468,7 @@ void          gegl_node_process          (GeglNode      *sink_node);
  * Sometimes it is useful to be able to move nodes between graphs or even
  * handle orphaned nods that are not part of a graph. gegl_node_adopt_child
  * and gegl_node_get_parent are provided to handle such cases.
- *
- * (gegl_node_adopt_child is deprecated, and will be removed in a future
- * release)
- */
-
-/**
- * gegl_node_adopt_child:
- * @parent: a #GeglNode or NULL.
- * @child: a #GeglNode
- *
- * Adds @child to the responsibilities of @node, this makes the parent node
- * take a reference on the child that is kept as long as the parent itself is
- * being referenced. The node is stolen from an existing parent if there is one,
- * or a presumed existing reference is used. If @parent is NULL the child will
- * be orphaned and the developer is given a reference to be responsible of.
- *
- * Returns the child, or NULL if there was a problem with the arguments.
  */
-GeglNode    * gegl_node_adopt_child        (GeglNode      *parent,
-                                            GeglNode      *child);
 
 /**
  * gegl_node_add_child:
@@ -582,8 +563,9 @@ GeglRectangle gegl_node_get_bounding_box (GeglNode      *node);
  * gegl_node_get_children:
  * @node: the node to retrieve the children of.
  *
- * Returns a list of nodes with children/internal nodes. The list must be
- * freed by the caller.
+ * Return value: (element-type Gegl.Node) (transfer container): a list
+ * of the nodes contained within a GeglNode that is a subgraph.
+ * Use g_list_free () on the list when done.
  */
 GSList      * gegl_node_get_children     (GeglNode      *node);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]