SvgRootNode

Represents the root node of an SVG document.

This class holds information about the SVG's dimensions, viewBox, and other attributes. It also manages child nodes and provides access to definitions and gradients.

Constructors

Link copied to clipboard
constructor(parent: XmlParentNode, children: MutableSet<XmlNode>, attributes: MutableMap<String, String>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val attributes: MutableMap<String, String>
Link copied to clipboard
open override val children: MutableSet<XmlNode>

The set of child nodes of this node.

Link copied to clipboard
open override val className: String?
Link copied to clipboard
Link copied to clipboard
protected open override val constructor: (parent: XmlParentNode, children: MutableSet<XmlNode>, attributes: MutableMap<String, String>) -> SvgRootNode
Link copied to clipboard

A map of definitions (elements with an ID) within the SVG. Used for referencing elements by ID, primarily for elements.

Link copied to clipboard
var fill: String?

The fill-color of the SVG.

Link copied to clipboard

A map of gradients defined within the SVG. Used for applying gradients to elements.

Link copied to clipboard
Link copied to clipboard
open override val id: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val style: String?
Link copied to clipboard
Link copied to clipboard
open override val tagName: String
Link copied to clipboard
open override val transform: SvgTransform?

The transform applied to the entire SVG. If the SVG has a viewBox with an offset (x or y not 0), a translation is automatically applied to compensate for the offset.

Link copied to clipboard

The viewBox attribute defines the position and dimension, in user space, of an SVG viewport.

Link copied to clipboard

The height of the SVG's viewport, derived from the viewBox attribute.

Link copied to clipboard

The width of the SVG's viewport, derived from the viewBox attribute.

Link copied to clipboard

The Min-X coordinate of the SVG's viewport, derived from the viewBox attribute.

Link copied to clipboard

The Min-Y coordinate of the SVG's viewport, derived from the viewBox attribute.

Link copied to clipboard

Functions

Link copied to clipboard
context(logger: Logger)
fun <T : SvgNode, XmlParentNode> SvgElementNode<T>.asNodes(computedRules: List<ComputedRule>, minified: Boolean): List<ImageVectorNode>

context(logger: Logger)
fun SvgNode.asNodes(computedRules: List<ComputedRule>, masks: List<SvgMaskNode>, minified: Boolean): List<ImageVectorNode>?

Converts the SVG node to a list of ImageVectorNode.

Link copied to clipboard
Link copied to clipboard
open fun copy(parent: XmlParentNode?, children: MutableSet<SvgNode>?, attributes: Map<String, String>?): SvgRootNode
Link copied to clipboard

Normalizes an id by removing prefixes and suffixes commonly used in SVGs.

Link copied to clipboard
open fun resolveAttributesFromStyle(computedRules: List<ComputedRule>)
Link copied to clipboard
Link copied to clipboard

Calculates the stacked transform of the node by traversing up the tree and concatenating the transform attributes of the ancestors.

Link copied to clipboard
open override fun toJsString(extra: StringBuilder.() -> Unit?): String
Link copied to clipboard
open override fun toString(): String