Function

addSvg

Adds the specified SVG path data to this Path.

addSvg

Source set: Common
public fun Path.addSvg(pathData: String)

Adds the specified SVG path data to this Path. The SVG path data encodes a series of instructions that will be applied to this path. For instance, the following path data:

M200,300 Q400,50 600,300 L1000,300

Will generate the following series of instructions for this path:

moveTo(200f, 300f)
quadraticTo(400f, 50f, 600f, 300f)
lineTo(1000f, 300f)

To convert a Path to its SVG path data representation, please refer to Path.toSvg.

Throws: IllegalArgumentException

if the path data contains an invalid instruction

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: