Gsk.PathBuilder
Description: Reference for Gsk.PathBuilder

### Struct

# GskPathBuilder

since: 4.14

#### Description [src]

    struct GskPathBuilder {
      /* No available fields */
    }

`GskPathBuilder` is an auxiliary object for constructing `GskPath` objects.

A path is constructed like this:

    GskPath *
    construct_path (void)
    {
      GskPathBuilder *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_path_builder_add_circle()` or by adding from other paths like `gsk_path_builder_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_path_builder_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_path_builder_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 `GskPathBuilder` will reduce the degree of added Bézier curves as much as possible, to simplify rendering.

Available since: 4.14

#### Constructors

###### gsk_path_builder_new

Create a new `GskPathBuilder` object.

since: 4.14

#### Instance methods

###### gsk_path_builder_add_cairo_path

Adds a Cairo path to the builder.

since: 4.14

###### gsk_path_builder_add_circle

Adds a circle with the `center` and `radius`.

since: 4.14

###### gsk_path_builder_add_layout

Adds the outlines for the glyphs in `layout` to the builder.

since: 4.14

###### gsk_path_builder_add_path

Appends all of `path` to the builder.

since: 4.14

###### gsk_path_builder_add_rect

Adds `rect` as a new contour to the path built by the builder.

since: 4.14

###### gsk_path_builder_add_reverse_path

Appends all of `path` to the builder, in reverse order.

since: 4.14

###### gsk_path_builder_add_rounded_rect

Adds `rect` as a new contour to the path built in `self`.

since: 4.14

###### gsk_path_builder_add_segment

Adds to `self` the segment of `path` from `start` to `end`.

since: 4.14

###### gsk_path_builder_arc_to

Adds an elliptical arc from the current point to `x3`, `y3` with `x1`, `y1` determining the tangent directions.

since: 4.14

###### gsk_path_builder_close

Ends the current contour with a line back to the start point.

since: 4.14

###### gsk_path_builder_conic_to

Adds a conic curve from the current point to `x2`, `y2` with the given `weight` and `x1`, `y1` as the control point.

since: 4.14

###### gsk_path_builder_cubic_to

Adds a cubic Bézier curve from the current point to `x3`, `y3` with `x1`, `y1` and `x2`, `y2` as the control points.

since: 4.14

###### gsk_path_builder_free_to_path

Creates a new `GskPath` from the current state of the given builder, and unrefs the `builder` instance.

since: 4.14

###### gsk_path_builder_get_current_point

Gets the current point.

since: 4.14

###### gsk_path_builder_html_arc_to

Implements arc-to according to the HTML Canvas spec.

since: 4.14

###### gsk_path_builder_line_to

Draws a line from the current point to `x`, `y` and makes it the new current point.

since: 4.14

###### gsk_path_builder_move_to

Starts a new contour by placing the pen at `x`, `y`.

since: 4.14

###### gsk_path_builder_quad_to

Adds a quadratic Bézier curve from the current point to `x2`, `y2` with `x1`, `y1` as the control point.

since: 4.14

###### gsk_path_builder_ref

Acquires a reference on the given builder.

since: 4.14

###### gsk_path_builder_rel_arc_to

Adds an elliptical arc from the current point to `x3`, `y3` with `x1`, `y1` determining the tangent directions.

since: 4.14

###### gsk_path_builder_rel_conic_to

Adds a conic curve from the current point to `x2`, `y2` with the given `weight` and `x1`, `y1` as the control point.

since: 4.14

###### gsk_path_builder_rel_cubic_to

Adds a cubic Bézier curve from the current point to `x3`, `y3` with `x1`, `y1` and `x2`, `y2` as the control points.

since: 4.14

###### gsk_path_builder_rel_html_arc_to

Implements arc-to according to the HTML Canvas spec.

since: 4.14

###### gsk_path_builder_rel_line_to

Draws a line from the current point to a point offset from it by `x`, `y` and makes it the new current point.

since: 4.14

###### gsk_path_builder_rel_move_to

Starts a new contour by placing the pen at `x`, `y` relative to the current point.

since: 4.14

###### gsk_path_builder_rel_quad_to

Adds a quadratic Bézier curve from the current point to `x2`, `y2` with `x1`, `y1` the control point.

since: 4.14

###### gsk_path_builder_rel_svg_arc_to

Implements arc-to according to the SVG spec.

since: 4.14

###### gsk_path_builder_svg_arc_to

Implements arc-to according to the SVG spec.

since: 4.14

###### gsk_path_builder_to_path

Creates a new `GskPath` from the given builder.

since: 4.14

###### gsk_path_builder_unref

Releases a reference on the given builder.

since: 4.14