androidx.ui.graphics.vector

Classes

GroupComponent

PathBuilder

PathComponent

PathNode

Represents a node within the path.

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

Enums

PathCommand

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

Unit
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

Unit
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)

Draw a vector graphic with the provided width, height and viewport dimensions

Unit
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)

Draw a vector graphic with the provided width, height and viewport dimensions

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

List<PathNode>
addPathNodes(pathStr: String?)

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

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

Top-level properties summary

StrokeCap

StrokeJoin

BlendMode

Color

List<PathNode>

Extension functions summary

For java.lang.StringBuilder
operator StringBuilder

For kotlin.Char
PathCommand

Return the corresponding PathCommand for the given character key if it exists.

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)

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

DrawVector

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

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
): Unit

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
): Unit

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

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
): Unit

disposeVector

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

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

plus

operator fun StringBuilder.plus(node: PathNode): StringBuilder

toPathCommand

fun Char.toPathCommand(): PathCommand

Return the corresponding PathCommand for the given character key if it exists. If the key is unknown then IllegalArgumentException is thrown

Return
PathCommand that matches the key