Clutter.Path¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
SVG-style description of the path |
||
r |
An approximation of the total length of the path. |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Clutter.Path(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Clutter.Path
struct contains only private data and should be accessed with the functions below.New in version 1.0.
- classmethod new()¶
- Returns:
the newly created
Clutter.Path
- Return type:
Creates a new
Clutter.Path
instance with no nodes.The object has a floating reference so if you add it to a
Clutter.BehaviourPath
then you do not need to unref it.New in version 1.0.
- classmethod new_with_description(desc)¶
- Parameters:
desc (
str
) – a string describing the path- Returns:
the newly created
Clutter.Path
- Return type:
Creates a new
Clutter.Path
instance with the nodes described in desc. SeeClutter.Path.add_string
() for details of the format of the string.The object has a floating reference so if you add it to a
Clutter.BehaviourPath
then you do not need to unref it.New in version 1.0.
- add_cairo_path(cpath)¶
- Parameters:
cpath (
cairo.Path
) – a Cairo path
Add the nodes of the Cairo path to the end of self.
New in version 1.0.
- add_close()¶
Adds a
Clutter.PathNodeType.CLOSE
type node to the path. This creates a straight line from the last node to the lastClutter.PathNodeType.MOVE_TO
type node.New in version 1.0.
- add_curve_to(x_1, y_1, x_2, y_2, x_3, y_3)¶
- Parameters:
x_1 (
int
) – the x coordinate of the first control pointy_1 (
int
) – the y coordinate of the first control pointx_2 (
int
) – the x coordinate of the second control pointy_2 (
int
) – the y coordinate of the second control pointx_3 (
int
) – the x coordinate of the third control pointy_3 (
int
) – the y coordinate of the third control point
Adds a
Clutter.PathNodeType.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.New in version 1.0.
- add_line_to(x, y)¶
-
Adds a
Clutter.PathNodeType.LINE_TO
type node to the path. This causes the actor to move to the new coordinates in a straight line.New in version 1.0.
- add_move_to(x, y)¶
-
Adds a
Clutter.PathNodeType.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.New in version 1.0.
- add_node(node)¶
- Parameters:
node (
Clutter.PathNode
) – aClutter.PathNode
Adds node to the end of the path.
New in version 1.0.
- add_rel_curve_to(x_1, y_1, x_2, y_2, x_3, y_3)¶
- Parameters:
x_1 (
int
) – the x coordinate of the first control pointy_1 (
int
) – the y coordinate of the first control pointx_2 (
int
) – the x coordinate of the second control pointy_2 (
int
) – the y coordinate of the second control pointx_3 (
int
) – the x coordinate of the third control pointy_3 (
int
) – the y coordinate of the third control point
Same as
Clutter.Path.add_curve_to
() except the coordinates are relative to the previous node.New in version 1.0.
- add_rel_line_to(x, y)¶
-
Same as
Clutter.Path.add_line_to
() except the coordinates are relative to the previous node.New in version 1.0.
- add_rel_move_to(x, y)¶
-
Same as
Clutter.Path.add_move_to
() except the coordinates are relative to the previous node.New in version 1.0.
- add_string(str)¶
- Parameters:
str (
str
) – a string describing the new nodes- Returns:
- Return type:
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:
M
: Adds aClutter.PathNodeType.MOVE_TO
node. Takes one pair of coordinates.L
: Adds aClutter.PathNodeType.LINE_TO
node. Takes one pair of coordinates.C
: Adds aClutter.PathNodeType.CURVE_TO
node. Takes three pairs of coordinates.z
: Adds aClutter.PathNodeType.CLOSE
node. No coordinates are needed.
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:
M 250,350 l 0 -100 L 350,250 l 0 100 z
If the path description isn’t valid
False
will be returned and no nodes will be added.New in version 1.0.
- clear()¶
Removes all nodes from the path.
New in version 1.0.
- foreach(callback, *user_data)¶
- Parameters:
callback (
Clutter.PathCallback
) – the function to call with each nodeuser_data (
object
orNone
) – user data to pass to the function
Calls a function for each node of the path.
New in version 1.0.
- get_description()¶
-
Returns a newly allocated string describing the path in the same format as used by
Clutter.Path.add_string
().New in version 1.0.
- get_length()¶
- Returns:
the length of the path.
- Return type:
Retrieves an approximation of the total length of the path.
New in version 1.0.
- get_n_nodes()¶
- Returns:
the number of nodes.
- Return type:
Retrieves the number of nodes in the path.
New in version 1.0.
- get_node(index_)¶
- Parameters:
index (
int
) – the node number to retrieve- Returns:
a location to store a copy of the node
- Return type:
node:
Clutter.PathNode
Retrieves the node of the path indexed by index.
New in version 1.0.
- get_nodes()¶
- Returns:
a list of nodes in the path.
- Return type:
Returns a
GLib.SList
ofClutter.PathNode
s. The list should be freed with g_slist_free(). The nodes are owned by the path and should not be freed. Altering the path may cause the nodes in the list to become invalid so you should copy them if you want to keep the list.New in version 1.0.
- get_position(progress)¶
- Parameters:
progress (
float
) – a position along the path as a fraction of its length- Returns:
index of the node used to calculate the position.
- position:
location to store the position
- Return type:
(
int
, position:Clutter.Knot
)
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.
New in version 1.0.
- insert_node(index_, node)¶
- Parameters:
index (
int
) – offset of where to insert the nodenode (
Clutter.PathNode
) – the node to insert
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.
New in version 1.0.
- remove_node(index_)¶
- Parameters:
index (
int
) – index of the node to remove
Removes the node at the given offset from the path.
New in version 1.0.
- replace_node(index_, node)¶
- Parameters:
index (
int
) – index to the existing nodenode (
Clutter.PathNode
) – the replacement node
Replaces the node at offset index_ with node.
New in version 1.0.
- set_description(str)¶
- Parameters:
str (
str
) – a string describing the path- Returns:
- Return type:
Replaces all of the nodes in the path with nodes described by str. See
Clutter.Path.add_string
() for details of the format.If the string is invalid then
False
is returned and the path is unaltered.New in version 1.0.
- to_cairo_path(cr)¶
- Parameters:
cr (
cairo.Context
) – a Cairo context
Add the nodes of the
Clutter.Path
to the path in the Cairo context.New in version 1.0.
Property Details¶
- Clutter.Path.props.description¶
-
SVG-style description of the path