Class: Gegl::Path
- Inherits:
-
Object
- Object
- Gegl::Path
- Defined in:
- (unknown)
Class Method Summary collapse
-
.add_flattener(func) ⇒ nil
Add a new flattener, the flattener should produce a type of path that GeglPath already understands, if the flattener is unable to flatten the incoming path (doesn't understand the instructions), the original path should be returned.
-
.add_type(type, items, description) ⇒ nil
Adds a new type to the path system, FIXME this should probably return something on registration conflicts, for now it expects all registered paths to be aware of each other.
Instance Method Summary collapse
-
#append(array) ⇒ nil
Use as follows: gegl_path_append (path, 'M', 0.0, 0.0); and gegl_path_append (path, 'C', 10.0, 10.0, 50.0, 10.0, 60.0, 0.0) the number of arguments are determined from the instruction provided.
-
#calc(pos, x, y) ⇒ Boolean
Compute the coordinates of the path at the position (length measured from start of path, not including discontinuities).
-
#calc_values(num_samples, xs, ys) ⇒ nil
Compute num_samples for a path into the provided arrays xs and ys the returned values include the start and end positions of the path.
-
#calc_y_for_x(x, y) ⇒ Integer
Compute a corresponding y coordinate for a given x input coordinate, returns 0 if computed correctly and -1 if the path doesn't exist for the specified x coordinate.
-
#clear ⇒ nil
Remove all nods from a path.
-
#closest_point(x, y, on_path_x, on_path_y, node_pos_before) ⇒ Float
Figure out what and where on a path is closest to arbitrary coordinates.
-
#dirty ⇒ nil
Marks the path as dirty and issues an invalidation for the path rendering, use this if modifying the values of a GeglPathPoint inline.
-
#flat_path ⇒ Gegl::PathList
Return a polyline version of path.
-
#foreach(each_item, user_data) ⇒ nil
Execute a provided function for every node in the path (useful for drawing and otherwise traversing a path.).
-
#foreach_flat(each_item, user_data) ⇒ nil
Execute a provided function for the segments of a poly line approximating the path.
-
#freeze ⇒ nil
Make the GeglPath stop firing signals as it changes must be paired with a gegl_path_thaw() for the signals to start again.
-
#get_bounds(min_x, max_x, min_y, max_y) ⇒ nil
Compute the bounding box of a path.
-
#get_matrix(matrix) ⇒ nil
Get the transformation matrix of the path.
-
#get_node(index, node) ⇒ Boolean
Retrieve the node of the path at position pos.
-
#initialize(instructions) ⇒ Gegl::Path
constructor
Creates a new Gegl::Path with the nodes described in the string instructions.
-
#insert_node(pos, node) ⇒ nil
Insert the new node node at position pos in path.
-
#is_empty ⇒ Boolean
Check if the path contains any nodes.
-
#length ⇒ Float
Returns the total length of the path.
-
#matrix=(matrix) ⇒ nil
Set the transformation matrix of the path.
-
#n_nodes ⇒ Integer
Retrieves the number of nodes in the path.
-
#parse_string(instructions) ⇒ nil
Parses instructions and appends corresponding nodes to path (call gegl_path_clean() first if you want to replace the existing path..
-
#path ⇒ Gegl::PathList
Return the internal untouched Gegl::PathList.
-
#remove_node(pos) ⇒ nil
Removes the node number pos in path.
-
#replace_node(pos, node) ⇒ nil
Replaces the exiting node at position pos in path.
-
#thaw ⇒ nil
Restart firing signals (unless the path has been frozen multiple times).
-
#to_string ⇒ String
Serialize the paths nodes to a string.
Constructor Details
#initialize(instructions) ⇒ Gegl::Path
Creates a new Gegl::Path with the nodes described in the string instructions. See gegl_path_parse_string() for details of the format of the string.
Returns the newly created Gegl::Path
Class Method Details
.add_flattener(func) ⇒ nil
Add a new flattener, the flattener should produce a type of path that GeglPath already understands, if the flattener is unable to flatten the incoming path (doesn't understand the instructions), the original path should be returned.
.add_type(type, items, description) ⇒ nil
Adds a new type to the path system, FIXME this should probably return something on registration conflicts, for now it expects all registered paths to be aware of each other.
Instance Method Details
#append(array) ⇒ nil
Use as follows: gegl_path_append (path, 'M', 0.0, 0.0); and gegl_path_append (path, 'C', 10.0, 10.0, 50.0, 10.0, 60.0, 0.0) the number of arguments are determined from the instruction provided.
#calc(pos, x, y) ⇒ Boolean
Compute the coordinates of the path at the position (length measured from start of path, not including discontinuities).
#calc_values(num_samples, xs, ys) ⇒ nil
Compute num_samples for a path into the provided arrays xs and ys the returned values include the start and end positions of the path.
#calc_y_for_x(x, y) ⇒ Integer
Compute a corresponding y coordinate for a given x input coordinate, returns 0 if computed correctly and -1 if the path doesn't exist for the specified x coordinate.
#clear ⇒ nil
Remove all nods from a path.
#closest_point(x, y, on_path_x, on_path_y, node_pos_before) ⇒ Float
Figure out what and where on a path is closest to arbitrary coordinates.
Returns the length along the path where the closest point was encountered. was deemed the closest coordinate.
#dirty ⇒ nil
Marks the path as dirty and issues an invalidation for the path rendering, use this if modifying the values of a GeglPathPoint inline.
#flat_path ⇒ Gegl::PathList
Return a polyline version of path
#foreach(each_item, user_data) ⇒ nil
Execute a provided function for every node in the path (useful for drawing and otherwise traversing a path.)
#foreach_flat(each_item, user_data) ⇒ nil
Execute a provided function for the segments of a poly line approximating the path.
#freeze ⇒ nil
Make the GeglPath stop firing signals as it changes must be paired with a gegl_path_thaw() for the signals to start again.
#get_bounds(min_x, max_x, min_y, max_y) ⇒ nil
Compute the bounding box of a path.
#get_matrix(matrix) ⇒ nil
Get the transformation matrix of the path.
#get_node(index, node) ⇒ Boolean
Retrieve the node of the path at position pos.
Returns TRUE if the node was successfully retrieved.
#insert_node(pos, node) ⇒ nil
Insert the new node node at position pos in path. if pos = -1, the node is added in the last position.
#is_empty ⇒ Boolean
Check if the path contains any nodes.
Returns TRUE if the path has no nodes.
#length ⇒ Float
Returns the total length of the path.
#matrix=(matrix) ⇒ nil
Set the transformation matrix of the path.
The path is transformed through this matrix when being evaluated, causing the calculated positions and length to be changed by the transform.
#n_nodes ⇒ Integer
Retrieves the number of nodes in the path.
#parse_string(instructions) ⇒ nil
Parses instructions and appends corresponding nodes to path (call gegl_path_clean() first if you want to replace the existing path.
#path ⇒ Gegl::PathList
Return the internal untouched Gegl::PathList
#remove_node(pos) ⇒ nil
Removes the node number pos in path.
#replace_node(pos, node) ⇒ nil
Replaces the exiting node at position pos in path.
#thaw ⇒ nil
Restart firing signals (unless the path has been frozen multiple times).
#to_string ⇒ String
Serialize the paths nodes to a string. need to free this with g_free().