RemoteImageVector.Builder


Builder used to construct a Vector graphic tree. This is useful for caching the result of expensive operations used to construct a vector graphic for compose. For example, the vector graphic could be serialized and downloaded from a server and represented internally in a RemoteImageVector before it is composed through The generated RemoteImageVector is recommended to be memoized across composition calls to avoid doing redundant work

Summary

Public constructors

Builder(
    viewportWidth: RemoteFloat,
    viewportHeight: RemoteFloat,
    tintColor: RemoteColor,
    name: String,
    tintBlendMode: RemoteBlendMode,
    autoMirror: Boolean
)

Create a Builder with default dimensions matching viewportWidth and viewportHeight.

android
Builder(
    defaultWidth: RemoteDp,
    defaultHeight: RemoteDp,
    viewportWidth: RemoteFloat,
    viewportHeight: RemoteFloat,
    tintColor: RemoteColor,
    name: String,
    tintBlendMode: RemoteBlendMode,
    autoMirror: Boolean
)
android

Public functions

RemoteImageVector

Construct a RemoteImageVector.

android

Extension functions

RemoteImageVector.Builder
RemoteImageVector.Builder.path(
    name: String,
    fill: RemoteBrush?,
    fillAlpha: RemoteFloat,
    stroke: RemoteBrush?,
    strokeAlpha: RemoteFloat,
    strokeLineWidth: RemoteFloat,
    strokeLineCap: RemoteStrokeCap,
    strokeLineJoin: RemoteStrokeJoin,
    strokeLineMiter: RemoteFloat,
    pathFillType: RemotePathFillType,
    pathBuilder: RemotePathScope.() -> Unit
)

Adds a path to this RemoteImageVector.Builder.

android

Public constructors

Builder

Builder(
    viewportWidth: RemoteFloat,
    viewportHeight: RemoteFloat,
    tintColor: RemoteColor,
    name: String = DefaultGroupName,
    tintBlendMode: RemoteBlendMode = RemoteBlendMode.SrcIn,
    autoMirror: Boolean = false
)

Create a Builder with default dimensions matching viewportWidth and viewportHeight.

Parameters
viewportWidth: RemoteFloat

Used to define the width of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.

viewportHeight: RemoteFloat

Used to define the height of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.

tintColor: RemoteColor

Optional color used to tint the entire vector image

name: String = DefaultGroupName

Name of the vector asset

tintBlendMode: RemoteBlendMode = RemoteBlendMode.SrcIn

Blend mode used to apply the tint color

autoMirror: Boolean = false

Determines if the vector asset should automatically be mirrored for right to left locales

Builder

Builder(
    defaultWidth: RemoteDp,
    defaultHeight: RemoteDp,
    viewportWidth: RemoteFloat,
    viewportHeight: RemoteFloat,
    tintColor: RemoteColor,
    name: String = DefaultGroupName,
    tintBlendMode: RemoteBlendMode = RemoteBlendMode.SrcIn,
    autoMirror: Boolean = false
)
Parameters
defaultWidth: RemoteDp

The default width of the vector asset in RemoteDp

defaultHeight: RemoteDp

The default height of the vector asset in RemoteDp

viewportWidth: RemoteFloat

Used to define the width of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.

viewportHeight: RemoteFloat

Used to define the height of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.

tintColor: RemoteColor

Optional color used to tint the entire vector image

name: String = DefaultGroupName

Name of the vector asset

tintBlendMode: RemoteBlendMode = RemoteBlendMode.SrcIn

Blend mode used to apply the tint color

autoMirror: Boolean = false

Determines if the vector asset should automatically be mirrored for right to left locales

Public functions

build

fun build(): RemoteImageVector

Construct a RemoteImageVector. This concludes the creation process of a RemoteImageVector graphic This builder cannot be re-used to create additional RemoteImageVector instances

Returns
RemoteImageVector

The newly created RemoteImageVector instance

Extension functions

RemoteImageVector.Builder.path

fun RemoteImageVector.Builder.path(
    name: String = DefaultPathName,
    fill: RemoteBrush? = null,
    fillAlpha: RemoteFloat = 1.0f.rf,
    stroke: RemoteBrush? = null,
    strokeAlpha: RemoteFloat = 1.0f.rf,
    strokeLineWidth: RemoteFloat = DefaultStrokeLineWidth,
    strokeLineCap: RemoteStrokeCap = DefaultStrokeLineCap,
    strokeLineJoin: RemoteStrokeJoin = DefaultStrokeLineJoin,
    strokeLineMiter: RemoteFloat = DefaultStrokeLineMiter,
    pathFillType: RemotePathFillType = DefaultFillType,
    pathBuilder: RemotePathScope.() -> Unit
): RemoteImageVector.Builder

Adds a path to this RemoteImageVector.Builder.

Parameters
name: String = DefaultPathName

name for this path

fill: RemoteBrush? = null

RemoteBrush used to fill the path

fillAlpha: RemoteFloat = 1.0f.rf

alpha to fill the path

stroke: RemoteBrush? = null

RemoteBrush used to stroke the path

strokeAlpha: RemoteFloat = 1.0f.rf

alpha to stroke the path

strokeLineWidth: RemoteFloat = DefaultStrokeLineWidth

width of the line to stroke the path

strokeLineCap: RemoteStrokeCap = DefaultStrokeLineCap

RemoteStrokeCap for a stroked path

strokeLineJoin: RemoteStrokeJoin = DefaultStrokeLineJoin

RemoteStrokeJoin for a stroked path

strokeLineMiter: RemoteFloat = DefaultStrokeLineMiter

miter limit for a stroked path

pathFillType: RemotePathFillType = DefaultFillType

RemotePathFillType winding rule that decides how the interior of a path is calculated

pathBuilder: RemotePathScope.() -> Unit

RemotePathScope lambda for drawing commands in this path

Returns
RemoteImageVector.Builder

this RemoteImageVector.Builder instance for chaining calls