Class: Clutter::Path
- Inherits:
-
GObject::InitiallyUnowned
- Object
- GObject::InitiallyUnowned
- Clutter::Path
- Defined in:
- (unknown)
Overview
The Clutter::PathClass struct contains only private data.
Instance Method Summary collapse
-
#add_cairo_path(cpath) ⇒ nil
Add the nodes of the Cairo path to the end of path.
-
#add_close ⇒ nil
Adds a %CLUTTER_PATH_CLOSE type node to the path.
-
#add_curve_to(x_1, y_1, x_2, y_2, x_3, y_3) ⇒ nil
Adds a %CLUTTER_PATH_CURVE_TO type node to the path.
-
#add_line_to(x, y) ⇒ nil
Adds a %CLUTTER_PATH_LINE_TO type node to the path.
-
#add_move_to(x, y) ⇒ nil
Adds a %CLUTTER_PATH_MOVE_TO type node to the path.
-
#add_node(node) ⇒ nil
Adds node to the end of the path.
-
#add_rel_curve_to(x_1, y_1, x_2, y_2, x_3, y_3) ⇒ nil
Same as clutter_path_add_curve_to() except the coordinates are relative to the previous node.
-
#add_rel_line_to(x, y) ⇒ nil
Same as clutter_path_add_line_to() except the coordinates are relative to the previous node.
-
#add_rel_move_to(x, y) ⇒ nil
Same as clutter_path_add_move_to() except the coordinates are relative to the previous node.
-
#add_string(str) ⇒ Boolean
Adds new nodes to the end of the path as described in str.
-
#clear ⇒ nil
Removes all nodes from the path.
-
#description ⇒ String
Description.
- #description=(description) ⇒ String
-
#foreach(callback, user_data) ⇒ nil
Calls a function for each node of the path.
-
#get_node(index_, node) ⇒ nil
Retrieves the node of the path indexed by index.
-
#get_position(progress, position) ⇒ Integer
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.
-
#initialize(desc) ⇒ Clutter::Path
constructor
Creates a new Clutter::Path instance with the nodes described in desc.
-
#insert_node(index_, node) ⇒ nil
Inserts node into the path before the node at the given offset.
-
#length ⇒ Integer
Length.
- #length=(length) ⇒ Integer
-
#n_nodes ⇒ Integer
Retrieves the number of nodes in the path.
-
#nodes ⇒ GLib::SList<Clutter::PathNode>
Returns a #GSList of Clutter::PathNodes.
-
#remove_node(index_) ⇒ nil
Removes the node at the given offset from the path.
-
#replace_node(index_, node) ⇒ nil
Replaces the node at offset index_ with node.
-
#to_cairo_path(cr) ⇒ nil
Add the nodes of the ClutterPath to the path in the Cairo context.
Constructor Details
#initialize(desc) ⇒ Clutter::Path
Creates a new Clutter::Path instance with the nodes described in desc. See clutter_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.
Instance Method Details
#add_cairo_path(cpath) ⇒ nil
Add the nodes of the Cairo path to the end of path.
#add_close ⇒ nil
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.
#add_curve_to(x_1, y_1, x_2, y_2, x_3, y_3) ⇒ nil
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.
#add_line_to(x, y) ⇒ nil
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.
#add_move_to(x, y) ⇒ nil
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.
#add_node(node) ⇒ nil
Adds node to the end of the path.
#add_rel_curve_to(x_1, y_1, x_2, y_2, x_3, y_3) ⇒ nil
Same as clutter_path_add_curve_to() except the coordinates are relative to the previous node.
#add_rel_line_to(x, y) ⇒ nil
Same as clutter_path_add_line_to() except the coordinates are relative to the previous node.
#add_rel_move_to(x, y) ⇒ nil
Same as clutter_path_add_move_to() except the coordinates are relative to the previous node.
#add_string(str) ⇒ Boolean
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 a %CLUTTER_PATH_MOVE_TO node. Takes one pair of coordinates.L: Adds a %CLUTTER_PATH_LINE_TO node. Takes one pair of coordinates.C: Adds a %CLUTTER_PATH_CURVE_TO node. Takes three pairs of coordinates.z: Adds a %CLUTTER_PATH_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. otherwise.
#clear ⇒ nil
Removes all nodes from the path.
#description ⇒ String
Returns description.
#description=(description) ⇒ String
#foreach(callback, user_data) ⇒ nil
Calls a function for each node of the path.
#get_node(index_, node) ⇒ nil
Retrieves the node of the path indexed by index.
#get_position(progress, position) ⇒ Integer
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.
#insert_node(index_, node) ⇒ nil
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.
#length ⇒ Integer
Returns length.
#length=(length) ⇒ Integer
#n_nodes ⇒ Integer
Retrieves the number of nodes in the path.
#nodes ⇒ GLib::SList<Clutter::PathNode>
Returns a #GSList of Clutter::PathNodes. 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.
#remove_node(index_) ⇒ nil
Removes the node at the given offset from the path.
#replace_node(index_, node) ⇒ nil
Replaces the node at offset index_ with node.
#to_cairo_path(cr) ⇒ nil
Add the nodes of the ClutterPath to the path in the Cairo context.