SvgDecoder

class SvgDecoder(source: ImageSource, options: Options, val useViewBoundsAsIntrinsicSize: Boolean = true, val renderToBitmap: Boolean = true, val scaleToDensity: Boolean = false) : Decoder

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

Parameters

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.

scaleToDensity

If true and the target size is Size.ORIGINAL, multiplies the source dimensions of the image by the device's display density. NOTE: This only affects Android.

Constructors

Link copied to clipboard
constructor(source: ImageSource, options: Options, useViewBoundsAsIntrinsicSize: Boolean = true, renderToBitmap: Boolean = true, scaleToDensity: Boolean = false)

Types

Link copied to clipboard
class Factory(val useViewBoundsAsIntrinsicSize: Boolean = true, val renderToBitmap: Boolean = true, val scaleToDensity: Boolean = false) : Decoder.Factory

Properties

Link copied to clipboard
Link copied to clipboard
val scaleToDensity: Boolean = false

Functions

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