class RemotePathBuilder


RemotePathBuilder provides a fluent API to creates a list of RemotePathNode, used to describe a path.

Summary

Public functions

RemotePathBuilder
arcTo(
    horizontalEllipseRadius: RemoteFloat,
    verticalEllipseRadius: RemoteFloat,
    theta: RemoteFloat,
    isMoreThanHalf: RemoteBoolean,
    isPositiveArc: RemoteBoolean,
    x1: RemoteFloat,
    y1: RemoteFloat
)

Add an elliptical arc from the last point to the position (x1, y1) by adding RemotePathNode.ArcTo to nodes.

RemotePathBuilder
arcToRelative(
    a: RemoteFloat,
    b: RemoteFloat,
    theta: RemoteFloat,
    isMoreThanHalf: RemoteBoolean,
    isPositiveArc: RemoteBoolean,
    dx1: RemoteFloat,
    dy1: RemoteFloat
)

Add an elliptical arc by adding RemotePathNode.RelativeArcTo to nodes.

RemotePath
build(creationState: RemoteStateScope)

Build the RemotePath, encoding using the given creationState.

RemotePathBuilder

Closes the current contour by adding a RemotePathNode.Close to nodes.

RemotePathBuilder
curveTo(
    x1: RemoteFloat,
    y1: RemoteFloat,
    x2: RemoteFloat,
    y2: RemoteFloat,
    x3: RemoteFloat,
    y3: RemoteFloat
)

Add a cubic Bézier from the last point to the position (x3, y3), approaching the control points (x1, y1) and (x2, y2), by adding a RemotePathNode.CurveTo to nodes.

RemotePathBuilder
curveToRelative(
    dx1: RemoteFloat,
    dy1: RemoteFloat,
    dx2: RemoteFloat,
    dy2: RemoteFloat,
    dx3: RemoteFloat,
    dy3: RemoteFloat
)

Add a cubic Bézier by adding a RemotePathNode.CurveTo to nodes.

RemotePathBuilder

Add a line from the last point to the position (x, oy), where oy is the y coordinate of the last point, by adding a RemotePathNode.HorizontalTo to nodes.

RemotePathBuilder

Add a line from the last point to the position (dx + ox, oy), where ox and oy are the x and y coordinates of the last point, by adding a RemotePathNode.RelativeHorizontalTo to nodes.

RemotePathBuilder

Add a line from the last point to the position (x, y) by adding a RemotePathNode.LineTo to nodes.

RemotePathBuilder

Add a line from the last point to the offset (dx, dy) relative to the last point by adding a RemotePathNode.RelativeLineTo to nodes.

RemotePathBuilder

Start a new contour at position (x, y) by adding a RemotePathNode.MoveTo to nodes.

RemotePathBuilder

Start a new contour at the offset (dx, dy) relative to the last path position by adding a RemotePathNode.RelativeMoveTo to nodes.

RemotePathBuilder

Add a quadratic Bézier from the last point to the position (x2, y2), approaching the control point (x1, y1), by adding a RemotePathNode.QuadTo to nodes.

RemotePathBuilder
quadToRelative(
    dx1: RemoteFloat,
    dy1: RemoteFloat,
    dx2: RemoteFloat,
    dy2: RemoteFloat
)

Add a quadratic Bézier by adding a RemotePathNode.RelativeQuadTo to nodes.

RemotePathBuilder
reflectiveCurveTo(
    x1: RemoteFloat,
    y1: RemoteFloat,
    x2: RemoteFloat,
    y2: RemoteFloat
)

Add a cubic Bézier from the last point to the position (x2, y2).

RemotePathBuilder
reflectiveCurveToRelative(
    dx1: RemoteFloat,
    dy1: RemoteFloat,
    dx2: RemoteFloat,
    dy2: RemoteFloat
)

Add a cubic Bézier by adding a RemotePathNode.RelativeReflectiveCurveTo to nodes.

RemotePathBuilder

Add a quadratic Bézier from the last point to the position (x1, y1).

RemotePathBuilder

Add a quadratic Bézier by adding a RemotePathNode.RelativeReflectiveQuadTo to nodes.

RemotePathBuilder

Add a line from the last point to the position (ox, y), where ox is the x coordinate of the last point, by adding a RemotePathNode.VerticalTo to nodes.

RemotePathBuilder

Add a line from the last point to the position (ox, dy + oy), where ox and oy are the x and y coordinates of the last point, by adding a RemotePathNode.RelativeVerticalTo to nodes.

Public functions

arcTo

Added in 1.0.0-alpha11
fun arcTo(
    horizontalEllipseRadius: RemoteFloat,
    verticalEllipseRadius: RemoteFloat,
    theta: RemoteFloat,
    isMoreThanHalf: RemoteBoolean,
    isPositiveArc: RemoteBoolean,
    x1: RemoteFloat,
    y1: RemoteFloat
): RemotePathBuilder

Add an elliptical arc from the last point to the position (x1, y1) by adding RemotePathNode.ArcTo to nodes. If no contour has been created by calling moveTo first, the origin of the arc is set to (0, 0).

The ellipse is defined by 3 parameters:

In most situations, there are four arc candidates that can be drawn from the origin to (x1, y1). Which of the arcs is used is influenced by isMoreThanHalf and isPositiveArc.

When isMoreThanHalf is set to true, the added arc will be chosen amongst the two candidates that represent an arc sweep greater than or equal to 180 degrees.

When isPositiveArc is set to true, the added arc will be chosen amongst the two candidates with a positive-angle direction (counter-clockwise)

Parameters
horizontalEllipseRadius: RemoteFloat

The horizontal radius of the ellipse

verticalEllipseRadius: RemoteFloat

The vertical radius of the ellipse

theta: RemoteFloat

The rotation of the ellipse around the X-axis, in degrees

isMoreThanHalf: RemoteBoolean

Defines whether to use an arc candidate with a sweep greater than or equal to 180 degrees

isPositiveArc: RemoteBoolean

Defines whether to use an arc candidate that's counter-clockwise or not

x1: RemoteFloat

The x coordinate of the end point of the arc

y1: RemoteFloat

The y coordinate of the end point of the arc

arcToRelative

Added in 1.0.0-alpha11
fun arcToRelative(
    a: RemoteFloat,
    b: RemoteFloat,
    theta: RemoteFloat,
    isMoreThanHalf: RemoteBoolean,
    isPositiveArc: RemoteBoolean,
    dx1: RemoteFloat,
    dy1: RemoteFloat
): RemotePathBuilder

Add an elliptical arc by adding RemotePathNode.RelativeArcTo to nodes. If no contour has been created by calling moveTo first, the origin of the arc is set to (0, 0). The arc Bézier end point is defined by an offset relative to the last point.

The ellipse is defined by 3 parameters:

  • a and b to define the size of the ellipse

  • theta to define the orientation (as an X-axis rotation) of the ellipse

In most situations, there are four arc candidates that can be drawn from the origin to the end point. Which of the arcs is used is influenced by isMoreThanHalf and isPositiveArc.

When isMoreThanHalf is set to true, the added arc will be chosen amongst the two candidates that represent an arc sweep greater than or equal to 180 degrees.

When isPositiveArc is set to true, the added arc will be chosen amongst the two candidates with a positive-angle direction (counter-clockwise)

Parameters
a: RemoteFloat

The horizontal radius of the ellipse

b: RemoteFloat

The vertical radius of the ellipse

theta: RemoteFloat

The rotation of the ellipse around the X-axis, in degrees

isMoreThanHalf: RemoteBoolean

Defines whether to use an arc candidate with a sweep greater than or equal to 180 degrees

isPositiveArc: RemoteBoolean

Defines whether to use an arc candidate that's counter-clockwise or not

dx1: RemoteFloat

The x offset of the end point of the arc, relative to the last path position

dy1: RemoteFloat

The y offset of the end point of the arc, relative to the last path position

build

Added in 1.0.0-alpha11
fun build(creationState: RemoteStateScope): RemotePath

Build the RemotePath, encoding using the given creationState.

Parameters
creationState: RemoteStateScope

the recording creation state.

close

Added in 1.0.0-alpha11
fun close(): RemotePathBuilder

Closes the current contour by adding a RemotePathNode.Close to nodes.

curveTo

Added in 1.0.0-alpha11
fun curveTo(
    x1: RemoteFloat,
    y1: RemoteFloat,
    x2: RemoteFloat,
    y2: RemoteFloat,
    x3: RemoteFloat,
    y3: RemoteFloat
): RemotePathBuilder

Add a cubic Bézier from the last point to the position (x3, y3), approaching the control points (x1, y1) and (x2, y2), by adding a RemotePathNode.CurveTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0).

Parameters
x1: RemoteFloat

The x coordinate of the first control point of the cubic curve

y1: RemoteFloat

The y coordinate of the first control point of the cubic curve

x2: RemoteFloat

The x coordinate of the second control point of the cubic curve

y2: RemoteFloat

The y coordinate of the second control point of the cubic curve

x3: RemoteFloat

The x coordinate of the end point of the cubic curve

y3: RemoteFloat

The y coordinate of the end point of the cubic curve

curveToRelative

Added in 1.0.0-alpha11
fun curveToRelative(
    dx1: RemoteFloat,
    dy1: RemoteFloat,
    dx2: RemoteFloat,
    dy2: RemoteFloat,
    dx3: RemoteFloat,
    dy3: RemoteFloat
): RemotePathBuilder

Add a cubic Bézier by adding a RemotePathNode.CurveTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0). The cubic Bézier control and end points are defined by offsets relative to the last point.

Parameters
dx1: RemoteFloat

The x offset of the first control point of the cubic curve, relative to the last path position

dy1: RemoteFloat

The y offset of the first control point of the cubic curve, relative to the last path position

dx2: RemoteFloat

The x offset of the second control point of the cubic curve, relative to the last path position

dy2: RemoteFloat

The y offset of the second control point of the cubic curve, relative to the last path position

dx3: RemoteFloat

The x offset of the end point of the cubic curve, relative to the last path position

dy3: RemoteFloat

The y offset of the end point of the cubic curve, relative to the last path position

horizontalLineTo

Added in 1.0.0-alpha11
fun horizontalLineTo(x: RemoteFloat): RemotePathBuilder

Add a line from the last point to the position (x, oy), where oy is the y coordinate of the last point, by adding a RemotePathNode.HorizontalTo to nodes. If no contour has been created by calling moveTo first, the origin of the line is set to (0, 0).

Parameters
x: RemoteFloat

The x coordinate of the end of the line

horizontalLineToRelative

Added in 1.0.0-alpha11
fun horizontalLineToRelative(dx: RemoteFloat): RemotePathBuilder

Add a line from the last point to the position (dx + ox, oy), where ox and oy are the x and y coordinates of the last point, by adding a RemotePathNode.RelativeHorizontalTo to nodes. If no contour has been created by calling moveTo first, the origin of the line is set to (0, 0).

Parameters
dx: RemoteFloat

The x offset of the end of the line, relative to the last path position

lineTo

Added in 1.0.0-alpha11
fun lineTo(x: RemoteFloat, y: RemoteFloat): RemotePathBuilder

Add a line from the last point to the position (x, y) by adding a RemotePathNode.LineTo to nodes. If no contour has been created by calling moveTo first, the origin of the line is set to (0, 0).

Parameters
x: RemoteFloat

The x coordinate of the end of the line

y: RemoteFloat

The y coordinate of the end of the line

lineToRelative

Added in 1.0.0-alpha11
fun lineToRelative(dx: RemoteFloat, dy: RemoteFloat): RemotePathBuilder

Add a line from the last point to the offset (dx, dy) relative to the last point by adding a RemotePathNode.RelativeLineTo to nodes. If no contour has been created by calling moveTo first, the origin of the line is set to (0, 0).

Parameters
dx: RemoteFloat

The x offset of the end of the line, relative to the last path position

dy: RemoteFloat

The y offset of the end of the line, relative to the last path position

moveTo

Added in 1.0.0-alpha11
fun moveTo(x: RemoteFloat, y: RemoteFloat): RemotePathBuilder

Start a new contour at position (x, y) by adding a RemotePathNode.MoveTo to nodes.

Parameters
x: RemoteFloat

The x coordinate of the start of the new contour

y: RemoteFloat

The y coordinate of the start of the new contour

moveToRelative

Added in 1.0.0-alpha11
fun moveToRelative(dx: RemoteFloat, dy: RemoteFloat): RemotePathBuilder

Start a new contour at the offset (dx, dy) relative to the last path position by adding a RemotePathNode.RelativeMoveTo to nodes.

Parameters
dx: RemoteFloat

The x offset of the start of the new contour, relative to the last path position

dy: RemoteFloat

The y offset of the start of the new contour, relative to the last path position

quadTo

Added in 1.0.0-alpha11
fun quadTo(x1: RemoteFloat, y1: RemoteFloat, x2: RemoteFloat, y2: RemoteFloat): RemotePathBuilder

Add a quadratic Bézier from the last point to the position (x2, y2), approaching the control point (x1, y1), by adding a RemotePathNode.QuadTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0).

Parameters
x1: RemoteFloat

The x coordinate of the control point of the quadratic curve

y1: RemoteFloat

The y coordinate of the control point of the quadratic curve

x2: RemoteFloat

The x coordinate of the end point of the quadratic curve

y2: RemoteFloat

The y coordinate of the end point of the quadratic curve

quadToRelative

Added in 1.0.0-alpha11
fun quadToRelative(
    dx1: RemoteFloat,
    dy1: RemoteFloat,
    dx2: RemoteFloat,
    dy2: RemoteFloat
): RemotePathBuilder

Add a quadratic Bézier by adding a RemotePathNode.RelativeQuadTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0). The control point and end point of the curve are defined by offsets relative to the last point.

Parameters
dx1: RemoteFloat

The x offset of the control point of the quadratic curve, relative to the last path position

dy1: RemoteFloat

The y offset of the control point of the quadratic curve, relative to the last path position

dx2: RemoteFloat

The x offset of the end point of the quadratic curve, relative to the last path position

dy2: RemoteFloat

The y offset of the end point of the quadratic curve, relative to the last path position

reflectiveCurveTo

Added in 1.0.0-alpha11
fun reflectiveCurveTo(
    x1: RemoteFloat,
    y1: RemoteFloat,
    x2: RemoteFloat,
    y2: RemoteFloat
): RemotePathBuilder

Add a cubic Bézier from the last point to the position (x2, y2). The first control point is the reflection of the second control point of the previous command. If there is no previous command or the previous command is not a cubic Bézier, the first control point is set to the last path position. The second control point is defined by (x1, y1). Calling this method adds a RemotePathNode.ReflectiveCurveTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0).

Parameters
x1: RemoteFloat

The x coordinate of the second control point of the cubic curve

y1: RemoteFloat

The y coordinate of the second control point of the cubic curve

x2: RemoteFloat

The x coordinate of the end point of the cubic curve

y2: RemoteFloat

The y coordinate of the end point of the cubic curve

reflectiveCurveToRelative

Added in 1.0.0-alpha11
fun reflectiveCurveToRelative(
    dx1: RemoteFloat,
    dy1: RemoteFloat,
    dx2: RemoteFloat,
    dy2: RemoteFloat
): RemotePathBuilder

Add a cubic Bézier by adding a RemotePathNode.RelativeReflectiveCurveTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0). The cubic Bézier second control point and end points are defined by offsets relative to the last point. The reflective nature of the curve is described in reflectiveCurveTo.

Parameters
dx1: RemoteFloat

The x offset of the second control point of the cubic curve, relative to the last path position

dy1: RemoteFloat

The y offset of the second control point of the cubic curve, relative to the last path position

dx2: RemoteFloat

The x offset of the end point of the cubic curve, relative to the last path position

dy2: RemoteFloat

The y offset of the end point of the cubic curve, relative to the last path position

reflectiveQuadTo

Added in 1.0.0-alpha11
fun reflectiveQuadTo(x1: RemoteFloat, y1: RemoteFloat): RemotePathBuilder

Add a quadratic Bézier from the last point to the position (x1, y1). The control point is the reflection of the control point of the previous command. If there is no previous command or the previous command is not a quadratic Bézier, the control point is set to the last path position. Calling this method adds a RemotePathNode.ReflectiveQuadTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0).

Parameters
x1: RemoteFloat

The x coordinate of the end point of the quadratic curve

y1: RemoteFloat

The y coordinate of the end point of the quadratic curve

reflectiveQuadToRelative

Added in 1.0.0-alpha11
fun reflectiveQuadToRelative(dx1: RemoteFloat, dy1: RemoteFloat): RemotePathBuilder

Add a quadratic Bézier by adding a RemotePathNode.RelativeReflectiveQuadTo to nodes. If no contour has been created by calling moveTo first, the origin of the curve is set to (0, 0). The quadratic Bézier end point is defined by an offset relative to the last point. The reflective nature of the curve is described in reflectiveQuadTo.

Parameters
dx1: RemoteFloat

The x offset of the end point of the quadratic curve, relative to the last path position

dy1: RemoteFloat

The y offset of the end point of the quadratic curve, relative to the last path position

verticalLineTo

Added in 1.0.0-alpha11
fun verticalLineTo(y: RemoteFloat): RemotePathBuilder

Add a line from the last point to the position (ox, y), where ox is the x coordinate of the last point, by adding a RemotePathNode.VerticalTo to nodes. If no contour has been created by calling moveTo first, the origin of the line is set to (0, 0).

Parameters
y: RemoteFloat

The y coordinate of the end of the line

verticalLineToRelative

Added in 1.0.0-alpha11
fun verticalLineToRelative(dy: RemoteFloat): RemotePathBuilder

Add a line from the last point to the position (ox, dy + oy), where ox and oy are the x and y coordinates of the last point, by adding a RemotePathNode.RelativeVerticalTo to nodes. If no contour has been created by calling moveTo first, the origin of the line is set to (0, 0).

Parameters
dy: RemoteFloat

The y offset of the end of the line, relative to the last path position