class Gsk::PathBuilder
- Gsk::PathBuilder
- Reference
- Object
Overview
Constructs Gsk::Path
objects.
A path is constructed like this:
WARNING ⚠️ The following code is in c ⚠️
Gsk::Path *
construct_path (void)
{
Gsk::PathBuilder *builder;
builder = gsk_path_builder_new ();
// add contours to the path here
return gsk_path_builder_free_to_path (builder);
Adding contours to the path can be done in two ways.
The easiest option is to use the gsk_path_builder_add_*
group
of functions that add predefined contours to the current path,
either common shapes like Gsk::PathBuilder#add_circle
or by adding from other paths like Gsk::PathBuilder#add_path
.
The gsk_path_builder_add_*
methods always add complete contours,
and do not use or modify the current point.
The other option is to define each line and curve manually with
the gsk_path_builder_*_to
group of functions. You start with
a call to Gsk::PathBuilder#move_to
to set the starting point
and then use multiple calls to any of the drawing functions to
move the pen along the plane. Once you are done, you can call
Gsk::PathBuilder#close
to close the path by connecting it
back with a line to the starting point.
This is similar to how paths are drawn in Cairo.
Note that Gsk::PathBuilder
will reduce the degree of added Bézier
curves as much as possible, to simplify rendering.
Defined in:
lib/gi-crystal/src/auto/gsk-4.0/path_builder.crConstructors
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
- #add_cairo_path(path : Cairo::Path) : Nil
- #add_circle(center : Graphene::Point, radius : Float32) : Nil
- #add_layout(layout : Pango::Layout) : Nil
- #add_path(path : Gsk::Path) : Nil
- #add_rect(rect : Graphene::Rect) : Nil
- #add_reverse_path(path : Gsk::Path) : Nil
- #add_rounded_rect(rect : Gsk::RoundedRect) : Nil
- #add_segment(path : Gsk::Path, start : Gsk::PathPoint, end _end : Gsk::PathPoint) : Nil
- #arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil
- #close : Nil
- #conic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, weight : Float32) : Nil
- #cubic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, x3 : Float32, y3 : Float32) : Nil
- #current_point : Graphene::Point
- #finalize
- #html_arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, radius : Float32) : Nil
- #line_to(x : Float32, y : Float32) : Nil
- #move_to(x : Float32, y : Float32) : Nil
- #quad_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil
- #ref : Gsk::PathBuilder
- #rel_arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil
- #rel_conic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, weight : Float32) : Nil
- #rel_cubic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, x3 : Float32, y3 : Float32) : Nil
- #rel_html_arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, radius : Float32) : Nil
- #rel_line_to(x : Float32, y : Float32) : Nil
- #rel_move_to(x : Float32, y : Float32) : Nil
- #rel_quad_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil
- #rel_svg_arc_to(rx : Float32, ry : Float32, x_axis_rotation : Float32, large_arc : Bool, positive_sweep : Bool, x : Float32, y : Float32) : Nil
- #svg_arc_to(rx : Float32, ry : Float32, x_axis_rotation : Float32, large_arc : Bool, positive_sweep : Bool, x : Float32, y : Float32) : Nil
- #to_path : Gsk::Path
- #to_unsafe : Pointer(Void)
- #unref : Nil