RemoteImageVector.Builder

class 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 ImageVector before it is composed through The generated ImageVector 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: BlendMode,
    autoMirror: Boolean
)

Create a Builder with default dimensions matching viewportWidth and viewportHeight.

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

Public functions

RemoteImageVector

Construct a ImageVector.

Extension functions

RemoteImageVector.Builder
RemoteImageVector.Builder.path(
    name: String,
    fill: Brush?,
    fillAlpha: RemoteFloat,
    stroke: Brush?,
    strokeAlpha: RemoteFloat,
    strokeLineWidth: RemoteFloat,
    strokeLineCap: StrokeCap,
    strokeLineJoin: StrokeJoin,
    strokeLineMiter: RemoteFloat,
    pathFillType: PathFillType,
    pathBuilder: RemotePathScope.() -> Unit
)

DSL extension for adding a RemoteVectorPath to this.

Public constructors

Builder

Added in 1.0.0-alpha20
Builder(
    viewportWidth: RemoteFloat,
    viewportHeight: RemoteFloat,
    tintColor: RemoteColor,
    name: String = DefaultGroupName,
    tintBlendMode: BlendMode = BlendMode.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: BlendMode = BlendMode.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

Added in 1.0.0-alpha20
Builder(
    defaultWidth: RemoteDp,
    defaultHeight: RemoteDp,
    viewportWidth: RemoteFloat,
    viewportHeight: RemoteFloat,
    tintColor: RemoteColor,
    name: String = DefaultGroupName,
    tintBlendMode: BlendMode = BlendMode.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: BlendMode = BlendMode.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

Added in 1.0.0-alpha20
fun build(): RemoteImageVector

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

Returns
RemoteImageVector

The newly created ImageVector instance

Extension functions

RemoteImageVector.Builder.path

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

DSL extension for adding a RemoteVectorPath to this.

Parameters
name: String = DefaultPathName

the name for this path

fill: Brush? = null

specifies the Brush used to fill the path

fillAlpha: RemoteFloat = 1.0f.rf

the alpha to fill the path

stroke: Brush? = null

specifies the Brush used to fill the stroke

strokeAlpha: RemoteFloat = 1.0f.rf

the alpha to stroke the path

strokeLineWidth: RemoteFloat = 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: RemoteFloat = DefaultStrokeLineMiter

specifies the miter limit for a stroked path

pathFillType: PathFillType = DefaultFillType

specifies the winding rule that decides how the interior of a Path is calculated.

pathBuilder: RemotePathScope.() -> Unit

RemotePathScope lambda for adding RemotePathNodes to this path.