## gegl-node

gegl-node

## Functions

GeglNode * | gegl_node_new ()
GeglNode * | gegl_node_new_child ()
gboolean | gegl_node_connect_from ()
gboolean | gegl_node_connect_to ()
void | gegl_node_link ()
void | gegl_node_link_many ()
gboolean | gegl_node_disconnect ()
void | gegl_node_set ()
void | gegl_node_set_valist ()
void | gegl_node_get ()
void | gegl_node_get_valist ()
void | gegl_node_blit ()
void | gegl_node_blit_buffer ()
void | gegl_node_process ()
GeglNode * | gegl_node_add_child ()
GeglNode * | gegl_node_remove_child ()
GeglNode * | gegl_node_get_parent ()
GeglNode * | gegl_node_detect ()
GParamSpec * | gegl_node_find_property ()
GeglRectangle | gegl_node_get_bounding_box ()
GSList * | gegl_node_get_children ()
gint | gegl_node_get_consumers ()
GeglNode * | gegl_node_get_input_proxy ()
const gchar * | gegl_node_get_operation ()
GeglOperation * | gegl_node_get_gegl_operation ()
GeglNode * | gegl_node_get_output_proxy ()
GeglNode * | gegl_node_get_producer ()
gboolean | gegl_node_has_pad ()
gchar ** | gegl_node_list_input_pads ()
gchar ** | gegl_node_list_output_pads ()
GeglNode * | gegl_node_create_child ()
void | gegl_node_get_property ()
void | gegl_node_set_property ()
GeglNode * | gegl_node_new_from_xml ()
GeglNode * | gegl_node_new_from_file ()
gchar * | gegl_node_to_xml ()
gchar * | gegl_node_to_xml_full ()
gboolean | gegl_node_get_passthrough ()
void | gegl_node_set_passthrough ()
gboolean | gegl_node_is_graph ()
void | gegl_node_progress ()
const char * | gegl_operation_get_op_version ()

## Description

## Functions

### gegl_node_new ()

    GeglNode *
    gegl_node_new (void);

Create a new graph that can contain further processing nodes.

#### Returns

A new top level GeglNode (which can be used as a graph). When you are done using this graph instance it should be unreferenced with g_object_unref. This will also free any sub nodes created from this node.

[transfer full]

### gegl_node_new_child ()

    GeglNode *
    gegl_node_new_child (GeglNode *parent,
                         const gchar *first_property_name,
                         ...);

Creates a new processing node that performs the specified operation with a NULL terminated list of key/value pairs for initial parameter values configuring the operation. Usually the first pair should be "operation" and the type of operation to be associated. If no operation is provided the node doesn't have an initial operation and can be used to construct a subgraph with special middle-man routing nodes created with gegl_node_get_output_proxy and gegl_node_get_input_proxy.

#### Parameters

parent | a GeglNode |
first_property_name | the first property name |
... | first property value, optionally followed by more key/value pairs, terminated with NULL. |

#### Returns

A newly created GeglNode. The node will be destroyed by the parent. Calling g_object_unref on a node will cause the node to be dropped by the parent. (You may also add additional references using g_object_ref/g_object_unref, but in general relying on the parents reference counting is easiest.).

[transfer none]

### gegl_node_connect_from ()

    gboolean
    gegl_node_connect_from (GeglNode *sink,
                            const gchar *input_pad_name,
                            GeglNode *source,
                            const gchar *output_pad_name);

Makes a connection between the pads of two nodes.

Returns TRUE if the connection was successfully made.

#### Parameters

sink | the node we're connecting an input to |
input_pad_name | the name of the input pad we are connecting to |
source | the node producing data we want to connect. |
output_pad_name | the output pad we want to use on the source. |

### gegl_node_connect_to ()

    gboolean
    gegl_node_connect_to (GeglNode *source,
                          const gchar *output_pad_name,
                          GeglNode *sink,
                          const gchar *input_pad_name);

Makes a connection between the pads of two nodes.

Returns TRUE if the connection was successfully made.

#### Parameters

source | the node producing data we want to connect. |
output_pad_name | the output pad we want to use on the source. |
sink | the node we're connecting an input to |
input_pad_name | the name of the input pad we are connecting to |

### gegl_node_link ()

    void
    gegl_node_link (GeglNode *source,
                    GeglNode *sink);

Synthetic sugar for linking the "output" pad of `source` to the "input" pad of `sink` .

#### Parameters

source | the producer of data. |
sink | the consumer of data. |

### gegl_node_link_many ()

    void
    gegl_node_link_many (GeglNode *source,
                         GeglNode *first_sink,
                         ...);

Synthetic sugar for linking a chain of nodes with "input"->"output". The list is NULL terminated.

#### Parameters

source | the producer of data. |
first_sink | the first consumer of data. |
... | NULL, or optionally more consumers followed by NULL. |

### gegl_node_disconnect ()

    gboolean
    gegl_node_disconnect (GeglNode *node,
                          const gchar *input_pad);

Disconnects node connected to `input_pad` of `node` (if any).

Returns TRUE if a connection was broken.

#### Parameters

node | a GeglNode |
input_pad | the input pad to disconnect. |

### gegl_node_set ()

    void
    gegl_node_set (GeglNode *node,
                   const gchar *first_property_name,
                   ...);

Set properties on a node, possible properties to be set are the properties of the currently set operations as well as <em>"name"</em> and

<em>"operation"</em>. <em>"operation"</em> changes the current operations

set for the node, <em>"name"</em> doesn't have any role internally in GEGL. --- gegl_node_set (node, "brightness", -0.2, "contrast", 2.0, NULL);

#### Parameters

node | a GeglNode |
first_property_name | name of the first property to set |
... | value for the first property, followed optionally by more name/value pairs, followed by NULL. |

### gegl_node_set_valist ()

    void
    gegl_node_set_valist (GeglNode *node,
                          const gchar *first_property_name,
                          va_list args);

valist version of gegl_node_set

#### Parameters

node | a GeglNode |
first_property_name | name of the first property to set |
args | value for the first property, followed optionally by more name/value pairs, followed by NULL. |

### gegl_node_get ()

    void
    gegl_node_get (GeglNode *node,
                   const gchar *first_property_name,
                   ...);

Gets properties of a GeglNode. --- double level; char *path;

gegl_node_get (png_save, "path", &path, NULL); gegl_node_get (threshold, "level", &level, NULL);

#### Parameters

node | a GeglNode |
first_property_name | name of the first property to get. |
... | return location for the first property, followed optionally by more name/value pairs, followed by NULL. |

### gegl_node_get_valist ()

    void
    gegl_node_get_valist (GeglNode *node,
                          const gchar *first_property_name,
                          va_list args);

valist version of gegl_node_get

#### Parameters

node | a GeglNode |
first_property_name | name of the first property to get. |
args | return location for the first property, followed optionally by more name/value pairs, followed by NULL. |

### gegl_node_blit ()

    void
    gegl_node_blit (GeglNode *node,
                    gdouble scale,
                    const GeglRectangle *roi,
                    const Babl *format,
                    gpointer destination_buf,
                    gint rowstride,
                    GeglBlitFlags flags);

Render a rectangular region from a node.

[skip]

#### Parameters

node | a GeglNode |
scale | the scale to render at 1.0 is default, other values changes the width/height of the sampled region. |
roi | the rectangle to render from the node, the coordinate system used is coordinates after scale has been applied. |
format | the BablFormat desired. |
destination_buf | a memory buffer large enough to contain the data, can be left as NULL when forcing a rendering of a region. |
rowstride | rowstride in bytes, or GEGL_AUTO_ROWSTRIDE to compute the rowstride based on the width and bytes per pixel for the specified format. |
flags | an or'ed combination of GEGL_BLIT_DEFAULT, GEGL_BLIT_CACHE and GEGL_BLIT_DIRTY. if cache is enabled, a cache will be set up for subsequent requests of image data from this node. By passing in GEGL_BLIT_DIRTY the function will return with the latest rendered results in the cache without regard to wheter the regions has been rendered or not. |

### gegl_node_blit_buffer ()

    void
    gegl_node_blit_buffer (GeglNode *node,
                           GeglBuffer *buffer,
                           const GeglRectangle *roi,
                           int level,
                           GeglAbyssPolicy abyss_policy);

Render a rectangular region from a node to the given buffer.

#### Parameters

node | a GeglNode |
buffer | the GeglBuffer to render to. | [transfer none][allow-none]
roi | the rectangle to render. | [allow-none]
level | mipmap level to render (0 for all) |

### gegl_node_process ()

    void
    gegl_node_process (GeglNode *sink_node);

Render a composition. This can be used for instance on a node with a "png-save" operation to render all necessary data, and make it be written to file. This function wraps the usage of a GeglProcessor in a single blocking function call. If you need a non-blocking operation, then make a direct use of gegl_processor_work. See GeglProcessor.

--- GeglNode *gegl; GeglRectangle roi; GeglNode *png_save; unsigned char *buffer;

gegl = gegl_parse_xml (xml_data); roi = gegl_node_get_bounding_box (gegl);

### create png_save from the graph, the parent/child relationship

### only mean anything when it comes to memory management.

png_save = gegl_node_new_child (gegl, "operation", "gegl:png-save", "path", "output.png", NULL);

gegl_node_link (gegl, png_save); gegl_node_process (png_save);

buffer = malloc (roi.w*roi.h*4); gegl_node_blit (gegl, 1.0, &roi, babl_format("R'G'B'A u8"), buffer, GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);

#### Parameters

sink_node | a GeglNode without outputs. |

### gegl_node_add_child ()

    GeglNode *
    gegl_node_add_child (GeglNode *graph,
                         GeglNode *child);

Make the GeglNode `graph` , take a reference on child. This reference will be dropped when the reference count on the graph reaches zero.

#### Parameters

graph | a GeglNode (graph) |
child | a GeglNode. |

#### Returns

the child.

[transfer none]

### gegl_node_remove_child ()

    GeglNode *
    gegl_node_remove_child (GeglNode *graph,
                            GeglNode *child);

Removes a child from a GeglNode. The reference previously held will be dropped so increase the reference count before removing when reparenting a child between two graphs.

#### Parameters

graph | a GeglNode (graph) |
child | a GeglNode. |

#### Returns

the child.

[transfer none]

### gegl_node_get_parent ()

    GeglNode *
    gegl_node_get_parent (GeglNode *node);

Returns a GeglNode that keeps a reference on a child.

#### Parameters

node | a GeglNode |

#### Returns

the parent of a node or NULL.

[transfer none]

### gegl_node_detect ()

    GeglNode *
    gegl_node_detect (GeglNode *node,
                      gint x,
                      gint y);

Performs hit detection by returning the node providing data at a given coordinate pair. Currently operates only on bounding boxes and not pixel data.

#### Parameters

node | a GeglNode |
x | x coordinate |
y | y coordinate |

#### Returns

the GeglNode providing the data ending up at `x` ,`y` in the output of `node` .

[transfer none]

### gegl_node_find_property ()

    GParamSpec *
    gegl_node_find_property (GeglNode *node,
                             const gchar *property_name);

#### Parameters

node | the node to lookup a paramspec on |
property_name | the name of the property to get a paramspec for. |

#### Returns

the GParamSpec of property or NULL if no such property exists.

[transfer none]

### gegl_node_get_bounding_box ()

    GeglRectangle
    gegl_node_get_bounding_box (GeglNode *node);

Returns the position and dimensions of a rectangle spanning the area defined by a node.

[skip]

#### Parameters

node | a GeglNode |

### gegl_node_get_children ()

    GSList *
    gegl_node_get_children (GeglNode *node);

#### Parameters

node | the node to retrieve the children of. |

#### Returns

a list of the nodes contained within a GeglNode that is a subgraph. Use `g_list_free()` on the list when done.

[element-type Gegl.Node][transfer container]

### gegl_node_get_consumers ()

    gint
    gegl_node_get_consumers (GeglNode *node,
                             const gchar *output_pad,
                             GeglNode ***nodes,
                             const gchar ***pads);

Retrieve which pads on which nodes are connected to a named output_pad, and the number of connections. Both the location for the generated nodes array and pads array can be left as NULL. If they are non NULL both should be freed with g_free. The arrays are NULL terminated.

Returns the number of consumers connected to this output_pad.

#### Parameters

node | the node we are querying. |
output_pad | the output pad we want to know who uses. |
nodes | optional return location for array of nodes. | [out callee-allocates][array zero-terminated=1][allow-none]
pads | optional return location for array of pad names. | [out callee-allocates][array zero-terminated=1][allow-none]

### gegl_node_get_input_proxy ()

    GeglNode *
    gegl_node_get_input_proxy (GeglNode *node,
                               const gchar *pad_name);

Proxies are used to route between nodes of a subgraph contained within a node.

#### Parameters

node | a GeglNode |
pad_name | the name of the pad. |

#### Returns

Returns an input proxy for the named pad. If no input proxy exists with this name a new one will be created.

[transfer none]

### gegl_node_get_operation ()

    const gchar *
    gegl_node_get_operation (const GeglNode *node);

#### Parameters

node | a GeglNode |

#### Returns

The type of processing operation associated with this node, or NULL if there is no op associated. The special name "GraphNode" is returned if the node is the container of a subgraph.

### gegl_node_get_gegl_operation ()

    GeglOperation *
    gegl_node_get_gegl_operation (GeglNode *node);

#### Parameters

node | a GeglNode |

#### Returns

The operation object associated with this node or NULL if there is no op associated.

[transfer none][allow-none]

### gegl_node_get_output_proxy ()

    GeglNode *
    gegl_node_get_output_proxy (GeglNode *node,
                                const gchar *pad_name);

Proxies are used to route between nodes of a subgraph contained within a node.

#### Parameters

node | a GeglNode |
pad_name | the name of the pad. |

#### Returns

Returns a output proxy for the named pad. If no output proxy exists with this name a new one will be created.

[transfer none]

### gegl_node_get_producer ()

    GeglNode *
    gegl_node_get_producer (GeglNode *node,
                            const gchar *input_pad_name,
                            gchar **output_pad_name);

#### Parameters

node | the node we are querying |
input_pad_name | the input pad we want to get the producer for |
output_pad_name | optional pointer to a location where we can store a freshly allocated string with the name of the output pad. | [allow-none]

#### Returns

the node providing data or NULL if no node is connected to the input_pad.

[transfer none]

### gegl_node_has_pad ()

    gboolean
    gegl_node_has_pad (GeglNode *node,
                       const gchar *pad_name);

Returns TRUE if the node has a pad with the specified name

#### Parameters

node | the node we are querying |
pad_name | the pad name we are looking for |

### gegl_node_list_input_pads ()

    gchar **
    gegl_node_list_input_pads (GeglNode *node);

If the node has any input pads this function returns a null terminated array of pad names, otherwise it returns NULL. The return value can be freed with `g_strfreev()`.

#### Parameters

node | the node we are querying |

#### Returns

.

[transfer full][array zero-terminated=1]

### gegl_node_list_output_pads ()

    gchar **
    gegl_node_list_output_pads (GeglNode *node);

If the node has any output pads this function returns a null terminated array of pad names, otherwise it returns NULL. The return value can be freed with `g_strfreev()`.

#### Parameters

node | the node we are querying |

#### Returns

.

[transfer full][array zero-terminated=1]

### gegl_node_create_child ()

    GeglNode *
    gegl_node_create_child (GeglNode *parent,
                            const gchar *operation);

Creates a new processing node that performs the specified operation. All properties of the operation will have their default values. This is included as an addition to gegl_node_new_child in the public API to have a non varargs entry point for bindings as well as sometimes simpler more readable code.

#### Parameters

parent | a GeglNode |
operation | the type of node to create. |

#### Returns

a newly created node. The node will be destroyed by the parent. Calling g_object_unref on a node will cause the node to be dropped by the parent. (You may also add additional references using g_object_ref/g_object_unref, but in general relying on the parents reference counting is easiest.).

[transfer none]

### gegl_node_get_property ()

    void
    gegl_node_get_property (GeglNode *node,
                            const gchar *property_name,
                            GValue *value);

This is mainly included for language bindings. Using gegl_node_get is more convenient when programming in C.

[skip]

#### Parameters

node | the node to get a property from |
property_name | the name of the property to get |
value | pointer to a GValue where the value of the property should be stored. | [out]

### gegl_node_set_property ()

    void
    gegl_node_set_property (GeglNode *object,
                            const gchar *property_name,
                            const GValue *value);

This is mainly included for language bindings. Using gegl_node_set is more convenient when programming in C.

#### Parameters

node | a GeglNode |
property_name | the name of the property to set |
value | a GValue containing the value to be set in the property. | [in]

### gegl_node_new_from_xml ()

    GeglNode *
    gegl_node_new_from_xml (const gchar *xmldata,
                            const gchar *path_root);

The GeglNode returned contains the graph described by the tree of stacks in the XML document. The tree is connected to the "output" pad of the returned node and thus can be used directly for processing.

#### Parameters

xmldata | a \0 terminated string containing XML data to be parsed. |
path_root | a file system path that relative paths in the XML will be resolved in relation to. |

#### Returns

a GeglNode containing the parsed XML as a subgraph.

[transfer full]

### gegl_node_new_from_file ()

    GeglNode *
    gegl_node_new_from_file (const gchar *path);

The GeglNode returned contains the graph described by the tree of stacks in the XML document. The tree is connected to the "output" pad of the returned node and thus can be used directly for processing.

#### Parameters

path | the path to a file on the local file system to be parsed. |

#### Returns

a GeglNode containing the parsed XML as a subgraph.

[transfer full]

### gegl_node_to_xml ()

    gchar *
    gegl_node_to_xml (GeglNode *gegl,
                      const gchar *path_root);

Returns a freshly allocated \0 terminated string containing a XML serialization of the composition produced by a node (and thus also the nodes contributing data to the specified node). To export a gegl graph, connect the internal output node to an output proxy (see gegl_node_get_output_proxy.) and use the proxy node as the basis for the serialization.

#### Parameters

node | a GeglNode |
path_root | filesystem path to construct relative paths from. |

### gegl_node_to_xml_full ()

    gchar *
    gegl_node_to_xml_full (GeglNode *head,
                           GeglNode *tail,
                           const gchar *path_root);

Returns a freshly allocated \0 terminated string containing a XML serialization of a segment of a graph from `head` to `tail` nodes. If `tail` is `NULL` then this behaves just like gegl_node_to_xml.

#### Parameters

head | a GeglNode |
tail | a GeglNode. | [allow-none]
path_root | filesystem path to construct relative paths from. |

#### Returns

XML serialization of a graph segment.

[transfer full]

### gegl_node_get_passthrough ()

    gboolean
    gegl_node_get_passthrough (GeglNode *node);

### gegl_node_set_passthrough ()

    void
    gegl_node_set_passthrough (GeglNode *node,
                               gboolean passthrough);

### gegl_node_is_graph ()

    gboolean
    gegl_node_is_graph (GeglNode *node);

### gegl_node_progress ()

    void
    gegl_node_progress (GeglNode *node,
                        gdouble progress,
                        gchar *message);

### gegl_operation_get_op_version ()

    const char *
    gegl_operation_get_op_version (const gchar *op_name);