Top | ![]() |
![]() |
![]() |
![]() |
GeglPath *
gegl_path_new (void
);
Creates a new GeglPath with no nodes.
Returns the newly created GeglPath
GeglPath *
gegl_path_new_from_string (const gchar *instructions
);
Creates a new GeglPath with the nodes described in the string
instructions
. See gegl_path_parse_string()
for details of the
format of the string.
Returns the newly created GeglPath
gboolean
gegl_path_is_empty (GeglPath *path
);
Check if the path contains any nodes.
Returns TRUE if the path has no nodes.
gint
gegl_path_get_n_nodes (GeglPath *path
);
Retrieves the number of nodes in the path.
gdouble
gegl_path_get_length (GeglPath *path
);
Returns the total length of the path.
gboolean gegl_path_get_node (GeglPath *path
,gint index
,GeglPathItem *node
);
Retrieve the node of the path at position pos
.
Returns TRUE if the node was successfully retrieved.
gchar *
gegl_path_to_string (GeglPath *path
);
Serialize the paths nodes to a string.
return a string with instructions describing the string you
need to free this with g_free()
.
void gegl_path_set_matrix (GeglPath *path
,GeglMatrix3 *matrix
);
Set the transformation matrix of the path.
The path is transformed through this matrix when being evaluated, causing the calculated positions and length to be changed by the transform.
void gegl_path_get_matrix (GeglPath *path
,GeglMatrix3 *matrix
);
Get the transformation matrix of the path.
gdouble gegl_path_closest_point (GeglPath *path
,gdouble x
,gdouble y
,gdouble *on_path_x
,gdouble *on_path_y
,gint *node_pos_before
);
Figure out what and where on a path is closest to arbitrary coordinates.
Returns the length along the path where the closest point was encountered.
path |
a GeglPath |
|
x |
x coordinate. |
|
y |
y coordinate |
|
on_path_x |
return location for x coordinate on the path that was closest. |
[out] |
on_path_y |
return location for y coordinate on the path that was closest. |
[out] |
node_pos_before |
the node position interpreted before this position was deemed the closest coordinate. |
[out] |
gint gegl_path_calc_y_for_x (GeglPath *path
,gdouble x
,gdouble *y
);
Compute a corresponding y coordinate for a given x input coordinate, returns 0 if computed correctly and -1 if the path doesn't exist for the specified x coordinate.
gboolean gegl_path_calc (GeglPath *path
,gdouble pos
,gdouble *x
,gdouble *y
);
Compute the coordinates of the path at the position
(length measured from
start of path, not including discontinuities).
void gegl_path_calc_values (GeglPath *path
,guint num_samples
,gdouble *xs
,gdouble *ys
);
Compute num_samples
for a path into the provided arrays xs
and ys
the returned values include the start and end positions of the path.
[skip]
path |
a GeglPath |
|
num_samples |
number of samples to compute |
|
xs |
return location for x coordinates. |
[out caller-allocates][array length=num_samples] |
ys |
return location for y coordinates. |
[out caller-allocates][array length=num_samples] |
void gegl_path_get_bounds (GeglPath *self
,gdouble *min_x
,gdouble *max_x
,gdouble *min_y
,gdouble *max_y
);
Compute the bounding box of a path.
void gegl_path_foreach (GeglPath *path
,GeglNodeFunction each_item
,gpointer user_data
);
Execute a provided function for every node in the path (useful for drawing and otherwise traversing a path.)
path |
a GeglPath |
|
each_item |
a function to call for each node in the path. |
[closure user_data][scope call] |
user_data |
user data to pass to the function (in addition to the GeglPathItem). |
void gegl_path_foreach_flat (GeglPath *path
,GeglNodeFunction each_item
,gpointer user_data
);
Execute a provided function for the segments of a poly line approximating the path.
path |
a GeglPath |
|
each_item |
a function to call for each node in the path. |
[closure user_data][scope call] |
user_data |
user data to pass to a node. |
void gegl_path_insert_node (GeglPath *path
,gint pos
,const GeglPathItem *node
);
Insert the new node node
at position pos
in path
.
if pos
= -1, the node is added in the last position.
path |
a GeglPath |
|
pos |
the position we want the new node to have. |
|
node |
pointer to a structure describing the GeglPathItem we want to store |
void gegl_path_replace_node (GeglPath *path
,gint pos
,const GeglPathItem *node
);
Replaces the exiting node at position pos
in path
.
path |
a GeglPath |
|
pos |
the position we want the new node to have. |
|
node |
pointer to a structure describing the GeglPathItem we want to store. |
void gegl_path_remove_node (GeglPath *path
,gint pos
);
Removes the node number pos
in path
.
void gegl_path_parse_string (GeglPath *path
,const gchar *instructions
);
Parses instructions
and appends corresponding nodes to path (call
gegl_path_clean()
first if you want to replace the existing path.
void gegl_path_append (GeglPath *path
,...
);
Use as follows: gegl_path_append (path, 'M', 0.0, 0.0); and gegl_path_append (path, 'C', 10.0, 10.0, 50.0, 10.0, 60.0, 0.0) the number of arguments are determined from the instruction provided.
void
gegl_path_freeze (GeglPath *path
);
Make the GeglPath
stop firing signals as it changes must be paired with a
gegl_path_thaw()
for the signals to start again.
void
gegl_path_thaw (GeglPath *path
);
Restart firing signals (unless the path has been frozen multiple times).
GParamSpec * gegl_param_spec_path (const gchar *name
,const gchar *nick
,const gchar *blurb
,GeglPath *default_path
,GParamFlags flags
);
Creates a new GParamSpec instance specifying a GeglPath property.
void gegl_path_add_type (gchar type
,gint items
,const gchar *description
);
Adds a new type to the path system, FIXME this should probably return something on registration conflicts, for now it expects all registered paths to be aware of each other.
GeglPathList * gegl_path_list_append (GeglPathList *head
,...
);
Appends to path list, if head is NULL a new list is created
[skip]
GeglPathList *
gegl_path_list_destroy (GeglPathList *path
);
Frees up a path list
[skip]
void
gegl_path_add_flattener (GeglFlattenerFunc func
);
Add a new flattener, the flattener should produce a type of path that GeglPath already understands, if the flattener is unable to flatten the incoming path (doesn't understand the instructions), the original path should be returned.
[skip]
GeglPathList *
gegl_path_get_path (GeglPath *path
);
Return the internal untouched GeglPathList
[skip]
GeglPathList *
gegl_path_get_flat_path (GeglPath *path
);
Return a polyline version of path
[skip]
void gegl_path_point_lerp (GeglPathPoint *dest
,GeglPathPoint *a
,GeglPathPoint *b
,gfloat t
);
linear interpolation between two GeglPathPoint
[skip]
gdouble gegl_path_point_dist (GeglPathPoint *a
,GeglPathPoint *b
);
Compute the distance between GeglPathPoint a
and b
[skip]