New Compose Multiplatform components arrived on Composables UICheck it out →

Path

Defines a path inside a [VectorPainter]. This is not a regular UI composable, it can only be called inside composables called from the content parameter to [rememberVectorPainter].

Last updated:

Installation

dependencies {
   implementation("androidx.compose.ui:ui:1.7.0-beta03")
}

Overloads

@VectorComposable
@Composable
fun Path(
    pathData: List<PathNode>,
    pathFillType: PathFillType = DefaultFillType,
    name: String = DefaultPathName,
    fill: Brush? = null,
    fillAlpha: Float = 1.0f,
    stroke: Brush? = null,
    strokeAlpha: Float = 1.0f,
    strokeLineWidth: Float = DefaultStrokeLineWidth,
    strokeLineCap: StrokeCap = DefaultStrokeLineCap,
    strokeLineJoin: StrokeJoin = DefaultStrokeLineJoin,
    strokeLineMiter: Float = DefaultStrokeLineMiter,
    trimPathStart: Float = DefaultTrimPathStart,
    trimPathEnd: Float = DefaultTrimPathEnd,
    trimPathOffset: Float = DefaultTrimPathOffset
)

Parameters

namedescription
pathDataList of [PathNode]s that define the path.
pathFillTypeThe [PathFillType] that specifies how to fill the path.
nameOptional name of the path used when describing the vector as a string.
fillThe [Brush] used to fill the path.
fillAlphaThe alpha value to use for [fill].
strokeThe [Brush] used to stroke the path.
strokeAlphaThe alpha value to use for [stroke].
strokeLineWidthThe width of the [stroke]. See [Stroke.width] for details.
strokeLineCapThe [StrokeCap] of [stroke]. See [Stroke.cap] for details.
strokeLineJoinThe [StrokeJoin] of [stroke]. See [Stroke.join] for details.
strokeLineMiterThe stroke miter value. See [Stroke.miter] for details.
trimPathStartThe fraction of the path that specifies the start of the clipped region of the path. See [PathMeasure.getSegment].
trimPathEndThe fraction of the path that specifies the end of the clipped region of the path. See [PathMeasure.getSegment].
trimPathOffsetThe amount to offset both [trimPathStart] and [trimPathEnd].