# Clutter::Path Class Reference

Inherits Glib::Object.

Collaboration diagram for Clutter::Path:
[legend]

List of all members.

## Classes

class | Nodes

## Public Types

typedef void(* | ClutterPathCallback )(const ClutterPathNode* node, gpointer data)
typedef sigc::slot< void, PathNode > | ForEachSlot
| For instance, void on_path_foreach(const Clutter::PathNode& node);.

## Public Member Functions

virtual | ~Path ()
ClutterPath* | gobj ()
| Provides access to the underlying C GObject.
const ClutterPath* | gobj () const
| Provides access to the underlying C GObject.
ClutterPath* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Nodes | nodes ()
const Nodes | nodes () const
void | add_move_to (int x, int y)
| Adds a Clutter::PATH_MOVE_TO type node to the path.
void | add_rel_move_to (int x, int y)
| Same as add_move_to() except the coordinates are relative to the previous node.
void | add_line_to (int x, int y)
| Adds a Clutter::PATH_LINE_TO type node to the path.
void | add_rel_line_to (int x, int y)
| Same as add_line_to() except the coordinates are relative to the previous node.
void | add_curve_to (int x1, int y1, int x2, int y2, int x3, int y3)
| Adds a Clutter::PATH_CURVE_TO type node to the path.
void | add_rel_curve_to (int x1, int y1, int x2, int y2, int x3, int y3)
| Same as add_curve_to() except the coordinates are relative to the previous node.
void | add_close ()
| Adds a Clutter::PATH_CLOSE type node to the path.
bool | add_string (const Glib::ustring& str)
| Adds new nodes to the end of the path as described in str.
void | foreach (const ForEachSlot& slot)
Glib::ustring | get_description () const
| Returns a newly allocated string describing the path in the same format as used by add_string().
void | set_description (const Glib::ustring& str)
| Replaces all of the nodes in the path with nodes described by str.
void | add_cairo_path (const Glib::RefPtr< Cairo::Path >& path)
| Add the nodes of the Cairo path to the end of path.
void | to_cairo_path (Glib::RefPtr< Cairo::Context >& context) const
| Add the nodes of the ClutterPath to the path in the Cairo context.
void | clear ()
| Removes all nodes from the path.
guint | get_position (double progress, Knot& 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.
guint | get_length () const
| Retrieves an approximation of the total length of the path.
Glib::PropertyProxy < Glib::ustring > | property_description ()
| SVG-style description of the path.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_description () const
| SVG-style description of the path.
Glib::PropertyProxy_ReadOnly < guint > | property_length () const
| An approximation of the total length of the path.

## Static Public Member Functions

static Glib::RefPtr< Path > | create ()
static Glib::RefPtr< Path > | create (const Glib::ustring& description)

## Protected Member Functions

| Path ()
| Path (const Glib::ustring& description)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Clutter::Path > | wrap (ClutterPath* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Member Typedef Documentation

typedef void(* Clutter::Path::ClutterPathCallback)(const ClutterPathNode* node, gpointer data)

typedef sigc::slot<void, PathNode> Clutter::Path::ForEachSlot

For instance, void on_path_foreach(const Clutter::PathNode& node);.

## Constructor & Destructor Documentation

virtual Clutter::Path::~Path | ( |  | ) | `[virtual]`

Clutter::Path::Path | ( |  | ) | `[protected]`

Clutter::Path::Path | ( | const Glib::ustring & | description | ) | `[explicit, protected]`

## Member Function Documentation

void Clutter::Path::add_cairo_path | ( | const Glib::RefPtr< Cairo::Path > & | path | ) |

Add the nodes of the Cairo path to the end of path.

Since cluttermm 1.0:

Parameters:

  | cpath | A Cairo path.

void 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 cluttermm 1.0:

void Clutter::Path::add_curve_to | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | int | x3,
|  | int | y3 |
| ) |  |  |

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 cluttermm 1.0:

Parameters:

  | x_1 | The x coordinate of the first control point.
  | y_1 | The y coordinate of the first control point.
  | x_2 | The x coordinate of the second control point.
  | y_2 | The y coordinate of the second control point.
  | x_3 | The x coordinate of the third control point.
  | y_3 | The y coordinate of the third control point.

void Clutter::Path::add_line_to | ( | int | x,
|  | int | y |
| ) |  |  |

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 cluttermm 1.0:

Parameters:

  | x | The x coordinate.
  | y | The y coordinate.

void Clutter::Path::add_move_to | ( | int | x,
|  | int | y |
| ) |  |  |

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 cluttermm 1.0:

Parameters:

  | x | The x coordinate.
  | y | The y coordinate.

void Clutter::Path::add_rel_curve_to | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2,
|  | int | x3,
|  | int | y3 |
| ) |  |  |

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

Since cluttermm 1.0:

Parameters:

  | x_1 | The x coordinate of the first control point.
  | y_1 | The y coordinate of the first control point.
  | x_2 | The x coordinate of the second control point.
  | y_2 | The y coordinate of the second control point.
  | x_3 | The x coordinate of the third control point.
  | y_3 | The y coordinate of the third control point.

void Clutter::Path::add_rel_line_to | ( | int | x,
|  | int | y |
| ) |  |  |

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

Since cluttermm 1.0:

Parameters:

  | x | The x coordinate.
  | y | The y coordinate.

void Clutter::Path::add_rel_move_to | ( | int | x,
|  | int | y |
| ) |  |  |

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

Since cluttermm 1.0:

Parameters:

  | x | The x coordinate.
  | y | The y coordinate.

bool Clutter::Path::add_string | ( | const Glib::ustring & | str | ) |

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:

<variablelist> <varlistentry>M <listitem>

Adds a Clutter::PATH_MOVE_TO node. Takes one pair of coordinates.

</listitem></varlistentry> <varlistentry>L <listitem>

Adds a Clutter::PATH_LINE_TO node. Takes one pair of coordinates.

</listitem></varlistentry> <varlistentry>C <listitem>

Adds a Clutter::PATH_CURVE_TO node. Takes three pairs of coordinates.

</listitem></varlistentry> <varlistentry>z <listitem>

Adds a Clutter::PATH_CLOSE node. No coordinates are needed.

</listitem></varlistentry> </variablelist>

The M, L and C commands can also be specified in lower case which means the coordinates are relative to the previous node.

For example, to move an actor in a 100 by 100 pixel square centered on the point 300,300 you could use the following path:

<informalexample> <programlisting> M 250,350 l 0 -100 L 350,250 l 0 100 z </programlisting> </informalexample>

If the path description isn't valid `false` will be returned and no nodes will be added.

Since cluttermm 1.0:

Parameters:

  | str | A string describing the new nodes.

Returns:
  `true` is the path description was valid or `false` otherwise.

void Clutter::Path::clear | ( |  | ) |

Removes all nodes from the path.

Since cluttermm 1.0:

static Glib::RefPtr<Path> Clutter::Path::create | ( | const Glib::ustring & | description | ) | `[static]`

static Glib::RefPtr<Path> Clutter::Path::create | ( |  | ) | `[static]`

void Clutter::Path::foreach | ( | const ForEachSlot & | slot | ) |

Glib::ustring Clutter::Path::get_description | ( |  | ) | const

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

Since cluttermm 1.0:

Returns:
  A string description of the path. Free with Glib::free().

guint Clutter::Path::get_length | ( |  | ) | const

Retrieves an approximation of the total length of the path.

Since cluttermm 1.0:

Returns:
  The length of the path.

guint Clutter::Path::get_position | ( | double | progress,
|  | Knot& | 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 cluttermm 1.0:

Parameters:

  | progress | A position along the path as a fraction of its length.
  | position | Location to store the position.

Returns:
  Index of the node used to calculate the position.

const ClutterPath* Clutter::Path::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

ClutterPath* Clutter::Path::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

ClutterPath* Clutter::Path::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

const Nodes Clutter::Path::nodes | ( |  | ) | const`[inline]`

Nodes Clutter::Path::nodes | ( |  | ) | `[inline]`

Glib::PropertyProxy_ReadOnly<Glib::ustring> Clutter::Path::property_description | ( |  | ) | const

SVG-style description of the path.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Clutter::Path::property_description | ( |  | ) |

SVG-style description of the path.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Clutter::Path::property_length | ( |  | ) | const

An approximation of the total length of the path.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Clutter::Path::set_description | ( | const Glib::ustring & | str | ) |

Replaces all of the nodes in the path with nodes described by str.

See add_string() for details of the format.

If the string is invalid then `false` is returned and the path is unaltered.

Since cluttermm 1.0:

Parameters:

  | str | A string describing the path.

Returns:
  `true` is the path was valid, `false` otherwise.

void Clutter::Path::to_cairo_path | ( | Glib::RefPtr< Cairo::Context > & | context | ) | const

Add the nodes of the ClutterPath to the path in the Cairo context.

Since cluttermm 1.0:

Parameters:

  | cr | A Cairo context.

## Friends And Related Function Documentation

Glib::RefPtr< Clutter::Path > wrap | ( | ClutterPath * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- cluttermm/path.h