🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

PathNode

Represents a single command in a vector graphics path.

Source set: Common
public sealed class PathNode(
    public val isCurve: Boolean = false,
    public val isQuad: Boolean = false,
)

Represents a single command in a vector graphics path. Each node corresponds to a command in a standard path data specification.

Members

Close

Source set: Common
@Immutable public object Close : PathNode()

Closes the current subpath by drawing a straight line from the current point to the initial point of the subpath. RelativeClose and Close are considered the same internally, so we represent both with Close for simplicity and to make equals comparisons robust.

Corresponds to the Z or z path data commands.

RelativeMoveTo

Source set: Common
public data class RelativeMoveTo(public val dx: Float, public val dy: Float) : PathNode()

Starts a new subpath at a point defined by a relative offset from the current point. Corresponds to the m path data command.

Parameters

dx The relative change in the x-coordinate.
dy The relative change in the y-coordinate.

MoveTo

Source set: Common
public data class MoveTo(public val x: Float, public val y: Float) : PathNode()

Starts a new subpath at the given absolute (x,y) coordinate. Corresponds to the M path data command.

Parameters

x The absolute x-coordinate to move to.
y The absolute y-coordinate to move to.

RelativeLineTo

Source set: Common
public data class RelativeLineTo(public val dx: Float, public val dy: Float) : PathNode()

Draws a line from the current point to a new point, defined by a relative offset. Corresponds to the l path data command.

Parameters

dx The relative change in the x-coordinate.
dy The relative change in the y-coordinate.

LineTo

Source set: Common
public data class LineTo(public val x: Float, public val y: Float) : PathNode()

Draws a line from the current point to the specified absolute (x,y) coordinate. Corresponds to the L path data command.

Parameters

x The absolute x-coordinate of the line's end point.
y The absolute y-coordinate of the line's end point.

RelativeHorizontalTo

Source set: Common
public data class RelativeHorizontalTo(public val dx: Float) : PathNode()

Draws a horizontal line from the current point, offset by a relative distance dx. Corresponds to the h path data command.

Parameters

dx The relative change in the x-coordinate.

HorizontalTo

Source set: Common
public data class HorizontalTo(public val x: Float) : PathNode()

Draws a horizontal line from the current point to the specified absolute x-coordinate. Corresponds to the H path data command.

Parameters

x The absolute x-coordinate of the line's end point.

RelativeVerticalTo

Source set: Common
public data class RelativeVerticalTo(public val dy: Float) : PathNode()

Draws a vertical line from the current point, offset by a relative distance dy. Corresponds to the v path data command.

Parameters

dy The relative change in the y-coordinate.

VerticalTo

Source set: Common
public data class VerticalTo(public val y: Float) : PathNode()

Draws a vertical line from the current point to the specified absolute y-coordinate. Corresponds to the V path data command.

Parameters

y The absolute y-coordinate of the line's end point.

RelativeCurveTo

Source set: Common
public data class RelativeCurveTo(
        public val dx1: Float,
        public val dy1: Float,
        public val dx2: Float,
        public val dy2: Float,
        public val dx3: Float,
        public val dy3: Float,
    ) : PathNode(isCurve = true)

Draws a cubic Bézier curve from the current point to a new point using relative coordinates. Corresponds to the c path data command.

Parameters

dx1 The relative x-offset of the first control point.
dy1 The relative y-offset of the first control point.
dx2 The relative x-offset of the second control point.
dy2 The relative y-offset of the second control point.
dx3 The relative x-offset of the curve's end point.
dy3 The relative y-offset of the curve's end point.

CurveTo

Source set: Common
public data class CurveTo(
        public val x1: Float,
        public val y1: Float,
        public val x2: Float,
        public val y2: Float,
        public val x3: Float,
        public val y3: Float,
    ) : PathNode(isCurve = true)

Draws a cubic Bézier curve from the current point to a new point using absolute coordinates. Corresponds to the C path data command.

Parameters

x1 The absolute x-coordinate of the first control point.
y1 The absolute y-coordinate of the first control point.
x2 The absolute x-coordinate of the second control point.
y2 The absolute y-coordinate of the second control point.
x3 The absolute x-coordinate of the curve's end point.
y3 The absolute y-coordinate of the curve's end point.

RelativeReflectiveCurveTo

Source set: Common
public data class RelativeReflectiveCurveTo(
        public val dx1: Float,
        public val dy1: Float,
        public val dx2: Float,
        public val dy2: Float,
    ) : PathNode(isCurve = true)

Draws a smooth cubic Bézier curve using relative coordinates. This command ensures a seamless connection to a previous curve by inferring its first control point as a reflection of the last control point of the preceding command. Corresponds to the s path data command.

Parameters

dx1 The relative x-offset of the second control point.
dy1 The relative y-offset of the second control point.
dx2 The relative x-offset of the curve's end point.
dy2 The relative y-offset of the curve's end point.

ReflectiveCurveTo

Source set: Common
public data class ReflectiveCurveTo(
        public val x1: Float,
        public val y1: Float,
        public val x2: Float,
        public val y2: Float,
    ) : PathNode(isCurve = true)

Draws a smooth cubic Bézier curve using absolute coordinates. This command ensures a seamless connection to a previous curve by inferring its first control point as a reflection of the last control point of the preceding command. Corresponds to the S path data command.

Parameters

x1 The absolute x-coordinate of the second control point.
y1 The absolute y-coordinate of the second control point.
x2 The absolute x-coordinate of the curve's end point.
y2 The absolute y-coordinate of the curve's end point.

RelativeQuadTo

Source set: Common
public data class RelativeQuadTo(
        public val dx1: Float,
        public val dy1: Float,
        public val dx2: Float,
        public val dy2: Float,
    ) : PathNode(isQuad = true)

Draws a quadratic Bézier curve from the current point to a new point using relative coordinates. Corresponds to the q path data command.

Parameters

dx1 The relative x-offset of the control point.
dy1 The relative y-offset of the control point.
dx2 The relative x-offset of the curve's end point.
dy2 The relative y-offset of the curve's end point.

QuadTo

Source set: Common
public data class QuadTo(
        public val x1: Float,
        public val y1: Float,
        public val x2: Float,
        public val y2: Float,
    ) : PathNode(isQuad = true)

Draws a quadratic Bézier curve from the current point to a new point using absolute coordinates. Corresponds to the Q path data command.

Parameters

x1 The absolute x-coordinate of the control point.
y1 The absolute y-coordinate of the control point.
x2 The absolute x-coordinate of the curve's end point.
y2 The absolute y-coordinate of the curve's end point.

RelativeReflectiveQuadTo

Source set: Common
public data class RelativeReflectiveQuadTo(public val dx: Float, public val dy: Float) :
        PathNode(isQuad = true)

Draws a smooth quadratic Bézier curve using relative coordinates. This command ensures a seamless connection by inferring its control point as a reflection of the control point of the preceding command. Corresponds to the t path data command.

Parameters

dx The relative x-offset of the curve's end point.
dy The relative y-offset of the curve's end point.

ReflectiveQuadTo

Source set: Common
public data class ReflectiveQuadTo(public val x: Float, public val y: Float) :
        PathNode(isQuad = true)

Draws a smooth quadratic Bézier curve using absolute coordinates. This command ensures a seamless connection by inferring its control point as a reflection of the control point of the preceding command. Corresponds to the T path data command.

Parameters

x The absolute x-coordinate of the curve's end point.
y The absolute y-coordinate of the curve's end point.

RelativeArcTo

Source set: Common
public data class RelativeArcTo(
        public val horizontalEllipseRadius: Float,
        public val verticalEllipseRadius: Float,
        public val theta: Float,
        public val isMoreThanHalf: Boolean,
        public val isPositiveArc: Boolean,
        public val arcStartDx: Float,
        public val arcStartDy: Float,
    ) : PathNode()

Draws an elliptical arc from the current point to a new point using relative coordinates. Corresponds to the a path data command.

Parameters

horizontalEllipseRadius The radius of the ellipse on the x-axis.
verticalEllipseRadius The radius of the ellipse on the y-axis.
theta The rotation angle of the ellipse in degrees.
isMoreThanHalf If true, the larger of the two possible arcs is chosen.
isPositiveArc If true, the arc is drawn in a "positive-angle" direction.
arcStartDx The relative x-offset of the arc's end point.
arcStartDy The relative y-offset of the arc's end point.

ArcTo

Source set: Common
public data class ArcTo(
        public val horizontalEllipseRadius: Float,
        public val verticalEllipseRadius: Float,
        public val theta: Float,
        public val isMoreThanHalf: Boolean,
        public val isPositiveArc: Boolean,
        public val arcStartX: Float,
        public val arcStartY: Float,
    ) : PathNode()

Draws an elliptical arc from the current point to a new point using absolute coordinates. Corresponds to the A path data command.

Parameters

horizontalEllipseRadius The radius of the ellipse on the x-axis.
verticalEllipseRadius The radius of the ellipse on the y-axis.
theta The rotation angle of the ellipse in degrees.
isMoreThanHalf If true, the larger of the two possible arcs is chosen.
isPositiveArc If true, the arc is drawn in a "positive-angle" direction.
arcStartX The absolute x-coordinate of the arc's end point.
arcStartY The absolute y-coordinate of the arc's end point.