androidx.ui.graphics.vector

Classes

GroupComponent

PathBuilder

PathComponent

PathNode

Class representing a singular path command in a vector.

PathParser

VectorAsset

Vector graphics object that is generated as a result of VectorAssetBuilder] It can be composed and rendered by passing it as an argument to drawVector

VectorAssetBuilder

Builder used to construct a Vector graphic tree.

VectorComponent

VectorComposer

VectorComposition

VectorGroup

Defines a group of paths or subgroups, plus transformation information.

VectorNode

VectorPath

Leaf node of a Vector graphics tree.

VectorScope

VNode

Type-aliases

VectorUpdater

Top-level constants summary

const Float

const String

const String

const Float

const Float

const Float

const Float

const Float

const Float

const Float

const Float

const Float

Top-level functions summary

List<PathNode>
PathData(block: PathBuilder.() -> Unit)

List<PathNode>
addPathNodes(pathStr: String?)

Composition
composeVector(container: VectorComponent, parent: CompositionReference? = null, composable: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit)

Unit
disposeVector(container: VectorComponent, parent: CompositionReference? = null)

Modifier
drawVector(vectorImage: VectorAsset, tintColor: Color = Color.Transparent, tintBlendMode: BlendMode = DefaultTintBlendMode, alignment: Alignment = Alignment.Center, fit: ScaleFit = ScaleFit.Fit)

Composes a vector graphic into the composition tree based on the specification provided by given VectorAsset

Modifier
drawVector(defaultWidth: Dp, defaultHeight: Dp, viewportWidth: Float = unset, viewportHeight: Float = unset, tintColor: Color = DefaultTintColor, tintBlendMode: BlendMode = DefaultTintBlendMode, alignment: Alignment = DefaultAlignment, scaleFit: ScaleFit = ScaleFit.Fit, name: String = "", children: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit)

Modifier to draw a vector graphic with the provided width, height and viewport dimensions

Modifier
drawVector(defaultWidth: Px, defaultHeight: Px, viewportWidth: Float = defaultWidth.value, viewportHeight: Float = defaultHeight.value, tintColor: Color = DefaultTintColor, tintBlendMode: BlendMode = DefaultTintBlendMode, alignment: Alignment = DefaultAlignment, scaleFit: ScaleFit = ScaleFit.Fit, name: String = "", children: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit)

Modifier to draw a vector graphic with the provided width, height and viewport dimensions

Top-level properties summary

StrokeCap

StrokeJoin

BlendMode

Color

List<PathNode>

Extension functions summary

For VectorScope
Unit
VectorScope.Group(name: String = DefaultGroupName, rotation: Float = DefaultRotation, pivotX: Float = DefaultPivotX, pivotY: Float = DefaultPivotY, scaleX: Float = DefaultScaleX, scaleY: Float = DefaultScaleY, translationX: Float = DefaultTranslationX, translationY: Float = DefaultTranslationY, clipPathData: List<PathNode> = EmptyPath, children: VectorScope.() -> Unit)

Unit
VectorScope.Path(pathData: List<PathNode>, name: String = DefaultPathName, fill: Brush? = null, fillAlpha: Float = DefaultAlpha, stroke: Brush? = null, strokeAlpha: Float = DefaultAlpha, strokeLineWidth: Float = DefaultStrokeLineWidth, strokeLineCap: StrokeCap = DefaultStrokeLineCap, strokeLineJoin: StrokeJoin = DefaultStrokeLineJoin, strokeLineMiter: Float = DefaultStrokeLineMiter)

For VectorAssetBuilder
VectorAssetBuilder
VectorAssetBuilder.group(name: String = DefaultGroupName, rotate: Float = DefaultRotation, pivotX: Float = DefaultPivotX, pivotY: Float = DefaultPivotY, scaleX: Float = DefaultScaleX, scaleY: Float = DefaultScaleY, translationX: Float = DefaultTranslationX, translationY: Float = DefaultTranslationY, clipPathData: List<PathNode> = EmptyPath, block: VectorAssetBuilder.() -> Unit)

DSL extension for adding a VectorGroup to this.

VectorAssetBuilder
VectorAssetBuilder.path(name: String = DefaultPathName, fill: Brush? = null, fillAlpha: Float = DefaultAlpha, stroke: Brush? = null, strokeAlpha: Float = DefaultAlpha, strokeLineWidth: Float = DefaultStrokeLineWidth, strokeLineCap: StrokeCap = DefaultStrokeLineCap, strokeLineJoin: StrokeJoin = DefaultStrokeLineJoin, strokeLineMiter: Float = DefaultStrokeLineMiter, pathBuilder: PathBuilder.() -> Unit)

DSL extension for adding a VectorPath to this.

Top-level constants

DefaultAlpha

const val DefaultAlpha: Float
Value: 1.0f

DefaultGroupName

const val DefaultGroupName: String
Value: ""

DefaultPathName

const val DefaultPathName: String
Value: ""

DefaultPivotX

const val DefaultPivotX: Float
Value: 0.0f

DefaultPivotY

const val DefaultPivotY: Float
Value: 0.0f

DefaultRotation

const val DefaultRotation: Float
Value: 0.0f

DefaultScaleX

const val DefaultScaleX: Float
Value: 1.0f

DefaultScaleY

const val DefaultScaleY: Float
Value: 1.0f

DefaultStrokeLineMiter

const val DefaultStrokeLineMiter: Float
Value: 4.0f

DefaultStrokeLineWidth

const val DefaultStrokeLineWidth: Float
Value: 0.0f

DefaultTranslationX

const val DefaultTranslationX: Float
Value: 0.0f

DefaultTranslationY

const val DefaultTranslationY: Float
Value: 0.0f

Top-level functions

PathData

inline fun PathData(block: PathBuilder.() -> Unit): List<PathNode>

addPathNodes

fun addPathNodes(pathStr: String?): List<PathNode>

composeVector

fun composeVector(
    container: VectorComponent,
    parent: CompositionReference? = null,
    composable: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
): Composition

disposeVector

fun disposeVector(
    container: VectorComponent,
    parent: CompositionReference? = null
): Unit

drawVector

@Composable fun drawVector(
    vectorImage: VectorAsset,
    tintColor: Color = Color.Transparent,
    tintBlendMode: BlendMode = DefaultTintBlendMode,
    alignment: Alignment = Alignment.Center,
    fit: ScaleFit = ScaleFit.Fit
): Modifier

Composes a vector graphic into the composition tree based on the specification provided by given VectorAsset

Parameters
tintColor: Color = Color.Transparent Optional color used to tint this vector graphic
tintBlendMode: BlendMode = DefaultTintBlendMode Optional blend mode used with tintColor, default is BlendMode.srcIn

drawVector

@Composable fun drawVector(
    defaultWidth: Dp,
    defaultHeight: Dp,
    viewportWidth: Float = unset,
    viewportHeight: Float = unset,
    tintColor: Color = DefaultTintColor,
    tintBlendMode: BlendMode = DefaultTintBlendMode,
    alignment: Alignment = DefaultAlignment,
    scaleFit: ScaleFit = ScaleFit.Fit,
    name: String = "",
    children: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
): Modifier

Modifier to draw a vector graphic with the provided width, height and viewport dimensions

Parameters
defaultWidth: Dp Intrinsic width of the Vector in Dp
defaultHeight: Dp Intrinsic height of hte Vector in Dp
viewportWidth: Float = unset Width of the viewport space. The viewport is the virtual canvas where paths are drawn on. This parameter is optional. Not providing it will use the defaultWidth converted to Px
viewportHeight: Float = unset Height of hte viewport space. The viewport is the virtual canvas where paths are drawn on. This parameter is optional. Not providing it will use the defaultHeight converted to Px
tintColor: Color = DefaultTintColor Optional color used to tint this vector graphic
tintBlendMode: BlendMode = DefaultTintBlendMode Optional blend mode used with tintColor, default is BlendMode.srcIn
alignment: Alignment = DefaultAlignment Specifies the placement of the vector within the drawing bounds
scaleFit: ScaleFit = ScaleFit.Fit Specifies how the vector is to be scaled within the parent bounds

drawVector

@Composable fun drawVector(
    defaultWidth: Px,
    defaultHeight: Px,
    viewportWidth: Float = defaultWidth.value,
    viewportHeight: Float = defaultHeight.value,
    tintColor: Color = DefaultTintColor,
    tintBlendMode: BlendMode = DefaultTintBlendMode,
    alignment: Alignment = DefaultAlignment,
    scaleFit: ScaleFit = ScaleFit.Fit,
    name: String = "",
    children: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
): Modifier

Modifier to draw a vector graphic with the provided width, height and viewport dimensions

Parameters
defaultWidth: Px Intrinsic width of the Vector in Px
defaultHeight: Px Intrinsic height of hte Vector in Px
viewportWidth: Float = defaultWidth.value Width of the viewport space. The viewport is the virtual canvas where paths are drawn on. This parameter is optional. Not providing it will use the defaultWidth
viewportHeight: Float = defaultHeight.value Height of hte viewport space. The viewport is the virtual canvas where paths are drawn on. This parameter is optional. Not providing it will use the defaultHeight
tintColor: Color = DefaultTintColor Optional color used to tint this vector graphic
tintBlendMode: BlendMode = DefaultTintBlendMode Optional blend mode used with tintColor, default is BlendMode.srcIn
alignment: Alignment = DefaultAlignment Specifies the placement of the vector within the drawing bounds
scaleFit: ScaleFit = ScaleFit.Fit Specifies how the vector is to be scaled within the parent bounds

Top-level properties

DefaultStrokeLineCap

val DefaultStrokeLineCap: StrokeCap

DefaultStrokeLineJoin

val DefaultStrokeLineJoin: StrokeJoin

DefaultTintBlendMode

val DefaultTintBlendMode: BlendMode

DefaultTintColor

val DefaultTintColor: Color

EmptyPath

val EmptyPath: List<PathNode>

Extension functions

Group

@Composable fun VectorScope.Group(
    name: String = DefaultGroupName,
    rotation: Float = DefaultRotation,
    pivotX: Float = DefaultPivotX,
    pivotY: Float = DefaultPivotY,
    scaleX: Float = DefaultScaleX,
    scaleY: Float = DefaultScaleY,
    translationX: Float = DefaultTranslationX,
    translationY: Float = DefaultTranslationY,
    clipPathData: List<PathNode> = EmptyPath,
    children: VectorScope.() -> Unit
): Unit

Path

@Composable fun VectorScope.Path(
    pathData: List<PathNode>,
    name: String = DefaultPathName,
    fill: Brush? = null,
    fillAlpha: Float = DefaultAlpha,
    stroke: Brush? = null,
    strokeAlpha: Float = DefaultAlpha,
    strokeLineWidth: Float = DefaultStrokeLineWidth,
    strokeLineCap: StrokeCap = DefaultStrokeLineCap,
    strokeLineJoin: StrokeJoin = DefaultStrokeLineJoin,
    strokeLineMiter: Float = DefaultStrokeLineMiter
): Unit

group

fun VectorAssetBuilder.group(
    name: String = DefaultGroupName,
    rotate: Float = DefaultRotation,
    pivotX: Float = DefaultPivotX,
    pivotY: Float = DefaultPivotY,
    scaleX: Float = DefaultScaleX,
    scaleY: Float = DefaultScaleY,
    translationX: Float = DefaultTranslationX,
    translationY: Float = DefaultTranslationY,
    clipPathData: List<PathNode> = EmptyPath,
    block: VectorAssetBuilder.() -> Unit
): VectorAssetBuilder

DSL extension for adding a VectorGroup to this.

See VectorAssetBuilder.pushGroup for the corresponding builder function.

Parameters
name: String = DefaultGroupName the name of the group
rotate: Float = DefaultRotation the rotation of the group in degrees
pivotX: Float = DefaultPivotX the x coordinate of the pivot point to rotate or scale the group
pivotY: Float = DefaultPivotY the y coordinate of the pivot point to rotate or scale the group
scaleX: Float = DefaultScaleX the scale factor in the X-axis to apply to the group
scaleY: Float = DefaultScaleY the scale factor in the Y-axis to apply to the group
translationX: Float = DefaultTranslationX the translation in virtual pixels to apply along the x-axis
translationY: Float = DefaultTranslationY the translation in virtual pixels to apply along the y-axis
clipPathData: List<PathNode> = EmptyPath the path information used to clip the content within the group
block: VectorAssetBuilder.() -> Unit builder lambda to add children to this group

path

fun VectorAssetBuilder.path(
    name: String = DefaultPathName,
    fill: Brush? = null,
    fillAlpha: Float = DefaultAlpha,
    stroke: Brush? = null,
    strokeAlpha: Float = DefaultAlpha,
    strokeLineWidth: Float = DefaultStrokeLineWidth,
    strokeLineCap: StrokeCap = DefaultStrokeLineCap,
    strokeLineJoin: StrokeJoin = DefaultStrokeLineJoin,
    strokeLineMiter: Float = DefaultStrokeLineMiter,
    pathBuilder: PathBuilder.() -> Unit
): VectorAssetBuilder

DSL extension for adding a VectorPath to this.

See VectorAssetBuilder.addPath for the corresponding builder function.

Parameters
name: String = DefaultPathName the name for this path
fill: Brush? = null specifies the Brush used to fill the path
fillAlpha: Float = DefaultAlpha the alpha to fill the path
stroke: Brush? = null specifies the Brush used to fill the stroke
strokeAlpha: Float = DefaultAlpha the alpha to stroke the path
strokeLineWidth: Float = DefaultStrokeLineWidth the width of the line to stroke the path
strokeLineCap: StrokeCap = DefaultStrokeLineCap specifies the linecap for a stroked path
strokeLineJoin: StrokeJoin = DefaultStrokeLineJoin specifies the linejoin for a stroked path
strokeLineMiter: Float = DefaultStrokeLineMiter specifies the miter limit for a stroked path
pathBuilder: PathBuilder.() -> Unit PathBuilder lambda for adding PathNodes to this path.