Path

A ref-counted wrapper of SkPath.

SkPath contain geometry. SkPath may be empty, or contain one or more verbs that outline a figure. SkPath always starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves. Adding a close verb makes the geometry into a continuous loop, a closed contour. SkPath may contain any number of contours, each beginning with a move verb.

SkPath contours may contain only a move verb, or may also contain lines, quadratic beziers, conics, and cubic beziers. SkPath contours may be open or closed.

When used to draw a filled area, SkPath describes whether the fill is inside or outside the geometry. SkPath also describes the winding rule used to fill overlapping contours.

Categoryrefcounted
Typehime_path_t
Inheritshime_object_t

Constructors

hime_path_t hime_path_create()

Create an empty SkPath.

By default, SkPath has no verbs, no SkPoint, and no weights. FillType is set to kWinding.

Return

hime_path_t

Methods

void hime_path_reset(self)

Set SkPath to its initial state.

Remove verb array, SkPoint array, and weights, and sets FillType to kWinding. Internal storage associated with SkPath is released.

Parameters

Return

void

bool hime_path_is_empty(self)

Return if SkPath is empty.

Parameters

Return

bool

void hime_path_close(self)

Append kClose_Verb to SkPath.

Parameters

Return

void

void hime_path_move_to(self, point)

Add beginning of contour at point.

Parameters

Return

void

void hime_path_line_to(self, point)

Add line from last point to point.

Parameters

Return

void

void hime_path_quad_to(self, point1, point2)

Add quad from last point towards point1, to point2.

Parameters

Return

void

void hime_path_conic_to(self, point1, point2, weight)

Add conic from last point towards point1, to point2, weighted by weight.

Parameters

Return

void

void hime_path_cubic_to(self, point1, point2, point3)

Add cubic from last point towards point1, then towards point2, ending at point3.

Parameters

Return

void

void hime_path_arc_to(self, point, rx, ry, rotate, arc_size, sweep)

Append arc to SkPath.

Arc is implemented by one or more conics weighted to describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc curves from last SkPath point, choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.

Arc sweep is always less than 360 degrees. arcTo() appends line to (x, y) if either radii are zero, or if last SkPath SkPoint equals (x, y). arcTo() scales radii (rx, ry) to fit last SkPath SkPoint and (x, y) if both are greater than zero but too small.

Parameters

Return

void

void hime_path_arc_to_with_oval(self, oval, start_angle, sweep_angle, force_move_to)

Parameters

Return

void

void hime_path_arc_to_with_points(self, point1, point2, weight)

Append arc to SkPath, after appending line if needed. Arc is implemented by conic weighted to describe part of circle. Arc is contained by tangent from last SkPath point to point1, and tangent from point1 to point2. Arc is part of circle sized to radius, positioned so it touches both tangent lines.

Parameters

Return

void

void hime_path_add_rect(self, rect, direction, start)

Add a new contour to the path, defined by the rect, and wound in the specified direction. The verbs added to the path will be:

kMove, kLine, kLine, kLine, kClose

start specifies which corner to begin the contour: 0: upper-left corner 1: upper-right corner 2: lower-right corner 3: lower-left corner

This start point also acts as the implied beginning of the subsequent, contour, if it does not have an explicit moveTo().

Parameters

Return

void

void hime_path_add_oval(self, oval, direction, start)

Add oval to SkPath.

Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width and half oval height. Oval begins at start and continues clockwise if direction is CW, counterclockwise if direction is CCW.

Parameters

Return

void

void hime_path_add_circle(self, center, radius, direction)

Add circle centered at (x, y) of size radius to SkPath.

Circle begins at (x + radius, y), continuing clockwise if direction is CW, and counterclockwise if direction is CCW.

Has no effect if radius is zero or negative.

Parameters

Return

void

void hime_path_add_arc(self, oval, start_angle, sweep_angle)

Append arc to SkPath, as the start of new contour.

Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise.

If sweepAngle <= -360, or sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweepAngle values are treated modulo 360, and arc may or may not draw depending on numeric rounding.

Parameters

Return

void

void hime_path_add_round_rect(self, rect, rx, ry, direction)

Append SkRRect to SkPath, creating a new closed contour.

SkRRect has bounds equal to rect; each corner is 90 degrees of an ellipse with radii (rx, ry). If direction is CW, SkRRect starts at top-left of the lower-left corner and winds clockwise. If direction is CCW, SkRRect starts at the bottom-left of the upper-left corner and winds counterclockwise.

If either rx or ry is too large, rx and ry are scaled uniformly until the corners fit. If rx or ry is less than or equal to zero, AddRoundRect appends SkRect rect to SkPath.

After appending, SkPath may be empty, or may contain SkRect, oval, or SkRRect.

Parameters

Return

void