### Class

# Clutter Path

since: 13

#### Description [src]

    class Clutter.Path : GObject.InitiallyUnowned
    {
      /* No available fields */
    }

An object describing a path with straight lines and bezier curves.

A `ClutterPath` contains a description of a path consisting of straight lines and bezier curves.

The path consists of a series of nodes. Each node is one of the following four types:

- `CLUTTER_PATH_MOVE_TO`, changes the position of the path to the given pair of coordinates. This is usually used as the first node of a path to mark the start position. If it is used in the middle of a path then the path will be disjoint and the actor will appear to jump to the new position when animated.
- `CLUTTER_PATH_LINE_TO`, creates a straight line from the previous point to the given point.
- `CLUTTER_PATH_CURVE_TO`, creates a bezier curve. The end of the last node is used as the first control point and the three subsequent coordinates given in the node as used as the other three.
- `CLUTTER_PATH_CLOSE`, creates a straight line from the last node to the last `CLUTTER_PATH_MOVE_TO` node. This can be used to close a path so that it will appear as a loop when animated.

The first three types have the corresponding relative versions `CLUTTER_PATH_REL_MOVE_TO`, `CLUTTER_PATH_REL_LINE_TO` and `CLUTTER_PATH_REL_CURVE_TO`. These are exactly the same except the coordinates are given relative to the previous node instead of as direct screen positions.

You can build a path using the node adding functions such as `clutter_path_add_line_to()`. Alternatively the path can be described in a string using a subset of the SVG path syntax. See `clutter_path_add_string()` for details.

Available since: 13

#### Ancestors

- GInitiallyUnowned
- GObject

#### Constructors

###### clutter_path_new

Creates a new `ClutterPath` instance with no nodes.

since: 13

###### clutter_path_new_with_description

Creates a new `ClutterPath` instance with the nodes described in `desc`. See `clutter_path_add_string()` for details of the format of the string.

since: 13

#### Instance methods

###### clutter_path_add_close

Adds a `CLUTTER_PATH_CLOSE` type node to the path. This creates a straight line from the last node to the last `CLUTTER_PATH_MOVE_TO` type node.

since: 13

###### clutter_path_add_curve_to

Adds a `CLUTTER_PATH_CURVE_TO` type node to the path. This causes the actor to follow a bezier from the last node to (`x_3`, `y_3`) using (`x_1`, `y_1`) and (`x_2`,`y_2`) as control points.

since: 13

###### clutter_path_add_line_to

Adds a `CLUTTER_PATH_LINE_TO` type node to the path. This causes the actor to move to the new coordinates in a straight line.

since: 13

###### clutter_path_add_move_to

Adds a `CLUTTER_PATH_MOVE_TO` type node to the path. This is usually used as the first node in a path. It can also be used in the middle of the path to cause the actor to jump to the new coordinate.

since: 13

###### clutter_path_add_node

Adds `node` to the end of the path.

since: 13

###### clutter_path_add_rel_curve_to

Same as `clutter_path_add_curve_to()` except the coordinates are relative to the previous node.

since: 13

###### clutter_path_add_rel_line_to

Same as `clutter_path_add_line_to()` except the coordinates are relative to the previous node.

since: 13

###### clutter_path_add_rel_move_to

Same as `clutter_path_add_move_to()` except the coordinates are relative to the previous node.

since: 13

###### clutter_path_add_string

Adds new nodes to the end of the path as described in `str`. The format is a subset of the SVG path format. Each node is represented by a letter and is followed by zero, one or three pairs of coordinates. The coordinates can be separated by spaces or a comma. The types are:

since: 13

###### clutter_path_clear

Removes all nodes from the path.

since: 13

###### clutter_path_foreach

Calls a function for each node of the path.

since: 13

###### clutter_path_get_description

Returns a newly allocated string describing the path in the same format as used by `clutter_path_add_string()`.

since: 13

###### clutter_path_get_length

Retrieves an approximation of the total length of the path.

since: 13

###### clutter_path_get_n_nodes

Retrieves the number of nodes in the path.

since: 13

###### clutter_path_get_node

Retrieves the node of the path indexed by `index`.

since: 13

###### clutter_path_get_nodes

Returns a `GSList` of `ClutterPathNode`s.

since: 13

###### clutter_path_get_position

The value in `progress` represents a position along the path where 0.0 is the beginning and 1.0 is the end of the path. An interpolated position is then stored in `position`.

since: 13

###### clutter_path_insert_node

Inserts `node` into the path before the node at the given offset. If `index_` is negative it will append the node to the end of the path.

since: 13

###### clutter_path_remove_node

Removes the node at the given offset from the path.

since: 13

###### clutter_path_replace_node

Replaces the node at offset `index_` with `node`.

since: 13

###### clutter_path_set_description

Replaces all of the nodes in the path with nodes described by `str`. See `clutter_path_add_string()` for details of the format.

since: 13

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Clutter.Path:description

No description available.

since: 13

###### Clutter.Path:length

No description available.

since: 13

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0

#### Class structure

    struct ClutterPathClass {
      /* no available fields */
    }

The `ClutterPathClass` struct contains only private data.