Donner
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::components Namespace Reference

Contains the implementation of the Donner ECS,. More...

Namespaces

namespace  filter_primitive
 Variant holding the parameters for each type of filter primitive.

Classes

struct  ClassComponent
 Holds the value of the class attribute of an element. More...
struct  ComputedClipPathsComponent
 Stores a computed clip path, which is used to clip the rendering of an entity. More...
struct  DirtyFlagsComponent
 Tracks which computed properties are stale and need recomputation after a DOM mutation. More...
struct  RenderTreeState
 Global invalidation state, stored in the registry context via Registry::ctx(). More...
class  ElementTypeComponent
 Stores the parsed element type of the current entity. More...
struct  EvaluatedReferenceComponent
 Represents a reference to another entity which has been evaluated from a Reference string. More...
struct  FilterComponent
 Parameters for a "<filter>" element. More...
struct  ComputedFilterComponent
 Computed filter parameters parsed by FilterSystem, represents the resolved DOM hierarchy of a "<filter>" element. More...
struct  FilterInput
 Identifies the input to a filter primitive node. More...
struct  FilterNode
 A single node in the filter graph, representing one filter primitive. More...
struct  FilterGraph
 The complete filter graph for a <filter> element. More...
struct  FilterPrimitiveComponent
 Parameters for SVGFilterPrimitiveStandardAttributes. More...
struct  FEGaussianBlurComponent
 Parameters for SVGFEGaussianBlurElement. More...
struct  FEFloodComponent
 Parameters for SVGFEFloodElement. More...
struct  FEOffsetComponent
 Parameters for SVGFEOffsetElement. More...
struct  FECompositeComponent
 Parameters for SVGFECompositeElement. More...
struct  FEColorMatrixComponent
 Parameters for SVGFEColorMatrixElement. More...
struct  FEBlendComponent
 Parameters for SVGFEBlendElement. More...
struct  FEDropShadowComponent
 Parameters for SVGFEDropShadowElement. More...
struct  FEComponentTransferComponent
 Marker component for SVGFEComponentTransferElement. More...
struct  FEFuncComponent
 Parameters for a feFuncR/G/B/A child element within feComponentTransfer. More...
struct  FEConvolveMatrixComponent
 Parameters for SVGFEConvolveMatrixElement. More...
struct  FEMorphologyComponent
 Parameters for SVGFEMorphologyElement. More...
struct  FETileComponent
 Marker component for SVGFETileElement. More...
struct  FEImageComponent
 Parameters for SVGFEImageElement. More...
struct  FEDisplacementMapComponent
 Parameters for SVGFEDisplacementMapElement. More...
struct  FETurbulenceComponent
 Parameters for SVGFETurbulenceElement. More...
struct  FEMergeComponent
 Marker component for SVGFEMergeElement. More...
struct  FEMergeNodeComponent
 Parameters for a feMergeNode child element within feMerge. More...
struct  LightSourceComponent
 Light source parameters, stored on feDistantLight, fePointLight, or feSpotLight child elements. More...
struct  FEDiffuseLightingComponent
 Parameters for SVGFEDiffuseLightingElement. More...
struct  FESpecularLightingComponent
 Parameters for SVGFESpecularLightingElement. More...
class  FilterSystem
 Handles parsing and instantiating SVG filter effects from the SVG DOM. More...
struct  IdComponent
 Holds the value of the id attribute of an element. More...
class  LayoutSystem
 Handles layout and bounds calculations for SVG elements. More...
struct  SizedElementProperties
 Stores an offset/size for elements that are positioned with x/y/width/height attributes with respect to their parent. More...
struct  SizedElementComponent
 Stores the properties of a sized element, x, y, width, height. More...
struct  ComputedSizedElementComponent
 Stores the computed bounds of a sized element, resolving units and percentages. More...
struct  ComputedShadowSizedElementComponent
 Stores a shadow tree's computed SizedElementComponent, where a "<use>" element overrides the width or height on "<symbol>" or "<svg>" which use SizedElementComponent. More...
struct  SymbolComponent
 Stores unique parameters for the "<symbol>" element. More...
struct  TransformComponent
 Stores the raw transform value set on an entity, for the transform presentation attribute. More...
struct  ComputedLocalTransformComponent
 Stores the computed transform value for an entity, relative to the parent. More...
struct  ComputedAbsoluteTransformComponent
 Stores the computed transform value for an entity, relative to the world. More...
struct  ViewBoxComponent
 A component attached to entities that have a viewBox attribute, such as "<svg>" and "<pattern>". More...
struct  ComputedViewBoxComponent
 Computed value of a viewBox for the current element. More...
struct  ClipPathComponent
 Parameters for the "<clipPath>" element. More...
struct  GradientComponent
 Common parameters for gradient elements, "<linearGradient>" and "<radialGradient>". More...
struct  ComputedGradientComponent
 Created by PaintSystem during render tree instantiation. More...
struct  LinearGradientComponent
 Parameters for a "<linearGradient>" element. More...
struct  ComputedLinearGradientComponent
 Computed properties for a "<linearGradient>" element. More...
struct  MarkerComponent
 Stores the marker data for an SVG element. More...
struct  MaskComponent
 Parameters for the "<mask>" element. More...
class  PaintSystem
 Manages Paint Servers for gradients and patterns, handling style and structural inheritance and creating "computed" state and shadow trees for these elements. More...
struct  PatternComponent
 Parameters for "<pattern>" elements which are not captured by ViewBoxComponent and SizedElementComponent. More...
struct  ComputedPatternComponent
 Computed properties for "<pattern>" elements, after resolving and inheriting values from referenced patterns. More...
struct  RadialGradientComponent
 Parameters for a "<radialGradient>" element. More...
struct  ComputedRadialGradientComponent
 Computed properties for a "<radialGradient>" element. More...
struct  StopProperties
 Parameters for a "<stop>" element. More...
struct  ComputedStopComponent
 Stores the computed properties of a "<stop>" element. More...
struct  StopComponent
 Stores the properties of a "<stop>" element. More...
struct  PathLengthComponent
 Stores a user-overridden path length on an element. More...
struct  PreserveAspectRatioComponent
 Stores the preserveAspectRatio attribute of "<svg>" and "<pattern>". More...
struct  RenderingBehaviorComponent
 Component that controls how the attached element is rendered, determines how different element types are rendered. More...
struct  SubtreeInfo
 Created on the start of a subtree, to inform the renderer about which element ends the current subtree, plus how many isolated layers need to be popped when the subtree is complete. More...
struct  PaintResolvedReference
 Contains rendering information for a paint server, such as the subtree needed if it establishes an isolated layer, and where the paint server is located. More...
struct  ResolvedClipPath
 Contains resolved information about the clip-path property, such as which element it is pointing to. More...
struct  ResolvedMask
 Contains resolved information about the mask property, such as which element it is pointing to. More...
struct  ResolvedMarker
struct  RenderingInstanceComponent
 An instance of the entity in the rendering tree. More...
struct  FontResource
 In-memory representation of a font resource, containing the parsed WOFF data. More...
struct  ImageComponent
 Parameters for the "<image>" element. More...
struct  LoadedImageComponent
 Loaded raster image resource, created from a ImageComponent when the href references a raster image (PNG, JPEG, GIF). More...
struct  LoadedSVGImageComponent
 Loaded SVG sub-document, created from a ImageComponent when the href references an SVG file (image/svg+xml). More...
struct  ExternalUseComponent
 Loaded external SVG sub-document referenced by a <use> element. More...
class  ResourceManagerContext
 Resource manager, which handles loading resources from URLs and caching results. More...
class  SubDocumentCache
 Cache for parsed SVG sub-documents referenced by <image> or <use> elements. More...
struct  ComputedShadowTreeComponent
 An instantiated ShadowTreeComponent, which points to the roots of parallel entity trees. More...
class  OffscreenShadowTreeComponent
 Defines an offscreen shadow tree attached to the current entity (the shadow host). More...
struct  ShadowEntityComponent
 A component attached to entities in the shadow tree, indicating which light entity they are mirroring. More...
struct  ShadowTreeRootComponent
 Indicates root of an instantiated shadow tree, where the light entity is is the target of the href, e.g. More...
class  ShadowTreeComponent
 Indicates the entry point to a shadow tree, which instantiates a virtual tree of entities mirroring another entity's tree. More...
class  ShadowTreeSystem
 Instantiates shadow trees for elements that are not part of the main render graph, such as "<use>" and "<pattern>" elements. More...
struct  CircleProperties
 Properties for a "<circle>" element. More...
struct  ComputedCircleComponent
 Computed properties for a "<circle>" element, which applies values from the CSS cascade. More...
struct  CircleComponent
 Parameters for a "<circle>" element. More...
struct  ComputedPathComponent
 Stores a Path used for rendering a shape, which may be generated from the parameters of shapes such as circle, rect, line, poly, and path. More...
struct  EllipseProperties
 Parameters for a "<ellipse>" element. More...
struct  ComputedEllipseComponent
 Computed properties for a "<ellipse>" element, which applies values from the CSS cascade. More...
struct  EllipseComponent
 Parameters for a "<ellipse>" element. More...
struct  LineComponent
 Parameters for a "<line>" element. More...
struct  PathComponent
 Parameters for a "<path>" element. More...
struct  PolyComponent
 Parameters for a "<polygon>" or "<polyline>" element. More...
struct  RectProperties
 Parameters for a "<rect>" element. More...
struct  ComputedRectComponent
 Computed properties for a "<rect>" element, which applies values from the CSS cascade. More...
struct  RectComponent
 Parameters for a "<rect>" element. More...
class  ShapeSystem
 Creates computed path for shapes such as "<circle>", "<line>", and "<path>". More...
struct  ComputedStyleComponent
 Contains the computed style properties for an element, which is a combination of the style="" attribute, the CSS stylesheet, and the CSS cascade where properties are inherited from the parent. More...
struct  DoNotInheritFillOrStrokeTag
 This component is added to entities to indicate that 'fill' and 'stroke' attributes should not be inherited, which is used for "<pattern>" because it establishes a shadow tree, and we do not want to recursively inherit 'fill' or 'stroke' values into the children. More...
struct  StyleComponent
 Contains properties the style="" attribute for an element, local to the element. More...
class  StyleSystem
 Computes stylesheet information for elements, applying the CSS cascade and inheritance rules. More...
struct  StylesheetComponent
 Data for a "<style>" element. More...
class  SVGDocumentContext
 Holds global state of an SVG document, such as the root element, id-to-element mapping, and the document size. More...
struct  ComputedTextComponent
 Pre‑computed layout information for a text subtree. More...
struct  ComputedTextGeometryComponent
 Cached geometry for text layout and text-derived public API queries. More...
struct  TextComponent
 Defines the start of a text element, which may have other text elements as children. More...
struct  TextPathComponent
 Stores attributes specific to "<textPath>" elements. More...
struct  TextPositioningComponent
 Defines the positioning of a text element, which may have other text elements as children. More...
struct  TextRootComponent
 Defines the start of a text element, which may have other text elements as children. More...
class  TextSystem
 System to compute text layout spans from raw text and positioning attributes. More...
class  RenderingContext
 Rendering controller, which instantiates and and manages the rendering tree. More...

Typedefs

using FilterPrimitive
 Variant holding any filter primitive type.
using ResolvedPaintServer
 The resolved paint server for a fill or stroke.
using ResolvedFilterEffect = std::variant<std::vector<FilterEffect>, ResolvedReference>
 The resolved filter effect for a filter.
using ShadowSizedElementHandler
 Type definition for a callback to process sized elements.

Enumerations

enum class  FilterStandardInput : std::uint8_t {
  SourceGraphic ,
  SourceAlpha ,
  FillPaint ,
  StrokePaint
}
 Standard named inputs available to filter primitives. More...
enum class  RenderingBehavior {
  Default ,
  Nonrenderable ,
  NoTraverseChildren ,
  ShadowOnlyChildren
}
 Controls how the attached element is rendered, determines how different element types are rendered. More...
enum class  ShadowBranchType {
  Main ,
  OffscreenFill ,
  OffscreenStroke ,
  OffscreenMask ,
  OffscreenMarkerStart ,
  OffscreenMarkerMid ,
  OffscreenMarkerEnd ,
  OffscreenFeImage
}
 There are two types of shadow trees: More...
enum class  TextPathMethod {
  Align ,
  Stretch
}
 Method for placing glyphs along a path in "<textPath>". More...
enum class  TextPathSide {
  Left ,
  Right
}
 Which side of the path to render text in "<textPath>". More...
enum class  TextPathSpacing {
  Auto ,
  Exact
}
 Spacing mode for "<textPath>". More...

Functions

ParseResult< bool > ParseFeFloodPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
ParseResult< bool > ParseFeDropShadowPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
ParseResult< bool > ParseFeDiffuseLightingPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
ParseResult< bool > ParseFeSpecularLightingPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
ParseResult< bool > ParseSizedElementPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
 Parse presentation attributes for sized elements (SVG, Use, Image), such as x, y, width, height.
ParseResult< bool > ParseStopPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
 Parse presentation attributes for a "<stop>" element, such as stop-color and stop-opacity.
bool HasPaint (const ResolvedPaintServer &paint)
 Returns true if the paint server is not a PaintServer::None.
ParseResult< bool > ParseCirclePresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
 Parse presentation attributes for a "<circle>" element, such as cx, cy, r.
ParseResult< bool > ParseEllipsePresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
 Parse presentation attributes for a "<ellipse>" element, such as cx, cy, rx, ry.
ParseResult< bool > ParseRectPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
 Parse presentation attributes for a "<rect>" element, such as x, y, width, height, rx, ry.
ParseResult< bool > ParsePathPresentationAttribute (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams &params)
 Parse presentation attributes for a "<path>" element (the "d" attribute).

Detailed Description

Contains the implementation of the Donner ECS,.

See also
Entity Component System (ECS).

Classes are named as follows:

  • *System - Stateless object that accesses and manipulates components.
  • *Component - Data storage struct with minimal logic, which may be attached to an Entity.
  • Computed*Component - Created when processing the tree and preparing it for rendering, stores intermediate object state derived from regular components. Is used to apply the CSS cascade and to cache shape path data.
  • *Context - Contains global state of an SVG document, which are stored in the Registry::ctx().
  • *Tag - Used to tag an entity with a specific purpose, like to disable rendering behavior (like inheritance with DoNotInheritFillOrStrokeTag).

Class Documentation

◆ donner::svg::components::ClassComponent

struct donner::svg::components::ClassComponent

Holds the value of the class attribute of an element.

Collaboration diagram for donner::svg::components::ClassComponent:
[legend]
Class Members
RcString className The value of the class attribute.

◆ donner::svg::components::ComputedClipPathsComponent

struct donner::svg::components::ComputedClipPathsComponent

Stores a computed clip path, which is used to clip the rendering of an entity.

Aggregates together all paths that compose a clip path, including nested clip paths.

Collaboration diagram for donner::svg::components::ComputedClipPathsComponent:
[legend]
Class Members
vector< ClipPath > clipPaths All clip paths, in order they need to be applied based on their layer.

◆ donner::svg::components::RenderTreeState

struct donner::svg::components::RenderTreeState

Global invalidation state, stored in the registry context via Registry::ctx().

Tracks whether a full render tree rebuild is required (e.g., after setTime() or setCanvasSize()), separate from per-entity dirty flags.

Class Members
bool hasBeenBuilt = false True if the render tree has been built at least once.
bool needsFullRebuild = true True if the render tree needs a full rebuild (structure changed, canvas resized, etc.).
bool needsFullStyleRecompute = true True if styles must be recomputed for the whole tree because selector dependencies may be non-local (for example class/id/attribute changes or tree mutations).

◆ donner::svg::components::EvaluatedReferenceComponent

struct donner::svg::components::EvaluatedReferenceComponent
template<typename ReferenceType>
struct donner::svg::components::EvaluatedReferenceComponent< ReferenceType >

Represents a reference to another entity which has been evaluated from a Reference string.

This is used by PaintSystem for gradients and patterns which have an href attribute for inheritance.

Template Parameters
ReferenceTypetag which determines which subsystem the reference is for, used to avoid collisions.
Class Members
typedef ReferenceType Type ReferenceType Tag type of this reference.
Class Members
EntityHandle target The resolved target entity of the reference.

◆ donner::svg::components::FilterComponent

struct donner::svg::components::FilterComponent

Parameters for a "<filter>" element.

Contains the filter bounds, which determines how large the canvas needs to be when applying the filter, and filter configuration such as units for its parameters.

Class Members
optional< ColorInterpolationFilters > colorInterpolationFilters The parsed value of the "color-interpolation-filters" property, which specifies the color space for filter operations.
optional< FilterUnits > filterUnits The parsed value of the "filterUnits" attribute, which defines the coordinate system for the x, y, width, and height attributes of the mask.
optional< Lengthd > height Height of the filter, defaults to 120% (outside of the element itself).
optional< Reference > href An optional href to another filter, used to inherit attributes and primitive children.
optional< PrimitiveUnits > primitiveUnits The parsed value of the "primitiveUnits" attribute, which defines the coordinate system for the various attributes of the filter effects.
optional< Lengthd > width Width of the filter, defaults to 120% (outside of the element itself).
optional< Lengthd > x The x-coordinate of the filter, defaults to -10% (outside the element itself).
optional< Lengthd > y The y-coordinate of the filter, defaults to -10% (outside the element itself).

◆ donner::svg::components::ComputedFilterComponent

struct donner::svg::components::ComputedFilterComponent

Computed filter parameters parsed by FilterSystem, represents the resolved DOM hierarchy of a "<filter>" element.

Collaboration diagram for donner::svg::components::ComputedFilterComponent:
[legend]
Class Members
ColorInterpolationFilters colorInterpolationFilters = ColorInterpolationFilters::Default
vector< FilterEffect > effectChain Parsed list of effects for backward-compatibility with existing renderer push/pop interface. Will be removed once the graph-based renderer API is complete.
FilterGraph filterGraph The filter graph built from child filter primitives.
FilterUnits filterUnits = FilterUnits::Default The computed filter units.
Lengthd height = Lengthd(120.0, Lengthd::Unit::Percent) The computed height of the filter.
PrimitiveUnits primitiveUnits = PrimitiveUnits::Default The computed primitive units. The computed color interpolation mode for filter operations.
Lengthd width = Lengthd(120.0, Lengthd::Unit::Percent) The computed width of the filter.
Lengthd x = Lengthd(-10.0, Lengthd::Unit::Percent) The computed x-coordinate of the filter.
Lengthd y = Lengthd(-10.0, Lengthd::Unit::Percent) The computed y-coordinate of the filter.

◆ donner::svg::components::FilterNode

struct donner::svg::components::FilterNode

A single node in the filter graph, representing one filter primitive.

Nodes are executed in document order. Each node reads from its inputs (which may be standard inputs like SourceGraphic, or outputs of prior nodes), applies its primitive operation, and writes to an output buffer.

Collaboration diagram for donner::svg::components::FilterNode:
[legend]
Class Members
optional< ColorInterpolationFilters > colorInterpolationFilters Per-primitive color-interpolation-filters. When set, overrides the graph-level default.
optional< Lengthd > height Primitive subregion height.
vector< FilterInput > inputs Input(s) to this primitive.
FilterPrimitive primitive The filter primitive operation.
optional< RcString > result Named output (for result attribute).
optional< Lengthd > width Primitive subregion width.
optional< Lengthd > x Primitive subregion X.
optional< Lengthd > y Primitive subregion Y.

◆ donner::svg::components::FilterPrimitiveComponent

struct donner::svg::components::FilterPrimitiveComponent
Class Members
optional< Lengthd > height The height of the filter region.
optional< FilterInput > in The input specification for this filter primitive. Parsed from the in attribute. When nullopt, defaults to Previous (output of preceding primitive, or SourceGraphic for the first).
optional< FilterInput > in2 The second input specification for two-input primitives (e.g., feComposite, feBlend). Parsed from the in2 attribute.
optional< RcString > result Name of the filter primitive, which enables it to be used as a reference for subsequent filter primitives under the same "<filter>" element.
optional< Lengthd > width The width of the filter region.
optional< Lengthd > x The x-coordinate of the filter region.
optional< Lengthd > y The y-coordinate of the filter region.

◆ donner::svg::components::FEFloodComponent

struct donner::svg::components::FEFloodComponent

Parameters for SVGFEFloodElement.

Collaboration diagram for donner::svg::components::FEFloodComponent:
[legend]
Class Members
Property< Color > floodColor The flood fill color, defaults to black.
Property< double > floodOpacity The flood fill opacity, defaults to 1. Range is [0, 1].

◆ donner::svg::components::FEOffsetComponent

struct donner::svg::components::FEOffsetComponent

Parameters for SVGFEOffsetElement.

Class Members
double dx = 0.0 The horizontal offset.
double dy = 0.0 The vertical offset.

◆ donner::svg::components::FEDropShadowComponent

struct donner::svg::components::FEDropShadowComponent

Parameters for SVGFEDropShadowElement.

Collaboration diagram for donner::svg::components::FEDropShadowComponent:
[legend]
Class Members
double dx = 2.0 Horizontal offset.
double dy = 2.0 Vertical offset.
Property< Color > floodColor The flood fill color, defaults to black.
Property< double > floodOpacity The flood fill opacity, defaults to 1.
double stdDeviationX = 2.0 Blur standard deviation in X.
double stdDeviationY = 2.0 Blur standard deviation in Y.

◆ donner::svg::components::FEComponentTransferComponent

struct donner::svg::components::FEComponentTransferComponent

Marker component for SVGFEComponentTransferElement.

The element itself has no parameters; its children (feFuncR/G/B/A) define the transfer functions for each channel.

Class Members
int placeholder = 0 Placeholder to avoid empty struct issues with entt.

◆ donner::svg::components::FETileComponent

struct donner::svg::components::FETileComponent

Marker component for SVGFETileElement.

The feTile element has no element-specific parameters. It tiles its input's content (within the input's primitive subregion) across its own primitive subregion.

Class Members
int placeholder = 0 Placeholder to avoid empty struct issues with entt.

◆ donner::svg::components::FEImageComponent

struct donner::svg::components::FEImageComponent

Parameters for SVGFEImageElement.

Collaboration diagram for donner::svg::components::FEImageComponent:
[legend]
Class Members
RcString href Image URL or fragment reference.
PreserveAspectRatio preserveAspectRatio How to fit the image.

◆ donner::svg::components::FEMergeComponent

struct donner::svg::components::FEMergeComponent

Marker component for SVGFEMergeElement.

The merge element itself has no parameters; its children (feMergeNode) specify the inputs.

Class Members
int placeholder = 0 Placeholder to avoid empty struct issues with entt.

◆ donner::svg::components::FEMergeNodeComponent

struct donner::svg::components::FEMergeNodeComponent

Parameters for a feMergeNode child element within feMerge.

Each merge node specifies an input via the in attribute. The inputs are composited bottom-to-top using Source Over.

Class Members
optional< FilterInput > in The input to this merge node. Parsed from the in attribute.

◆ donner::svg::components::FEDiffuseLightingComponent

struct donner::svg::components::FEDiffuseLightingComponent
Collaboration diagram for donner::svg::components::FEDiffuseLightingComponent:
[legend]
Class Members
double diffuseConstant = 1.0 Diffuse reflection constant (kd).
Property< Color > lightingColor lighting-color property, specifying the color of the light source (default: white).
double surfaceScale = 1.0 Height of surface when alpha=1.

◆ donner::svg::components::FESpecularLightingComponent

struct donner::svg::components::FESpecularLightingComponent
Collaboration diagram for donner::svg::components::FESpecularLightingComponent:
[legend]
Class Members
Property< Color > lightingColor lighting-color property, specifying the color of the light source (default: white).
double specularConstant = 1.0 Specular reflection constant (ks).
double specularExponent = 1.0 Specular exponent (1..128).
double surfaceScale = 1.0 Height of surface when alpha=1.

◆ donner::svg::components::SizedElementComponent

struct donner::svg::components::SizedElementComponent

Stores the properties of a sized element, x, y, width, height.

Used for "<svg>", "<image>" and xml_foreignObject by the standard, and also internally with "<use>" for Donner.

Collaboration diagram for donner::svg::components::SizedElementComponent:
[legend]
Class Members
bool applyTranslationForUseElement = false Set to true for "<use>" elements, so that x/y are applied as a translation.
bool canOverrideWidthHeightForSymbol = false Set to true for "<symbol>" elements, so that width/height are inherited from the "<use>" element.
SizedElementProperties properties The properties of the sized element, x, y, width, height.

◆ donner::svg::components::ComputedSizedElementComponent

struct donner::svg::components::ComputedSizedElementComponent

Stores the computed bounds of a sized element, resolving units and percentages.

Contains the computed rect and inherited viewBox of the parent element.

Collaboration diagram for donner::svg::components::ComputedSizedElementComponent:
[legend]
Class Members
Box2d bounds The computed rect of this sized element.
Box2d inheritedViewBox The viewBox of the parent element, used for preserveAspectRatio transformations.

◆ donner::svg::components::ComputedShadowSizedElementComponent

struct donner::svg::components::ComputedShadowSizedElementComponent

Stores a shadow tree's computed SizedElementComponent, where a "<use>" element overrides the width or height on "<symbol>" or "<svg>" which use SizedElementComponent.

From https://www.w3.org/TR/SVG2/struct.html#UseElement:

The width and height attributes only have an effect if the referenced element defines a viewport (i.e., if it is a 'svg' or 'symbol'); if so, a value other than auto for the 'use' element overrides the value of the corresponding geometric property on that element.

Collaboration diagram for donner::svg::components::ComputedShadowSizedElementComponent:
[legend]
Class Members
Box2d bounds The computed rect of this sized element.

◆ donner::svg::components::SymbolComponent

struct donner::svg::components::SymbolComponent

Stores unique parameters for the "<symbol>" element.

refX and refY provide a reference point (if needed) when the symbol is instantiated by a "<use>" element.

Collaboration diagram for donner::svg::components::SymbolComponent:
[legend]
Class Members
SizedElementProperties properties The properties of the sized element, x, y, width, height.
double refX = 0.0 The reference x coordinate.
double refY = 0.0 The reference y coordinate.

◆ donner::svg::components::TransformComponent

struct donner::svg::components::TransformComponent

Stores the raw transform value set on an entity, for the transform presentation attribute.

This can be sourced from the transform="..." XML attribute, or from the transform CSS property.

Collaboration diagram for donner::svg::components::TransformComponent:
[legend]
Class Members
Property< CssTransform > transform Value of the transform, if it is set. Defaults to std::nullopt. Represents the entity-from-parent transform.

◆ donner::svg::components::ComputedLocalTransformComponent

struct donner::svg::components::ComputedLocalTransformComponent

Stores the computed transform value for an entity, relative to the parent.

This resolves presentation attributes and the CSS cascade and stores the resulting value for the current entity.

Collaboration diagram for donner::svg::components::ComputedLocalTransformComponent:
[legend]
Class Members
Transform2d entityFromParent Transform from the entity from its parent.
CssTransform rawCssTransform Raw CSS transform value, before resolving percentages relative to the viewport.
Vector2d transformOrigin Resolved transform origin in pixels.

◆ donner::svg::components::ComputedAbsoluteTransformComponent

struct donner::svg::components::ComputedAbsoluteTransformComponent

Stores the computed transform value for an entity, relative to the world.

This applies the transform from the from all parent entities, and represents the transform of the entity from the root.

Collaboration diagram for donner::svg::components::ComputedAbsoluteTransformComponent:
[legend]
Class Members
Transform2d entityFromWorld Transform from the entity from the world.
bool worldIsCanvas

◆ donner::svg::components::ViewBoxComponent

struct donner::svg::components::ViewBoxComponent

A component attached to entities that have a viewBox attribute, such as "<svg>" and "<pattern>".

Class Members
optional< Box2d > viewBox Stored viewBox, if any.

◆ donner::svg::components::ComputedViewBoxComponent

struct donner::svg::components::ComputedViewBoxComponent

Computed value of a viewBox for the current element.

If this element does not define a viewBox, this is the viewBox of the nearest ancestor or the document itself.

Collaboration diagram for donner::svg::components::ComputedViewBoxComponent:
[legend]
Class Members
Box2d viewBox The viewBox of the element, or the viewBox of the nearest ancestor.

◆ donner::svg::components::ClipPathComponent

struct donner::svg::components::ClipPathComponent

Parameters for the "<clipPath>" element.

Class Members
optional< ClipPathUnits > clipPathUnits The parsed value of the "clipPathUnits" attribute, which defines the coordinate system for the contents of the clip path.

◆ donner::svg::components::GradientComponent

struct donner::svg::components::GradientComponent

Common parameters for gradient elements, "<linearGradient>" and "<radialGradient>".

When this component is present, either LinearGradientComponent or RadialGradientComponent must be present.

Class Members
optional< GradientUnits > gradientUnits The parsed value of the "gradientUnits" attribute, which specifies how the coordinate system for linear/radial gradient positional attributes (such as x1, y1, cx, cy). Empty if no attribute was specified.
optional< Reference > href The parsed value of the "href" attribute, which specifies a reference to a gradient element to inherit from.
optional< GradientSpreadMethod > spreadMethod The parsed value of the "spreadMethod" attribute, which specifies how the gradient is repeated on its edges (such as spread, reflect, or repeat). Empty if no attribute was specified.

◆ donner::svg::components::MarkerComponent

struct donner::svg::components::MarkerComponent

Stores the marker data for an SVG element.

Collaboration diagram for donner::svg::components::MarkerComponent:
[legend]
Class Members
double markerHeight = 3.0 Height of the marker viewport.
MarkerUnits markerUnits Coordinate system for marker attributes and contents.
double markerWidth = 3.0 Width of the marker viewport.
MarkerOrient orient Orientation of the marker.
double refX = 0.0 X coordinate for the reference point of the marker.
double refY = 0.0 Y coordinate for the reference point of the marker.

◆ donner::svg::components::PatternComponent

struct donner::svg::components::PatternComponent

Parameters for "<pattern>" elements which are not captured by ViewBoxComponent and SizedElementComponent.

Collaboration diagram for donner::svg::components::PatternComponent:
[legend]
Class Members
optional< Reference > href An optional href to another pattern, which is used to inherit properties from if not by this entity.
optional< PatternContentUnits > patternContentUnits The pattern content units of the pattern, if std::nullopt, the pattern content units are inherited from the parent or defaulted to PatternContentUnits::Default.
optional< PatternUnits > patternUnits The pattern units of the pattern, if std::nullopt, the pattern units are inherited from the parent or defaulted to PatternUnits::Default.
SizedElementProperties sizeProperties Contains the x, y, width, and height properties of the pattern tile rectangle.

◆ donner::svg::components::StopComponent

struct donner::svg::components::StopComponent

Stores the properties of a "<stop>" element.

Collaboration diagram for donner::svg::components::StopComponent:
[legend]
Class Members
StopProperties properties The properties of the "<stop>" element.

◆ donner::svg::components::PathLengthComponent

struct donner::svg::components::PathLengthComponent

Stores a user-overridden path length on an element.

If the user has not overridden the path length, this component will not be attached.

Class Members
double value The user-overridden path length, in user units.

◆ donner::svg::components::PreserveAspectRatioComponent

struct donner::svg::components::PreserveAspectRatioComponent

Stores the preserveAspectRatio attribute of "<svg>" and "<pattern>".

Collaboration diagram for donner::svg::components::PreserveAspectRatioComponent:
[legend]
Class Members
PreserveAspectRatio preserveAspectRatio The preserveAspectRatio of the element, defaults to PreserveAspectRatio::None().

◆ donner::svg::components::SubtreeInfo

struct donner::svg::components::SubtreeInfo

Created on the start of a subtree, to inform the renderer about which element ends the current subtree, plus how many isolated layers need to be popped when the subtree is complete.

Class Members
Entity firstRenderedEntity Indicates the first entity within the current subtree. The renderer will continue rendering entities until it reaches this one, then it will pop restorePopDepth isolated layers from the render state.
Entity lastRenderedEntity Indicates the last entity within the current subtree. The renderer will continue rendering entities until it reaches this one, then it will pop restorePopDepth isolated layers from the render state.
int restorePopDepth = 0 How many isolated layers to pop after rendering this entity.

◆ donner::svg::components::PaintResolvedReference

struct donner::svg::components::PaintResolvedReference

Contains rendering information for a paint server, such as the subtree needed if it establishes an isolated layer, and where the paint server is located.

Collaboration diagram for donner::svg::components::PaintResolvedReference:
[legend]
Class Members
optional< Color > fallback Fallback color to use if this paint fails to instantiate. This can happen for various reasons, such as if a gradient has no stops (making it invalid).
ResolvedReference reference Reference to the paint server element.
optional< SubtreeInfo > subtreeInfo If this paint server creates a subtree, such as for patterns, contains subtree info to inform the renderer how to render it.

◆ donner::svg::components::FontResource

struct donner::svg::components::FontResource

In-memory representation of a font resource, containing the parsed WOFF data.

Collaboration diagram for donner::svg::components::FontResource:
[legend]
Class Members
WoffFont font The parsed WOFF font data.

◆ donner::svg::components::ImageComponent

struct donner::svg::components::ImageComponent

Parameters for the "<image>" element.

Collaboration diagram for donner::svg::components::ImageComponent:
[legend]
Class Members
RcString href URI to the image resource, which can either be a file path, URL, or data URL (e.g. "data:image/png;base64,...").

◆ donner::svg::components::LoadedImageComponent

struct donner::svg::components::LoadedImageComponent

Loaded raster image resource, created from a ImageComponent when the href references a raster image (PNG, JPEG, GIF).

Class Members
optional< ImageResource > image Loaded image resource.

◆ donner::svg::components::LoadedSVGImageComponent

struct donner::svg::components::LoadedSVGImageComponent

Loaded SVG sub-document, created from a ImageComponent when the href references an SVG file (image/svg+xml).

Stores the shared internal document handle used by SVGDocument.

Collaboration diagram for donner::svg::components::LoadedSVGImageComponent:
[legend]
Class Members
SVGDocumentHandle subDocument Parsed external SVG sub-document handle.

◆ donner::svg::components::ExternalUseComponent

struct donner::svg::components::ExternalUseComponent

Loaded external SVG sub-document referenced by a <use> element.

When a <use> element's href points to an external SVG file, the document is loaded via SubDocumentCache and stored here as an SVGDocumentHandle for rendering as a nested sub-document.

Collaboration diagram for donner::svg::components::ExternalUseComponent:
[legend]
Class Members
RcString fragment Fragment identifier within the external document (e.g., "elementId" from "file.svg#elementId"). Empty if the whole document is referenced.
SVGDocumentHandle subDocument Parsed external SVG sub-document handle.

◆ donner::svg::components::ShadowEntityComponent

struct donner::svg::components::ShadowEntityComponent

A component attached to entities in the shadow tree, indicating which light entity they are mirroring.

This component exists on every shadow entity, forming a one-to-one mapping between shadow entities and light entities.

Class Members
Entity lightEntity The entity that this shadow entity is mirroring.

◆ donner::svg::components::ShadowTreeRootComponent

struct donner::svg::components::ShadowTreeRootComponent

Indicates root of an instantiated shadow tree, where the light entity is is the target of the href, e.g.

a "<symbol>" element.

Class Members
Entity sourceEntity The entity of the source (e.g. "<use>") element that instantiated this shadow tree.

◆ donner::svg::components::CircleComponent

struct donner::svg::components::CircleComponent

Parameters for a "<circle>" element.

Collaboration diagram for donner::svg::components::CircleComponent:
[legend]
Class Members
CircleProperties properties The properties for the circle.

◆ donner::svg::components::EllipseComponent

struct donner::svg::components::EllipseComponent

Parameters for a "<ellipse>" element.

Collaboration diagram for donner::svg::components::EllipseComponent:
[legend]
Class Members
EllipseProperties properties The properties of the ellipse.

◆ donner::svg::components::LineComponent

struct donner::svg::components::LineComponent

Parameters for a "<line>" element.

Note that unlike other elements, the x1, y1, x2, and y2 properties are not presentation attributes, so they must be specified on the element and not through CSS. This means that we don't need a ComputedLineComponent counterpart of this struct.

From https://www.w3.org/TR/SVG2/shapes.html#LineElement

A future specification may convert the ‘x1’, ‘y1’, ‘x2’, and ‘y2’ attributes to geometric properties. Currently, they can only be specified via element attributes, and not CSS.

Collaboration diagram for donner::svg::components::LineComponent:
[legend]
Class Members
Lengthd x1 The x-coordinate of the start of the line.
Lengthd x2 The x-coordinate of the end of the line.
Lengthd y1 The y-coordinate of the start of the line.
Lengthd y2 The y-coordinate of the end of the line.

◆ donner::svg::components::RectComponent

struct donner::svg::components::RectComponent

Parameters for a "<rect>" element.

Collaboration diagram for donner::svg::components::RectComponent:
[legend]
Class Members
RectProperties properties The properties of the rectangle.

◆ donner::svg::components::ComputedStyleComponent

struct donner::svg::components::ComputedStyleComponent

Contains the computed style properties for an element, which is a combination of the style="" attribute, the CSS stylesheet, and the CSS cascade where properties are inherited from the parent.

Class Members
optional< PropertyRegistry > properties The computed style properties. std::nullopt may be present mid-computation before all properties have been cascaded.

◆ donner::svg::components::DoNotInheritFillOrStrokeTag

struct donner::svg::components::DoNotInheritFillOrStrokeTag

This component is added to entities to indicate that 'fill' and 'stroke' attributes should not be inherited, which is used for "<pattern>" because it establishes a shadow tree, and we do not want to recursively inherit 'fill' or 'stroke' values into the children.

◆ donner::svg::components::ComputedTextComponent

struct donner::svg::components::ComputedTextComponent

Pre‑computed layout information for a text subtree.

A ComputedTextComponent is attached by the layout system to the root "<text>" element after all "<text>", "<tspan>", and "<textPath>" descendants have been resolved. It stores the final, absolute positions for each contiguous slice of text, allowing the renderer to iterate quickly without re‑evaluating attribute vectors on every frame.

The component contains a single public field, spans, which is the computed list of text spans.

Note
This structure is internal to the rendering pipeline and is not exposed through the public DOM API.
Collaboration diagram for donner::svg::components::ComputedTextComponent:
[legend]
Class Members
SmallVector< TextSpan, 1 > spans

◆ donner::svg::components::ComputedTextGeometryComponent

struct donner::svg::components::ComputedTextGeometryComponent

Cached geometry for text layout and text-derived public API queries.

Attached to the root <text> entity and populated from the shared text engine. This stores per-glyph outlines and per-character metrics so DOM APIs can answer geometry queries without duplicating text layout logic.

Collaboration diagram for donner::svg::components::ComputedTextGeometryComponent:
[legend]
Class Members
vector< CharacterGeometry > characters Cached character metrics in logical order.
Box2d emBoxBounds Union of em-box bounds used for text bbox.
vector< GlyphGeometry > glyphs Cached glyph outlines for the text root.
Box2d inkBounds Union of glyph ink bounds.
vector< TextRun > runs Cached layout runs for renderer reuse.

◆ donner::svg::components::TextComponent

struct donner::svg::components::TextComponent

Defines the start of a text element, which may have other text elements as children.

Created on each "<text>", "<tspan>", and "<textPath>" element.

Collaboration diagram for donner::svg::components::TextComponent:
[legend]
Class Members
LengthAdjust lengthAdjust = LengthAdjust::Default How to adjust the text length, either by adding spacing between glyphs or stretching the glyphs themselves.
RcString text Text content.
SmallVector< RcString, 1 > textChunks Direct text chunks between child elements, in DOM order.

Chunk 0 is the text before the first child element, chunk 1 is the text between the first and second child elements, and so on. Empty chunks are preserved so mixed text and element content can be reconstructed in order during layout.

optional< Lengthd > textLength Override for the text length. If empty, the property is not set.

◆ donner::svg::components::TextPathComponent

struct donner::svg::components::TextPathComponent

Stores attributes specific to "<textPath>" elements.

The <textPath> element renders text along an arbitrary path referenced by href.

Collaboration diagram for donner::svg::components::TextPathComponent:
[legend]
Class Members
RcString href Reference to a <path> element (IRI fragment, e.g., "#myPath").
TextPathMethod method = TextPathMethod::Align How glyphs are placed on the path.
TextPathSide side = TextPathSide::Left Which side of the path to render text.
TextPathSpacing spacing = TextPathSpacing::Exact Spacing control.
optional< Lengthd > startOffset Offset along the path where text begins. Percentages are relative to path length.

◆ donner::svg::components::TextPositioningComponent

struct donner::svg::components::TextPositioningComponent

Defines the positioning of a text element, which may have other text elements as children.

Created on each "<text>" and "<tspan>" element.

Collaboration diagram for donner::svg::components::TextPositioningComponent:
[legend]
Class Members
SmallVector< Lengthd, 1 > dx Relative shift in x for each character. If empty, the property is not set.
SmallVector< Lengthd, 1 > dy Relative shift in y for each character. If empty, the property is not set.
SmallVector< double, 1 > rotateDegrees Rotation in degrees for each character. If empty, the property is not set.
SmallVector< Lengthd, 1 > x X coordinate for each character. If empty, the property is not set.
SmallVector< Lengthd, 1 > y Y coordinate for each character. If empty, the property is not set.

◆ donner::svg::components::TextRootComponent

struct donner::svg::components::TextRootComponent

Defines the start of a text element, which may have other text elements as children.

Created on each "<text>" element.

Typedef Documentation

◆ FilterPrimitive

Initial value:
Parameters for feDiffuseLighting.
Definition FilterGraph.h:315
Parameters for feDropShadow.
Definition FilterGraph.h:162
Parameters for feFlood.
Definition FilterGraph.h:88
Parameters for feImage.
Definition FilterGraph.h:252
Parameters for feMerge. Children are represented as additional inputs on the FilterNode.
Definition FilterGraph.h:159
Parameters for feOffset.
Definition FilterGraph.h:94
Parameters for feSpecularLighting.
Definition FilterGraph.h:323
Parameters for feTile.
Definition FilterGraph.h:233
Parameters for feBlend.
Definition FilterGraph.h:100
Parameters for feColorMatrix.
Definition FilterGraph.h:145
Parameters for feComponentTransfer.
Definition FilterGraph.h:172
Parameters for feComposite.
Definition FilterGraph.h:125
Parameters for feConvolveMatrix.
Definition FilterGraph.h:200
Parameters for feDisplacementMap.
Definition FilterGraph.h:281
Parameters for feGaussianBlur.
Definition FilterGraph.h:74
Parameters for feMorphology.
Definition FilterGraph.h:220
Parameters for feTurbulence.
Definition FilterGraph.h:236

Variant holding any filter primitive type.

◆ ResolvedPaintServer

Initial value:
std::variant<PaintServer::None, PaintServer::Solid, PaintResolvedReference>

The resolved paint server for a fill or stroke.

◆ ShadowSizedElementHandler

Initial value:
std::function<bool(
Registry& registry, Entity shadowEntity, EntityHandle useEntity, Entity symbolEntity,
ShadowBranchType branchType, ParseWarningSink& warningSink)>
Collects parse warnings during parsing.
Definition ParseWarningSink.h:28
ShadowBranchType
There are two types of shadow trees:
Definition ShadowBranch.h:22
entt::basic_registry< Entity, std::allocator< Entity > > Registry
Registry type for the SVG ECS, which is the entry point for storing all data.
Definition EcsRegistry.h:46
entt::entity Entity
Entity type for the Registry, a std::uint32_t alias.
Definition EcsRegistry.h:16
entt::basic_handle< Registry > EntityHandle
Convenience handle for a Entity with an attached Registry.
Definition EcsRegistry.h:53

Type definition for a callback to process sized elements.

This allows systems that can't directly depend on LayoutSystem to request sized element processing.

Parameters
registryECS registry.
shadowEntityThe shadow entity to create a computed component for.
useEntityThe source "<use>" that may provide size override.
symbolEntityThe target "<symbol>" entity whose properties might be overridden.
branchTypeThe type of branch being created.
outWarningsOutput vector of parse errors, if any.
Returns
true if a component was created, false otherwise.

Enumeration Type Documentation

◆ FilterStandardInput

enum class donner::svg::components::FilterStandardInput : std::uint8_t
strong

Standard named inputs available to filter primitives.

See also
https://drafts.fxtf.org/filter-effects/#FilterPrimitiveSubRegion
Enumerator
SourceGraphic 

The original element rendering.

SourceAlpha 

Alpha channel of SourceGraphic (RGB = 0).

FillPaint 

The element's fill paint, conceptually infinite.

StrokePaint 

The element's stroke paint, conceptually infinite.

◆ RenderingBehavior

Controls how the attached element is rendered, determines how different element types are rendered.

Enumerator
Default 

The default rendering behavior, which renders and traverses children.

Nonrenderable 

The element and its children are not rendered.

NoTraverseChildren 

The element is rendered, but its children are not traversed.

ShadowOnlyChildren 

Only traverse this element's children within a shadow tree instantiation.

◆ ShadowBranchType

There are two types of shadow trees:

  • Main: One for elements in the main render graph, such as "<use>" elements, where each "<use>" element holds one instantiation, which behaves as if the referenced element was copy-pasted within the tree.
  • Offscreen: Shadow trees for paint servers and offscreen purposes, which are not enumerated as part of the render graph. For example, a 'fill' attribute may reference a "<pattern>" paint server, which needs to be rendered into a buffer before being tiled into the main render graph.

Shadow trees always belong to specific branches, and there are no multiples; there are a finite number of branches. To enable this, list each branch individually, with everything except Main being an offscreen branch.

Enumerator
Main 

For entities enumerated in the main render graph.

OffscreenFill 

For 'fill' attributes.

OffscreenStroke 

For 'stroke' attributes.

OffscreenMask 

For mask contents, used for the 'mask' attribute.

OffscreenMarkerStart 

For the 'marker-start' attribute.

OffscreenMarkerMid 

For the 'marker-mid' attribute.

OffscreenMarkerEnd 

For the 'marker-end' attribute.

OffscreenFeImage 

For feImage fragment references.

◆ TextPathMethod

Method for placing glyphs along a path in "<textPath>".

Enumerator
Align 

Glyphs are aligned to the tangent of the path.

Stretch 

Glyphs are stretched along the tangent to match path curvature.

◆ TextPathSide

Which side of the path to render text in "<textPath>".

Enumerator
Left 

Text rendered on the left side (default).

Right 

Text rendered on the right side (reversed direction).

◆ TextPathSpacing

Spacing mode for "<textPath>".

Enumerator
Auto 

UA determines spacing.

Exact 

Exact inter-character spacing.

Function Documentation

◆ HasPaint()

bool donner::svg::components::HasPaint ( const ResolvedPaintServer & paint)
inline

Returns true if the paint server is not a PaintServer::None.

Parameters
paintThe paint server to check.
Returns
True if the paint server is not a PaintServer::None.