Path
Object Hierarchy:
Gsk.Path
Gsk.Path
Gsk.Path
Description:
[ CCode ( ref_function = "gsk_path_ref" , type_id = "gsk_path_get_type ()" , unref_function = "gsk_path_unref" ) ] [ Compact ] [ Version ( since = "4.14" ) ]public class Path
A `GskPath` describes lines and curves that are more complex than simple rectangles.
Paths can used for rendering (filling or stroking) and for animations (e.g. as trajectories).
`GskPath` is an immutable, opaque, reference-counted struct. After creation, you cannot change the types it represents. Instead, new `GskPath`
objects have to be created. The [struct@Gsk.PathBuilder] structure is meant to help in this endeavor.
Conceptually, a path consists of zero or more contours (continuous, connected curves), each of which may or may not be closed. Contours are
typically constructed from Bézier segments.
<picture> <source srcset="path-dark.png" media="(prefers-color-scheme: dark)"> <img alt="A Path" src="path-light.png"> <
/picture>
Content:
Static methods:
Methods:
public bool @foreach (PathForeachFlags flags, PathForeachFunc func)
Calls func
for every operation of the path.
public unowned Path @ref ()
Increases the reference count of a `GskPath` by one.
public bool get_bounds (out Rect bounds)
Computes the bounds of the given path.
public bool get_closest_point (Point point, float threshold, out unowned PathPoint result, out float distance)
Computes the closest point on the path to the given point and sets the
result
to it.
public bool get_end_point (out unowned PathPoint result)
Gets the end point of the path.
public bool get_start_point (out unowned PathPoint result)
Gets the start point of the path.
public bool get_stroke_bounds (Stroke stroke, out Rect bounds)
Computes the bounds for stroking the given path with the parameters in
stroke
.
public bool in_fill (Point point, FillRule fill_rule)
Returns whether the given point is inside the area that would be affected if
the path was filled according to fill_rule
.
public bool is_closed ()
Returns if the path represents a single closed contour.
public bool is_empty ()
Checks if the path is empty, i.
public void print (StringBuilder string)
Converts this into a human-readable string
representation suitable for printing.
public void to_cairo (Context cr)
Appends the given path
to the given cairo context for drawing
with Cairo.
public string to_string ()
Converts the path into a string that is suitable for printing.
public void unref ()
Decreases the reference count of a `GskPath` by one.