Gegl.Path

g GObject.Object GObject.Object Gegl.Path Gegl.Path GObject.Object->Gegl.Path

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

add_type (type, items, description)

class

new ()

class

new_from_string (instructions)

calc (pos)

calc_y_for_x (x)

clear ()

closest_point (x, y)

dirty ()

foreach (each_item, *user_data)

foreach_flat (each_item, *user_data)

freeze ()

get_bounds ()

get_length ()

get_matrix ()

get_n_nodes ()

get_node (index)

insert_node (pos, node)

is_empty ()

parse_string (instructions)

remove_node (pos)

replace_node (pos, node)

set_matrix (matrix)

thaw ()

to_string ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Gegl.Path(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gegl.PathClass

classmethod add_type(type, items, description)
Parameters:
  • type (int) – a str to recognize in path descriptions.

  • items (int) – the number of floating point data items the instruction takes

  • description (str) – a human readable description of this entry

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.

classmethod new()
Return type:

Gegl.Path

Creates a new Gegl.Path with no nodes.

Returns the newly created Gegl.Path

classmethod new_from_string(instructions)
Parameters:

instructions (str) – a string describing the path.

Return type:

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

calc(pos)
Parameters:

pos (float) – how far along the path.

Returns:

x:

return location for x coordinate.

y:

return location for y coordinate

Return type:

(bool, x: float, y: float)

Compute the coordinates of the path at the position (length measured from start of path, not including discontinuities).

calc_y_for_x(x)
Parameters:

x (float) – x coordinate to compute for

Returns:

y:

return location for y coordinate

Return type:

(int, y: float)

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()

Remove all nods from a self.

closest_point(x, y)
Parameters:
  • x (float) – x coordinate.

  • y (float) – y coordinate

Returns:

on_path_x:

return location for x coordinate on the path that was closest

on_path_y:

return location for y coordinate on the path that was closest

node_pos_before:

the node position interpreted before this position was deemed the closest coordinate.

Return type:

(float, on_path_x: float, on_path_y: float, node_pos_before: int)

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.

dirty()

Marks the path as dirty and issues an invalidation for the path rendering, use this if modifying the values of a Gegl.PathPoint inline.

foreach(each_item, *user_data)
Parameters:

Execute a provided function for every node in the path (useful for drawing and otherwise traversing a path.)

foreach_flat(each_item, *user_data)
Parameters:
  • each_item (Gegl.NodeFunction) – a function to call for each node in the path.

  • user_data (object or None) – user data to pass to a node.

Execute a provided function for the segments of a poly line approximating the path.

freeze()

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()
Returns:

min_x:

return location for minimum x coordinate

max_x:

return location for maximum x coordinate

min_y:

return location for minimum y coordinate

max_y:

return location for maximum y coordinate

Return type:

(min_x: float, max_x: float, min_y: float, max_y: float)

Compute the bounding box of a path.

get_length()
Returns:

the length of the path.

Return type:

float

Returns the total length of the path.

get_matrix()
Returns:

a Gegl.Matrix3 to copy the matrix into

Return type:

matrix: Gegl.Matrix3

Get the transformation matrix of the path.

get_n_nodes()
Returns:

the number of nodes in the path.

Return type:

int

Retrieves the number of nodes in the path.

get_node(index)
Parameters:

index (int) – the node number to retrieve

Returns:

node:

a pointer to a Gegl.PathItem record to be written.

Return type:

(bool, node: Gegl.PathItem)

Retrieve the node of the path at position pos.

Returns True if the node was successfully retrieved.

insert_node(pos, node)
Parameters:
  • pos (int) – the position we want the new node to have.

  • node (Gegl.PathItem) – pointer to a structure describing the Gegl.PathItem we want to store

Insert the new node node at position pos in self. if pos = -1, the node is added in the last position.

is_empty()
Return type:

bool

Check if the path contains any nodes.

Returns True if the path has no nodes.

parse_string(instructions)
Parameters:

instructions (str) – a string describing a path.

Parses instructions and appends corresponding nodes to path (call gegl_path_clean() first if you want to replace the existing path.

remove_node(pos)
Parameters:

pos (int) – a node in the path.

Removes the node number pos in self.

replace_node(pos, node)
Parameters:
  • pos (int) – the position we want the new node to have.

  • node (Gegl.PathItem) – pointer to a structure describing the Gegl.PathItem we want to store.

Replaces the exiting node at position pos in self.

set_matrix(matrix)
Parameters:

matrix (Gegl.Matrix3) – a Gegl.Matrix3 to copy the matrix from

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.

thaw()

Restart firing signals (unless the path has been frozen multiple times).

to_string()
Returns:

return a string with instructions describing the string you need to free this with GLib.free().

Return type:

str

Serialize the paths nodes to a string.

Signal Details

Gegl.Path.signals.changed(path, object)
Signal Name:

changed

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters: