PathBuilder

class PathBuilder(pointer: <Error class: unknown class><<Error class: unknown class>>)

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 method@Gsk.PathBuilder.add_circle or by adding from other paths like method@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 method@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 method@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 GskPathBuilder will reduce the degree of added Bézier curves as much as possible, to simplify rendering.

Skipped during bindings generation

  • parameter path: cairo.Path

Since

4.14

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gskPathBuilderPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun addCircle(center: <Error class: unknown class>, radius: <Error class: unknown class>)

Adds a circle with the @center and @radius.

Link copied to clipboard
fun addLayout(layout: <Error class: unknown class>)

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

Link copied to clipboard
fun addPath(path: Path)

Appends all of @path to the builder.

Link copied to clipboard
fun addRect(rect: <Error class: unknown class>)

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

Link copied to clipboard
fun addReversePath(path: Path)

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

Link copied to clipboard

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

Link copied to clipboard
fun addSegment(path: Path, start: PathPoint, end: PathPoint)

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

Link copied to clipboard
fun arcTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>)

Adds an elliptical arc from the current point to @x2, @y2 with @x1, @y1 determining the tangent directions.

Link copied to clipboard
fun close()

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

Link copied to clipboard
fun conicTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>, weight: <Error class: unknown class>)

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

Link copied to clipboard
fun cubicTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>, x3: <Error class: unknown class>, y3: <Error class: unknown class>)

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

Link copied to clipboard

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

Link copied to clipboard
fun getCurrentPoint(): <Error class: unknown class>

Gets the current point.

Link copied to clipboard
fun htmlArcTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>, radius: <Error class: unknown class>)

Implements arc-to according to the HTML Canvas spec.

Link copied to clipboard
fun lineTo(x: <Error class: unknown class>, y: <Error class: unknown class>)

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

Link copied to clipboard
fun moveTo(x: <Error class: unknown class>, y: <Error class: unknown class>)

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

Link copied to clipboard
fun quadTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>)

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

Link copied to clipboard

Acquires a reference on the given builder.

Link copied to clipboard
fun relArcTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>)

Adds an elliptical arc from the current point to @x2, @y2 with @x1, @y1 determining the tangent directions.

Link copied to clipboard
fun relConicTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>, weight: <Error class: unknown class>)

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

Link copied to clipboard
fun relCubicTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>, x3: <Error class: unknown class>, y3: <Error class: unknown class>)

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

Link copied to clipboard
fun relHtmlArcTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>, radius: <Error class: unknown class>)

Implements arc-to according to the HTML Canvas spec.

Link copied to clipboard
fun relLineTo(x: <Error class: unknown class>, y: <Error class: unknown class>)

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

Link copied to clipboard
fun relMoveTo(x: <Error class: unknown class>, y: <Error class: unknown class>)

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

Link copied to clipboard
fun relQuadTo(x1: <Error class: unknown class>, y1: <Error class: unknown class>, x2: <Error class: unknown class>, y2: <Error class: unknown class>)

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

Link copied to clipboard
fun relSvgArcTo(rx: <Error class: unknown class>, ry: <Error class: unknown class>, xAxisRotation: <Error class: unknown class>, largeArc: Boolean, positiveSweep: Boolean, x: <Error class: unknown class>, y: <Error class: unknown class>)

Implements arc-to according to the SVG spec.

Link copied to clipboard
fun svgArcTo(rx: <Error class: unknown class>, ry: <Error class: unknown class>, xAxisRotation: <Error class: unknown class>, largeArc: Boolean, positiveSweep: Boolean, x: <Error class: unknown class>, y: <Error class: unknown class>)

Implements arc-to according to the SVG spec.

Link copied to clipboard
fun toPath(): Path

Creates a new GskPath from the given builder.

Link copied to clipboard
fun unref()

Releases a reference on the given builder.