Gegl.Node

g GObject.Object GObject.Object Gegl.Node Gegl.Node GObject.Object->Gegl.Node

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

class

new_from_file (path)

class

new_from_serialized (chaindata, path_root)

class

new_from_xml (xmldata, path_root)

add_child (child)

blit_buffer (buffer, roi, level, abyss_policy)

connect (a_pad_name, b, b_pad_name)

connect_from (input_pad_name, source, output_pad_name)

connect_to (output_pad_name, sink, input_pad_name)

create_child (operation)

detect (x, y)

disconnect (input_pad)

find_property (property_name)

get_bounding_box ()

get_children ()

get_consumers (output_pad)

get_gegl_operation ()

get_input_proxy (pad_name)

get_operation ()

get_output_proxy (pad_name)

get_parent ()

get_passthrough ()

get_producer (input_pad_name, output_pad_name)

get_property (property_name)

has_pad (pad_name)

is_graph ()

link (sink)

list_input_pads ()

list_output_pads ()

new_processor (rectangle)

process ()

progress (progress, message)

remove_child (child)

set_enum_as_string (key, value)

set_passthrough (passthrough)

set_property (property_name, value)

set_time (time)

to_xml (path_root)

to_xml_full (tail, path_root)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

cache-policy

Gegl.CachePolicy

r/w/c

Cache policy for this node, the property is inherited by children created from a node.

dont-cache

bool

r/w/c

Do not cache the result of this operation, the property is inherited by children created from a node. (Deprecated for “cache-policy”.)

gegl-operation

Gegl.Operation

r/w/c

The associated Gegl.Operation instance

name

str

r/w/c

The name of the node

operation

str

r/w/c

The type of associated Gegl.Operation

passthrough

bool

r/w/c

Act as a nop, passing input unmodifed through to ouput.

use-opencl

bool

r/w/c

Use the OpenCL version of this operation if available, this property is inherited by children created from a node.

Signals

Inherited:

GObject.Object (1)

Name

Short Description

computed

invalidated

progress

Fields

Inherited:

GObject.Object (1)

Class Details

class Gegl.Node(**kwargs)
Bases:

GObject.Object

Abstract:

No

classmethod new()
Returns:

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

Return type:

Gegl.Node

Create a new graph that can contain further processing nodes.

classmethod new_from_file(path)
Parameters:

path (str) – the path to a file on the local file system to be parsed.

Returns:

a Gegl.Node containing the parsed XML as a subgraph.

Return type:

Gegl.Node

The Gegl.Node 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.

classmethod new_from_serialized(chaindata, path_root)
Parameters:
  • chaindata (str) –

  • path_root (str) –

Return type:

Gegl.Node

classmethod new_from_xml(xmldata, path_root)
Parameters:
  • xmldata (str) – a \0 terminated string containing XML data to be parsed.

  • path_root (str) – a file system path that relative paths in the XML will be resolved in relation to.

Returns:

a Gegl.Node containing the parsed XML as a subgraph.

Return type:

Gegl.Node

The Gegl.Node 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.

add_child(child)
Parameters:

child (Gegl.Node) – a Gegl.Node.

Returns:

the child.

Return type:

Gegl.Node

Make the Gegl.Node self, take a reference on child. This reference will be dropped when the reference count on the graph reaches zero.

blit_buffer(buffer, roi, level, abyss_policy)
Parameters:

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

connect(a_pad_name, b, b_pad_name)
Parameters:
  • a_pad_name (str) – and the pad of the node we want connected.

  • b (Gegl.Node) – another node

  • b_pad_name (str) – and its pad to be connected.

Return type:

bool

Makes a connection between the pads of two nodes, one pad should be a source pad the other a sink pad, order does not matter.

Returns True if the connection was successfully made.

connect_from(input_pad_name, source, output_pad_name)
Parameters:
  • input_pad_name (str) – the name of the input pad we are connecting to

  • source (Gegl.Node) – the node producing data we want to connect.

  • output_pad_name (str) – the output pad we want to use on the source.

Return type:

bool

Makes a connection between the pads of two nodes.

Returns True if the connection was successfully made.

connect_to(output_pad_name, sink, input_pad_name)
Parameters:
  • output_pad_name (str) – the output pad we want to use on the source.

  • sink (Gegl.Node) – the node we’re connecting an input to

  • input_pad_name (str) – the name of the input pad we are connecting to

Return type:

bool

Makes a connection between the pads of two nodes.

Returns True if the connection was successfully made.

create_child(operation)
Parameters:

operation (str) – the type of node to create.

Returns:

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

Return type:

Gegl.Node

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.

detect(x, y)
Parameters:
  • x (int) – x coordinate

  • y (int) – y coordinate

Returns:

the Gegl.Node providing the data ending up at x,`y` in the output of self.

Return type:

Gegl.Node

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

disconnect(input_pad)
Parameters:

input_pad (str) – the input pad to disconnect.

Return type:

bool

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

Returns True if a connection was broken.

find_property(property_name)
Parameters:

property_name (str) – the name of the property to get a paramspec for.

Returns:

the GObject.ParamSpec of property or None if no such property exists.

Return type:

GObject.ParamSpec

get_bounding_box()
Returns:

pointer a Gegl.Rectangle

Return type:

Gegl.Rectangle

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

get_children()
Returns:

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

Return type:

[Gegl.Node]

get_consumers(output_pad)
Parameters:

output_pad (str) – the output pad we want to know who uses.

Returns:

nodes:

optional return location for array of nodes.

pads:

optional return location for array of pad names.

Return type:

(int, nodes: [Gegl.Node], pads: [str])

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 None. If they are non None both should be freed with GLib.free. The arrays are None terminated.

Returns the number of consumers connected to this output_pad.

get_gegl_operation()
Returns:

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

Return type:

Gegl.Operation or None

get_input_proxy(pad_name)
Parameters:

pad_name (str) – 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.

Return type:

Gegl.Node

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

get_operation()
Returns:

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

Return type:

str

get_output_proxy(pad_name)
Parameters:

pad_name (str) – 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.

Return type:

Gegl.Node

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

get_parent()
Returns:

the parent of a node or None.

Return type:

Gegl.Node

Returns a Gegl.Node that keeps a reference on a child.

get_passthrough()
Return type:

bool

get_producer(input_pad_name, output_pad_name)
Parameters:
  • input_pad_name (str) – the input pad we want to get the producer for

  • output_pad_name (str or None) – optional pointer to a location where we can store a freshly allocated string with the name of the output pad.

Returns:

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

Return type:

Gegl.Node

get_property(property_name)
Parameters:

property_name (str) – the name of the property to get

Returns:

pointer to a GObject.Value containing the value of the property

Return type:

GObject.Value

has_pad(pad_name)
Parameters:

pad_name (str) – the pad name we are looking for

Return type:

bool

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

is_graph()
Return type:

bool

Parameters:

sink (Gegl.Node) – the consumer of data.

This is equivalent to Gegl.Node.connect (source, “output”, sink, “input”);

list_input_pads()
Return type:

[str]

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

list_output_pads()
Return type:

[str]

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

new_processor(rectangle)
Parameters:

rectangle (Gegl.Rectangle) – the Gegl.Rectangle to work on or None to work on all available data.

Returns:

a new Gegl.Processor.

Return type:

Gegl.Processor

process()

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 Gegl.Processor in a single blocking function call. If you need a non-blocking operation, then make a direct use of Gegl.Processor.work. See Gegl.Processor.

Gegl.Node *gegl; Gegl.Rectangle roi; Gegl.Node *png_save; unsigned str *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”, None);

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.BlitFlags.DEFAULT);

progress(progress, message)
Parameters:
  • progress (float) –

  • message (str) –

remove_child(child)
Parameters:

child (Gegl.Node) – a Gegl.Node.

Returns:

the child.

Return type:

Gegl.Node

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

set_enum_as_string(key, value)
Parameters:
  • key (str) –

  • value (str) –

set_passthrough(passthrough)
Parameters:

passthrough (bool) –

set_property(property_name, value)
Parameters:
  • property_name (str) – the name of the property to set

  • value (GObject.Value) – a GObject.Value containing the value to be set in the property.

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

set_time(time)
Parameters:

time (float) – the time to set the properties which have keyfraes attached to

Sets the right value in animated properties of this node and all its dependendcies to be the specified time position.

to_xml(path_root)
Parameters:

path_root (str) – filesystem path to construct relative paths from.

Return type:

str

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.

to_xml_full(tail, path_root)
Parameters:
Returns:

XML serialization of a graph segment.

Return type:

str

Returns a freshly allocated \0 terminated string containing a XML serialization of a segment of a graph from self to tail nodes. If tail is None then this behaves just like Gegl.Node.to_xml.

Signal Details

Gegl.Node.signals.computed(node, object)
Signal Name:

computed

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:
Gegl.Node.signals.invalidated(node, object)
Signal Name:

invalidated

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:
Gegl.Node.signals.progress(node, object)
Signal Name:

progress

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:
  • node (Gegl.Node) – The object which received the signal

  • object (float) –

Property Details

Gegl.Node.props.cache_policy
Name:

cache-policy

Type:

Gegl.CachePolicy

Default Value:

Gegl.CachePolicy.AUTO

Flags:

READABLE, WRITABLE, CONSTRUCT

Cache policy for this node, the property is inherited by children created from a node.

Gegl.Node.props.dont_cache
Name:

dont-cache

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Do not cache the result of this operation, the property is inherited by children created from a node. (Deprecated for “cache-policy”.)

Gegl.Node.props.gegl_operation
Name:

gegl-operation

Type:

Gegl.Operation

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The associated Gegl.Operation instance

Gegl.Node.props.name
Name:

name

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, CONSTRUCT

The name of the node

Gegl.Node.props.operation
Name:

operation

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, CONSTRUCT

The type of associated Gegl.Operation

Gegl.Node.props.passthrough
Name:

passthrough

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Act as a nop, passing input unmodifed through to ouput.

Gegl.Node.props.use_opencl
Name:

use-opencl

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Use the OpenCL version of this operation if available, this property is inherited by children created from a node.