PathBuilder

gsk.path_builder.PathBuilder is an auxiliary object for constructing gsk.path.Path 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.PathBuilder.addCircle or by adding from other paths like gsk.path_builder.PathBuilder.addPath.

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.PathBuilder.moveTo 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.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.path_builder.PathBuilder will reduce the degree of added Bézier curves as much as possible, to simplify rendering.

Constructors

this
this()

Create a new gsk.path_builder.PathBuilder object.

Members

Functions

addCairoPath
void addCairoPath(cairo.path.Path path)

Adds a Cairo path to the builder.

addCircle
void addCircle(graphene.point.Point center, float radius)

Adds a circle with the center and radius.

addLayout
void addLayout(pango.layout.Layout layout)

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

addPath
void addPath(gsk.path.Path path)

Appends all of path to the builder.

addRect
void addRect(graphene.rect.Rect rect)

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

addReversePath
void addReversePath(gsk.path.Path path)

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

addRoundedRect
void addRoundedRect(gsk.rounded_rect.RoundedRect rect)

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

addSegment
void addSegment(gsk.path.Path path, gsk.path_point.PathPoint start, gsk.path_point.PathPoint end)

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

arcTo
void arcTo(float x1, float y1, float x2, float y2)

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

close
void close()

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

conicTo
void conicTo(float x1, float y1, float x2, float y2, float weight)

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

cubicTo
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3)

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

getCurrentPoint
graphene.point.Point getCurrentPoint()

Gets the current point.

htmlArcTo
void htmlArcTo(float x1, float y1, float x2, float y2, float radius)

Implements arc-to according to the HTML Canvas spec.

lineTo
void lineTo(float x, float y)

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

moveTo
void moveTo(float x, float y)

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

quadTo
void quadTo(float x1, float y1, float x2, float y2)

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

relArcTo
void relArcTo(float x1, float y1, float x2, float y2)

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

relConicTo
void relConicTo(float x1, float y1, float x2, float y2, float weight)

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

relCubicTo
void relCubicTo(float x1, float y1, float x2, float y2, float x3, float y3)

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

relHtmlArcTo
void relHtmlArcTo(float x1, float y1, float x2, float y2, float radius)

Implements arc-to according to the HTML Canvas spec.

relLineTo
void relLineTo(float x, float y)

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

relMoveTo
void relMoveTo(float x, float y)

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

relQuadTo
void relQuadTo(float x1, float y1, float x2, float y2)

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

relSvgArcTo
void relSvgArcTo(float rx, float ry, float xAxisRotation, bool largeArc, bool positiveSweep, float x, float y)

Implements arc-to according to the SVG spec.

svgArcTo
void svgArcTo(float rx, float ry, float xAxisRotation, bool largeArc, bool positiveSweep, float x, float y)

Implements arc-to according to the SVG spec.

toPath
gsk.path.Path toPath()

Creates a new gsk.path.Path from the given builder.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.