SvgDecoder

class SvgDecoder(    source: ImageSource,     options: Options,     val parser: Svg.Parser = Svg.Parser.DEFAULT,     val density: PlatformContext.() -> Float = NO_DENSITY,     val useViewBoundsAsIntrinsicSize: Boolean = true,     val renderToBitmap: Boolean = true) : Decoder

A Decoder that decodes SVGs. Relies on external dependencies to parse and decode the SVGs.

Parameters

parser

An Svg.Parser that converts bytes into an Svg. This property can be used to replace the default SVG parser with a different library.

density

A function whose return value will be used to scale the output dimensions of the image if the target size is Size.ORIGINAL.

useViewBoundsAsIntrinsicSize

If true, uses the SVG's view bounds as the intrinsic size for the SVG. If false, uses the SVG's width/height as the intrinsic size for the SVG.

renderToBitmap

If true, renders the SVG to a bitmap immediately after decoding. Else, the SVG will be rendered at draw time. Rendering at draw time is more memory efficient, but depending on the complexity of the SVG, can be slow.

Constructors

Link copied to clipboard
constructor(    source: ImageSource,     options: Options,     useViewBoundsAsIntrinsicSize: Boolean = true,     renderToBitmap: Boolean = true,     scaleToDensity: Boolean = false)
constructor(    source: ImageSource,     options: Options,     parser: Svg.Parser = Svg.Parser.DEFAULT,     density: PlatformContext.() -> Float = NO_DENSITY,     useViewBoundsAsIntrinsicSize: Boolean = true,     renderToBitmap: Boolean = true)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Factory(    val parser: Svg.Parser = Svg.Parser.DEFAULT,     val density: PlatformContext.() -> Float = NO_DENSITY,     val useViewBoundsAsIntrinsicSize: Boolean = true,     val renderToBitmap: Boolean = true) : Decoder.Factory

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun decode(): DecodeResult