Basics
Guides
API Reference
Basics
Guides
API Reference
[23:7] extends: object
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.
GskPath (Handle = null)
Creates a new
Pathby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.equal (object path2)
Returns whether two paths have identical structure. Note that it is possible to construct paths that render identical even though they don't have the same structure.
path2 is another path.true if @path1 and @path2 have identical structure.foreach (string flags, user_data)
Calls @func for every operation of the path. Note that this may only approximate @self, because paths can contain optimizations for various specialized contours, and depending on the @flags, the path may be decomposed into simpler curves than the ones that it contained originally. This function serves two purposes: - When the @flags allow everything, it provides access to the raw, unmodified data of the path. - When the @flags disallow certain operations, it provides an approximation of the path using just the allowed operations.
flags is flags to pass to the foreach function.func is the function to call for operations.user_data is user data passed to @func.false if @func returned false, true otherwise..foreach_intersection (object path2, user_data)
Finds intersections between two paths. This function finds intersections between @path1 and @path2, and calls @func for each of them, in increasing order for @path1. If @path2 is not provided or equal to
the function finds non-trivial self-intersections of @path1. When segments of the paths coincide, the callback is called once for the start of the segment, with @GSK_PATH_INTERSECTION_START, and once for the end of the segment, with @GSK_PATH_INTERSECTION_END. Note that other intersections may occur between the start and end of such a segment. Ifreturns FALSE, the iteration is stopped.path2 is the second path.func is the function to call for intersections.user_data is user data passed to @func.FALSE if @func returned FALSE, TRUE` otherwise..get_bounds ()
Computes the bounds of the given path. The returned bounds may be larger than necessary, because this function aims to be fast, not accurate. The bounds are guaranteed to contain the path. For accurate bounds, use [method@Gsk.Path.get_tight_bounds]. It is possible that the returned rectangle has 0 width and/or height. This can happen when the path only describes a point or an axis-aligned line. If the path is empty, false is returned and @bounds are set to graphene_rect_zero(). This is different from the case where the path is a single point at the origin, where the
will also be set to the zero rectangle but true will be returned.bounds is return location for the bounds.true if the path has bounds, false if the path is known to be empty and have no bounds.get_next ()
Moves @point to the next vertex. An empty path has no points, so false is returned in this case.
point is the current point.true if @point was set.get_previous ()
Moves @point to the previous vertex. An empty path has no points, so false is returned in this case.
point is the current point.true if @point was set.get_stroke_bounds (object stroke)
Computes the bounds for stroking the given path with the given parameters. The returned bounds may be larger than necessary, because this function aims to be fast, not accurate. The bounds are guaranteed to contain the area affected by the stroke, including protrusions like miters.
stroke is stroke parameters.bounds is the bounds to fill in.true if the path has bounds, false if the path is known to be empty and have no bounds..get_tight_bounds ()
Computes the tight bounds of the given path. This function works harder than [method@Gsk.Path.get_bounds] to produce the smallest possible bounds.
bounds is return location for the bounds.true if the path has bounds, false if the path is known to be empty and have no bounds.in_fill (object point, string fill_rule)
Returns whether a point is inside the fill area of a path. Note that this function assumes that filling a contour implicitly closes it.
point is the point to test.fill_rule is the fill rule to follow.true if @point is inside.is_closed ()
Returns if the path represents a single closed contour.
true if the path is closed.is_empty ()
Checks if the path is empty, i.e. contains no lines or curves.
true if the path is empty.print (object arg1String)
Converts the path into a human-readable representation. The string is compatible with (a superset of) SVG path syntax, see [func@Gsk.Path.parse] for a summary of the syntax.
string is the string to print into.None.ref ()
Increases the reference count of a path by one.
the passed in GskPath.to_cairo (object cr)
Appends the path to a cairo context for drawing with Cairo. This may cause some suboptimal conversions to be performed as Cairo does not support all features of
GskPath. This function does not clear the existing Cairo path. Call cairo_new_path() if you want this.
cr is a cairo context.None.to_string ()
Converts the path into a human-readable string. You can use this function in a debugger to get a quick overview of the path. This is a wrapper around [method@Gsk.Path.print], see that function for details.
a new string for @self.unref ()
Decreases the reference count of a path by one. If the resulting reference count is zero, frees the path.
None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.