Trait animate::PathExt [−][src]
pub trait PathExt: 'static {}Show methods
fn add_close(&self); fn add_curve_to(
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
); fn add_line_to(&self, x: i32, y: i32); fn add_move_to(&self, x: i32, y: i32); fn add_node(&self, node: &PathNode); fn add_rel_curve_to(
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
); fn add_rel_line_to(&self, x: i32, y: i32); fn add_rel_move_to(&self, x: i32, y: i32); fn add_string(&self, str: &str) -> bool; fn clear(&self); fn foreach<P: FnMut(&PathNode)>(&self, callback: P); fn get_description(&self) -> Option<GString>; fn get_length(&self) -> u32; fn get_n_nodes(&self) -> u32; fn get_node(&self, index_: u32) -> PathNode; fn get_nodes(&self) -> Vec<PathNode>ⓘ; fn get_position(&self, progress: f64) -> (u32, Knot); fn insert_node(&self, index_: i32, node: &PathNode); fn remove_node(&self, index_: u32); fn replace_node(&self, index_: u32, node: &PathNode); fn set_description(&self, str: &str) -> bool; fn connect_property_description_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId; fn connect_property_length_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
Required methods
fn add_close(&self)
[src]
Adds a PathNodeType::Close
type node to the path. This creates a
straight line from the last node to the last PathNodeType::MoveTo
type node.
fn add_curve_to(
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
[src]
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
Adds a PathNodeType::CurveTo
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.
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
fn add_line_to(&self, x: i32, y: i32)
[src]
Adds a PathNodeType::LineTo
type node to the path. This causes the
actor to move to the new coordinates in a straight line.
x
the x coordinate
y
the y coordinate
fn add_move_to(&self, x: i32, y: i32)
[src]
Adds a PathNodeType::MoveTo
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.
x
the x coordinate
y
the y coordinate
fn add_node(&self, node: &PathNode)
[src]
fn add_rel_curve_to(
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
[src]
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
Same as PathExt::add_curve_to
except the coordinates are
relative to the previous node.
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
fn add_rel_line_to(&self, x: i32, y: i32)
[src]
Same as PathExt::add_line_to
except the coordinates are
relative to the previous node.
x
the x coordinate
y
the y coordinate
fn add_rel_move_to(&self, x: i32, y: i32)
[src]
Same as PathExt::add_move_to
except the coordinates are
relative to the previous node.
x
the x coordinate
y
the y coordinate
fn add_string(&self, str: &str) -> bool
[src]
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 aPathNodeType::MoveTo
node. Takes one pair of coordinates.L
: Adds aPathNodeType::LineTo
node. Takes one pair of coordinates.C
: Adds aPathNodeType::CurveTo
node. Takes three pairs of coordinates.z
: Adds aPathNodeType::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.
str
a string describing the new nodes
Returns
true
is the path description was valid or false
otherwise.
fn clear(&self)
[src]
Removes all nodes from the path.
fn foreach<P: FnMut(&PathNode)>(&self, callback: P)
[src]
Calls a function for each node of the path.
callback
the function to call with each node
user_data
user data to pass to the function
fn get_description(&self) -> Option<GString>
[src]
Returns a newly allocated string describing the path in the same
format as used by PathExt::add_string
.
Returns
a string description of the path. Free with g_free
.
fn get_length(&self) -> u32
[src]
fn get_n_nodes(&self) -> u32
[src]
fn get_node(&self, index_: u32) -> PathNode
[src]
Retrieves the node of the path indexed by index
.
index_
the node number to retrieve
node
a location to store a copy of the node
fn get_nodes(&self) -> Vec<PathNode>ⓘ
[src]
Returns a glib::SList
of PathNode
s. The list should be
freed with glib::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.
Returns
a list of nodes in the path.
fn get_position(&self, progress: f64) -> (u32, Knot)
[src]
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
.
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.
fn insert_node(&self, index_: i32, node: &PathNode)
[src]
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.
index_
offset of where to insert the node
node
the node to insert
fn remove_node(&self, index_: u32)
[src]
fn replace_node(&self, index_: u32, node: &PathNode)
[src]
Replaces the node at offset index_
with node
.
index_
index to the existing node
node
the replacement node
fn set_description(&self, str: &str) -> bool
[src]
Replaces all of the nodes in the path with nodes described by
str
. See PathExt::add_string
for details of the format.
If the string is invalid then false
is returned and the path is
unaltered.
str
a string describing the path
Returns
true
is the path was valid, false
otherwise.
fn connect_property_description_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_length_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
Implementors
impl<O: IsA<Path>> PathExt for O
[src]
impl<O: IsA<Path>> PathExt for O
[src]fn add_close(&self)
[src]
fn add_curve_to(
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
[src]
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
fn add_line_to(&self, x: i32, y: i32)
[src]
fn add_move_to(&self, x: i32, y: i32)
[src]
fn add_node(&self, node: &PathNode)
[src]
fn add_rel_curve_to(
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
[src]
&self,
x_1: i32,
y_1: i32,
x_2: i32,
y_2: i32,
x_3: i32,
y_3: i32
)
fn add_rel_line_to(&self, x: i32, y: i32)
[src]
fn add_rel_move_to(&self, x: i32, y: i32)
[src]
fn add_string(&self, str: &str) -> bool
[src]
fn clear(&self)
[src]
fn foreach<P: FnMut(&PathNode)>(&self, callback: P)
[src]
fn get_description(&self) -> Option<GString>
[src]
fn get_length(&self) -> u32
[src]
fn get_n_nodes(&self) -> u32
[src]
fn get_node(&self, index_: u32) -> PathNode
[src]
fn get_nodes(&self) -> Vec<PathNode>ⓘ
[src]
fn get_position(&self, progress: f64) -> (u32, Knot)
[src]
fn insert_node(&self, index_: i32, node: &PathNode)
[src]
fn remove_node(&self, index_: u32)
[src]
fn replace_node(&self, index_: u32, node: &PathNode)
[src]
fn set_description(&self, str: &str) -> bool
[src]
fn connect_property_description_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_length_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId