Class: Gegl::Node
- Inherits:
-
Object
- Object
- Gegl::Node
- Defined in:
- lib/gegl/node.rb
Instance Method Summary collapse
- #<<(sink) ⇒ Object
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
-
#add_child(child) ⇒ Gegl::Node
Make the GeglNode graph, take a reference on child.
-
#blit(scale, roi, format, destination_buf, rowstride, flags) ⇒ nil
Render a rectangular region from a node.
-
#blit_buffer(buffer, roi, level, abyss_policy) ⇒ nil
Render a rectangular region from a node to the given buffer.
-
#bounding_box ⇒ Gegl::Rectangle
Returns the position and dimensions of a rectangle spanning the area defined by a node.
-
#cache_policy ⇒ Gegl::CachePolicy
Cache-policy.
- #cache_policy=(cache_policy) ⇒ Gegl::CachePolicy
-
#children ⇒ GLib::SList<Gegl::Node>
of the nodes contained within a GeglNode that is a subgraph.
-
#connect(a_pad_name, b, b_pad_name) ⇒ Boolean
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.
-
#connect_from(input_pad_name, source, output_pad_name) ⇒ Boolean
Makes a connection between the pads of two nodes.
-
#connect_to(output_pad_name, sink, input_pad_name) ⇒ Boolean
Makes a connection between the pads of two nodes.
-
#create_child(operation) ⇒ Gegl::Node
Creates a new processing node that performs the specified operation.
-
#detect(x, y) ⇒ Gegl::Node
Performs hit detection by returning the node providing data at a given coordinate pair.
-
#disconnect(input_pad) ⇒ Boolean
Disconnects node connected to input_pad of node (if any).
- #dont_cache=(dont_cache) ⇒ Boolean
-
#dont_cache? ⇒ Boolean
Dont-cache.
-
#find_property(property_name) ⇒ GObject::ParamSpec
if no such property exists.
-
#gegl_operation ⇒ Gegl::Operation
Gegl-operation.
- #gegl_operation=(gegl_operation) ⇒ Gegl::Operation
-
#get(first_property_name, array) ⇒ nil
Gets properties of a Gegl::Node.
-
#get_consumers(output_pad, nodes, pads) ⇒ Integer
Retrieve which pads on which nodes are connected to a named output_pad, and the number of connections.
-
#get_input_proxy(pad_name) ⇒ Gegl::Node
Proxies are used to route between nodes of a subgraph contained within a node.
-
#get_output_proxy(pad_name) ⇒ Gegl::Node
Proxies are used to route between nodes of a subgraph contained within a node.
-
#get_producer(input_pad_name, output_pad_name) ⇒ Gegl::Node
or NULL if no node is connected to the input_pad.
-
#get_property(property_name, value) ⇒ nil
This is mainly included for language bindings.
-
#get_valist(first_property_name, args) ⇒ nil
valist version of #gegl_node_get name/value pairs, followed by NULL.
-
#has_pad(pad_name) ⇒ Boolean
Returns TRUE if the node has a pad with the specified name.
-
#initialize(xmldata, path_root) ⇒ Gegl::Node
constructor
The Gegl::Node returned contains the graph described by the tree of stacks in the XML document.
-
#introspectable_get_bounding_box ⇒ Gegl::Rectangle
Returns the position and dimensions of a rectangle spanning the area defined by a node.
-
#introspectable_get_property(property_name) ⇒ GObject::Value
Pointer to a GValue containing the value of the property.
- #is_graph ⇒ Boolean
-
#link(sink) ⇒ nil
This is equivalent to gegl_node_connect (source, "output", sink, "input");.
-
#link_many(first_sink, array) ⇒ nil
Synthetic sugar for linking a chain of nodes with "output"->"input".
-
#list_input_pads ⇒ Array<String>
If the node has any input pads this function returns a null terminated array of pad names, otherwise it returns NULL.
-
#list_output_pads ⇒ Array<String>
If the node has any output pads this function returns a null terminated array of pad names, otherwise it returns NULL.
-
#name ⇒ String
Name.
- #name=(name) ⇒ String
-
#new_child(first_property_name, array) ⇒ Gegl::Node
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.
-
#new_processor(rectangle) ⇒ Gegl::Processor
data.
-
#operation ⇒ String
Operation.
- #operation=(operation) ⇒ String
-
#parent ⇒ Gegl::Node
Returns a GeglNode that keeps a reference on a child.
- #passthrough ⇒ Boolean
- #passthrough=(passthrough) ⇒ Boolean
-
#passthrough? ⇒ Boolean
Passthrough.
-
#process ⇒ nil
Render a composition.
- #progress(progress, message) ⇒ nil
-
#remove_child(child) ⇒ Gegl::Node
Removes a child from a GeglNode.
-
#set(first_property_name, array) ⇒ nil
Set properties on a node, possible properties to be set are the properties of the currently set operations as well as "name" and "operation".
- #set_enum_as_string(key, value) ⇒ nil
-
#set_property(property_name, value) ⇒ nil
This is mainly included for language bindings.
-
#set_valist(first_property_name, args) ⇒ nil
valist version of #gegl_node_set pairs, followed by NULL.
-
#time=(time) ⇒ nil
Sets the right value in animated properties of this node and all its dependendcies to be the specified time position.
-
#to_xml(path_root) ⇒ String
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_xml_full(tail, path_root) ⇒ String
Returns a freshly allocated \0 terminated string containing a XML serialization of a segment of a graph from head to tail nodes.
- #use_opencl=(use_opencl) ⇒ Boolean
-
#use_opencl? ⇒ Boolean
Use-opencl.
Constructor Details
#initialize(xmldata, path_root) ⇒ 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. resolved in relation to.
Instance Method Details
#<<(sink) ⇒ Object
27 28 29 30 |
# File 'lib/gegl/node.rb', line 27 def <<(sink) self.link(sink) self end |
#[](name) ⇒ Object
19 20 21 |
# File 'lib/gegl/node.rb', line 19 def [](name) get_property(name) end |
#[]=(name, value) ⇒ Object
23 24 25 |
# File 'lib/gegl/node.rb', line 23 def []=(name, value) set_property(name, value) end |
#add_child(child) ⇒ Gegl::Node
Make the GeglNode graph, take a reference on child. This reference will be dropped when the reference count on the graph reaches zero.
#blit(scale, roi, format, destination_buf, rowstride, flags) ⇒ nil
Render a rectangular region from a node. width/height of the sampled region. coordinates after scale has been applied. left as NULL when forcing a rendering of a region. rowstride based on the width and bytes per pixel for the specified format. 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.
#blit_buffer(buffer, roi, level, abyss_policy) ⇒ nil
Render a rectangular region from a node to the given buffer.
#bounding_box ⇒ Gegl::Rectangle
Returns the position and dimensions of a rectangle spanning the area defined by a node.
#cache_policy ⇒ Gegl::CachePolicy
Returns cache-policy.
#cache_policy=(cache_policy) ⇒ Gegl::CachePolicy
#children ⇒ GLib::SList<Gegl::Node>
of the nodes contained within a GeglNode that is a subgraph. Use g_list_free () on the list when done.
#connect(a_pad_name, b, b_pad_name) ⇒ Boolean
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) ⇒ Boolean
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) ⇒ Boolean
Makes a connection between the pads of two nodes.
Returns TRUE if the connection was successfully made.
#create_child(operation) ⇒ 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. 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.)
#detect(x, y) ⇒ 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. data ending up at x,y in the output of node.
#disconnect(input_pad) ⇒ Boolean
Disconnects node connected to input_pad of node (if any).
Returns TRUE if a connection was broken.
#dont_cache=(dont_cache) ⇒ Boolean
#dont_cache? ⇒ Boolean
Returns dont-cache.
#find_property(property_name) ⇒ GObject::ParamSpec
if no such property exists.
#gegl_operation ⇒ Gegl::Operation
Returns gegl-operation.
#gegl_operation=(gegl_operation) ⇒ Gegl::Operation
#get(first_property_name, array) ⇒ nil
Gets properties of a Gegl::Node.
double level; char *path;
gegl_node_get (png_save, "path", &path, NULL); gegl_node_get (threshold, "level", &level, NULL); name/value pairs, followed by NULL.
#get_consumers(output_pad, nodes, pads) ⇒ Integer
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.
#get_input_proxy(pad_name) ⇒ Gegl::Node
Proxies are used to route between nodes of a subgraph contained within a node. If no input proxy exists with this name a new one will be created.
#get_output_proxy(pad_name) ⇒ Gegl::Node
Proxies are used to route between nodes of a subgraph contained within a node. If no output proxy exists with this name a new one will be created.
#get_producer(input_pad_name, output_pad_name) ⇒ Gegl::Node
or NULL if no node is connected to the input_pad.
#get_property(property_name, value) ⇒ nil
This is mainly included for language bindings. Using #gegl_node_get is more convenient when programming in C.
#get_valist(first_property_name, args) ⇒ nil
valist version of #gegl_node_get name/value pairs, followed by NULL.
#has_pad(pad_name) ⇒ Boolean
Returns TRUE if the node has a pad with the specified name
#introspectable_get_bounding_box ⇒ Gegl::Rectangle
Returns the position and dimensions of a rectangle spanning the area defined by a node.
#introspectable_get_property(property_name) ⇒ GObject::Value
Returns pointer to a GValue containing the value of the property.
#is_graph ⇒ Boolean
#link(sink) ⇒ nil
This is equivalent to gegl_node_connect (source, "output", sink, "input");
#link_many(first_sink, array) ⇒ nil
Synthetic sugar for linking a chain of nodes with "output"->"input". The list is NULL terminated.
#list_input_pads ⇒ Array<String>
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().
#list_output_pads ⇒ Array<String>
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().
#name ⇒ String
Returns name.
#name=(name) ⇒ String
#new_child(first_property_name, array) ⇒ Gegl::Node
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. terminated with NULL. 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.)
#new_processor(rectangle) ⇒ Gegl::Processor
data.
#operation ⇒ String
Returns operation.
#operation=(operation) ⇒ String
#parent ⇒ Gegl::Node
Returns a GeglNode that keeps a reference on a child.
#passthrough ⇒ Boolean
#passthrough=(passthrough) ⇒ Boolean
#passthrough? ⇒ Boolean
Returns passthrough.
#process ⇒ nil
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 Gegl::Processor.
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.wroi.h4); gegl_node_blit (gegl, 1.0, &roi, babl_format("R'G'B'A u8"), buffer, GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);
#progress(progress, message) ⇒ nil
#remove_child(child) ⇒ Gegl::Node
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.
#set(first_property_name, array) ⇒ nil
Set properties on a node, possible properties to be set are the properties of the currently set operations as well as "name" and "operation". "operation" changes the current operations set for the node, "name" doesn't have any role internally in GEGL.
gegl_node_set (node, "brightness", -0.2, "contrast", 2.0, NULL); pairs, followed by NULL.
#set_enum_as_string(key, value) ⇒ nil
#set_property(property_name, value) ⇒ nil
This is mainly included for language bindings. Using #gegl_node_set is more convenient when programming in C.
#set_valist(first_property_name, args) ⇒ nil
valist version of #gegl_node_set pairs, followed by NULL.
#time=(time) ⇒ nil
Sets the right value in animated properties of this node and all its dependendcies to be the specified time position.
#to_xml(path_root) ⇒ String
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) ⇒ String
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 nil then this behaves just like #gegl_node_to_xml.
#use_opencl=(use_opencl) ⇒ Boolean
#use_opencl? ⇒ Boolean
Returns use-opencl.