Composition

class Composition(root: CompositionNode, bounds: CompositionDimensions)

A vector composition.

Parameters

root

the root node of the composition

bounds

the dimensions of the composition

Constructors

Composition
Link copied to clipboard
common
fun Composition(root: CompositionNode, bounds: Rectangle)
Composition
Link copied to clipboard
common
fun Composition(root: CompositionNode, bounds: CompositionDimensions = defaultCompositionDimensions)

Functions

calculateViewportTransform
Link copied to clipboard
common
fun calculateViewportTransform(): Matrix44

Calculates effective viewport transformation using viewBox and preserveAspectRatio. As per the SVG 2.0 spec.

clear
Link copied to clipboard
common
fun clear(): Unit?
findGroup
Link copied to clipboard
common
fun findGroup(id: String): GroupNode?
findGroups
Link copied to clipboard
common
fun findGroups(): List<GroupNode>
findImage
Link copied to clipboard
common
fun findImage(id: String): ImageNode?
findImages
Link copied to clipboard
common
fun findImages(): List<ImageNode>
findShape
Link copied to clipboard
common
fun findShape(id: String): ShapeNode?
findShapes
Link copied to clipboard
common
fun findShapes(): List<ShapeNode>

Properties

bounds
Link copied to clipboard
common
var bounds: CompositionDimensions
documentStyle
Link copied to clipboard
common
var documentStyle: DocumentStyle

The style attributes affecting the whole document, such as the viewBox area and aspect ratio.

namespaces
Link copied to clipboard
common
val namespaces: MutableMap<String, String>

SVG/XML namespaces

root
Link copied to clipboard
common
val root: CompositionNode
style
Link copied to clipboard
common
var style: Style

Extensions

draw
Link copied to clipboard
fun Composition.draw(drawFunction: CompositionDrawer.() -> Unit)

Draw into an existing Composition.