class Gsk::PathBuilder

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.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pointer : Pointer(Void), transfer : GICrystal::Transfer) #

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


Instance Method Detail

def add_cairo_path(path : Cairo::Path) : Nil #

def add_circle(center : Graphene::Point, radius : Float32) : Nil #

def add_layout(layout : Pango::Layout) : Nil #

def add_path(path : Gsk::Path) : Nil #

def add_rect(rect : Graphene::Rect) : Nil #

def add_reverse_path(path : Gsk::Path) : Nil #

def add_rounded_rect(rect : Gsk::RoundedRect) : Nil #

def add_segment(path : Gsk::Path, start : Gsk::PathPoint, end _end : Gsk::PathPoint) : Nil #

def arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil #

def close : Nil #

def conic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, weight : Float32) : Nil #

def cubic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, x3 : Float32, y3 : Float32) : Nil #

def current_point : Graphene::Point #

def finalize #

def html_arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, radius : Float32) : Nil #

def line_to(x : Float32, y : Float32) : Nil #

def move_to(x : Float32, y : Float32) : Nil #

def quad_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil #

def ref : Gsk::PathBuilder #

def rel_arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil #

def rel_conic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, weight : Float32) : Nil #

def rel_cubic_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, x3 : Float32, y3 : Float32) : Nil #

def rel_html_arc_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, radius : Float32) : Nil #

def rel_line_to(x : Float32, y : Float32) : Nil #

def rel_move_to(x : Float32, y : Float32) : Nil #

def rel_quad_to(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32) : Nil #

def rel_svg_arc_to(rx : Float32, ry : Float32, x_axis_rotation : Float32, large_arc : Bool, positive_sweep : Bool, x : Float32, y : Float32) : Nil #

def svg_arc_to(rx : Float32, ry : Float32, x_axis_rotation : Float32, large_arc : Bool, positive_sweep : Bool, x : Float32, y : Float32) : Nil #

def to_path : Gsk::Path #

def to_unsafe : Pointer(Void) #

def unref : Nil #