{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

VectorPainterKt

public final class VectorPainterKt


Summary

Constants

static final @NonNull String

Default identifier for the root group if a Vector graphic

Public methods

static final void

Recursively creates the vector graphic composition by traversing the tree structure.

static final @NonNull VectorPainter

Create a VectorPainter with the given ImageVector.

static final @NonNull VectorPainter
@Composable
@ComposableOpenTarget(index = -1)
rememberVectorPainter(
    @NonNull Dp defaultWidth,
    @NonNull Dp defaultHeight,
    float viewportWidth,
    float viewportHeight,
    @NonNull String name,
    @NonNull Color tintColor,
    @NonNull BlendMode tintBlendMode,
    @Composable @VectorComposable @NonNull Function2<@NonNull Float, @NonNull FloatUnit> content
)

This method is deprecated. Replace rememberVectorPainter graphicsLayer that consumes the auto mirror flag

static final @NonNull VectorPainter
@Composable
@ComposableOpenTarget(index = -1)
rememberVectorPainter(
    @NonNull Dp defaultWidth,
    @NonNull Dp defaultHeight,
    float viewportWidth,
    float viewportHeight,
    @NonNull String name,
    @NonNull Color tintColor,
    @NonNull BlendMode tintBlendMode,
    boolean autoMirror,
    @Composable @VectorComposable @NonNull Function2<@NonNull Float, @NonNull FloatUnit> content
)

Create a VectorPainter with the Vector defined by the provided sub-composition.

Constants

RootGroupName

public static final @NonNull String RootGroupName

Default identifier for the root group if a Vector graphic

Public methods

RenderVectorGroup

@Composable
public static final void RenderVectorGroup(
    @NonNull VectorGroup group,
    @NonNull Map<@NonNull String, @NonNull VectorConfig> configs
)

Recursively creates the vector graphic composition by traversing the tree structure.

Parameters
@NonNull VectorGroup group

The vector group to render.

@NonNull Map<@NonNull String, @NonNull VectorConfig> configs

An optional map of VectorConfig to provide animation values. The keys are the node names. The values are VectorConfig for that node.

rememberVectorPainter

@Composable
public static final @NonNull VectorPainter rememberVectorPainter(@NonNull ImageVector image)

Create a VectorPainter with the given ImageVector. This will create a sub-composition of the vector hierarchy given the tree structure in ImageVector

Parameters
@NonNull ImageVector image

ImageVector used to create a vector graphic sub-composition

rememberVectorPainter

@Composable
@ComposableOpenTarget(index = -1)
public static final @NonNull VectorPainter rememberVectorPainter(
    @NonNull Dp defaultWidth,
    @NonNull Dp defaultHeight,
    float viewportWidth,
    float viewportHeight,
    @NonNull String name,
    @NonNull Color tintColor,
    @NonNull BlendMode tintBlendMode,
    @Composable @VectorComposable @NonNull Function2<@NonNull Float, @NonNull FloatUnit> content
)

Create a VectorPainter with the Vector defined by the provided sub-composition

Parameters
@NonNull Dp defaultWidth

Intrinsic width of the Vector in Dp

@NonNull Dp defaultHeight

Intrinsic height of the Vector in Dp

viewportWidth: float

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 pixels

viewportHeight: float

Height 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 defaultHeight converted to pixels

@NonNull String name

optional identifier used to identify the root of this vector graphic

@NonNull Color tintColor

optional color used to tint the root group of this vector graphic

@NonNull BlendMode tintBlendMode

BlendMode used in combination with tintColor

@Composable @VectorComposable @NonNull Function2<@NonNull Float, @NonNull FloatUnit> content

Composable used to define the structure and contents of the vector graphic

rememberVectorPainter

@Composable
@ComposableOpenTarget(index = -1)
public static final @NonNull VectorPainter rememberVectorPainter(
    @NonNull Dp defaultWidth,
    @NonNull Dp defaultHeight,
    float viewportWidth,
    float viewportHeight,
    @NonNull String name,
    @NonNull Color tintColor,
    @NonNull BlendMode tintBlendMode,
    boolean autoMirror,
    @Composable @VectorComposable @NonNull Function2<@NonNull Float, @NonNull FloatUnit> content
)

Create a VectorPainter with the Vector defined by the provided sub-composition.

Inside content use the Group and Path composables to define the vector.

Parameters
@NonNull Dp defaultWidth

Intrinsic width of the Vector in Dp

@NonNull Dp defaultHeight

Intrinsic height of the Vector in Dp

viewportWidth: float

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 pixels

viewportHeight: float

Height 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 defaultHeight converted to pixels

@NonNull String name

optional identifier used to identify the root of this vector graphic

@NonNull Color tintColor

optional color used to tint the root group of this vector graphic

@NonNull BlendMode tintBlendMode

BlendMode used in combination with tintColor

@Composable @VectorComposable @NonNull Function2<@NonNull Float, @NonNull FloatUnit> content

Composable used to define the structure and contents of the vector graphic