State of Compose 2023 results are in! Click here to learn more

← Back to Compose UI

Path

Component
in
Compose UI
. Since 1.4.0

Overview

Code Examples

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.

@param pathData List of PathNodes that define the path. @param pathFillType The PathFillType that specifies how to fill the path. @param name Optional name of the path used when describing the vector as a string. @param fill The Brush used to fill the path. @param fillAlpha The alpha value to use for fill. @param stroke The Brush used to stroke the path. @param strokeAlpha The alpha value to use for stroke. @param strokeLineWidth The width of the stroke. See Stroke.width for details. @param strokeLineCap The StrokeCap of stroke. See Stroke.cap for details. @param strokeLineJoin The StrokeJoin of stroke. See Stroke.join for details. @param strokeLineMiter The stroke miter value. See Stroke.miter for details. @param trimPathStart The fraction of the path that specifies the start of the clipped region of the path. See PathMeasure.getSegment. @param trimPathEnd The fraction of the path that specifies the end of the clipped region of the path. See PathMeasure.getSegment. @param trimPathOffset The amount to offset both trimPathStart and trimPathEnd.

Overloads

Path

@Composable
@VectorComposable
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 PathNodes 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