Donner SVG main
0.8.0 · 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::components::RenderingInstanceComponent Struct Reference

An instance of the entity in the rendering tree. More...

#include "donner/svg/components/RenderingInstanceComponent.h"

Public Member Functions

 RenderingInstanceComponent ()=default
 Default constructor.
bool hasClipPath () const
 Whether either reference or CSS basic-shape clipping constrains this subtree.
template<typename Visit>
void forEachDrawnContent (Visit &&visit) const
 Calls visit with the mask, marker and pattern content drawn for this instance, including the pattern tiles of its text spans' own paint (spanPatternPaints).
EntityHandle dataHandle (Registry &registry) const
 Shortcut for creating a handle for the dataEntity, the entity containing the structural components of the instance like ClassComponent.
EntityHandle styleHandle (Registry &registry) const
 A handle for the entity containing style information, which may be different than the dataHandle if this instance is within a shadow tree.
bool isShadow (Registry &registry) const
 Return true if this is a shadow tree instance.

Public Attributes

int drawOrder = 0
 The draw order of the element, computed from the traversal order of the tree.
Entity subtreeLastEntity = entt::null
 Last rendered descendant, including this instance when it has no rendered children.
bool visible = true
 Whether the element is visible. Note that elements may still influence rendering behavior when they are hidden, such as <pattern> elements.
bool isolatedLayer = false
 True if this instance establishes a new rendering layer, such as if there is opacity.
bool feImageFragment = false
 True for instances created while instantiating an feImage fragment, including the paint, mask and marker content they draw. They are drawn only into the fragment, never by the main traversal.
Transform2d worldFromEntityTransform
 Cascaded transform mapping entity-local coords to canvas coords. Applying this to a <circle>'s (cx, cy) yields that circle's canvas position. Composed with RendererDriver::surfaceFromCanvasTransform_ as worldFromEntityTransform * surfaceFromCanvasTransform_ (donner's left-first operator*: "apply entity→world, then world→surface") to form the final render CTM.
std::optional< Box2d > clipRect
 The clip rect of the element, if set.
bool basicClipPath = false
 A resolved CSS basic shape establishes a subtree clip.
std::optional< ResolvedClipPath > clipPath
 The clip path of the element, if set.
std::optional< ResolvedMask > mask
 The mask of the element, if set.
std::optional< ResolvedMarker > markerStart
 The resolved marker for marker-start, if any.
std::optional< ResolvedMarker > markerMid
 The resolved marker for marker-mid, if any.
std::optional< ResolvedMarker > markerEnd
 The resolved marker for marker-end, if any.
Entity dataEntity = entt::null
 The entity containing the structural components of the instance, element-specific components like IdComponent.
Entity textSpanRoot = entt::null
 Set when this instance paints part of a text element rather than its own geometry: the root <text> entity whose laid-out spans it draws.
ResolvedPaintServer resolvedFill = PaintServer::None()
 The resolved paint server for the instance's fill, if any.
ResolvedPaintServer resolvedStroke = PaintServer::None()
 The resolved paint server for the instance's stroke, if any.
std::vector< SpanPatternPaint > spanPatternPaints
 The distinct patterns that the text spans this instance paints reference from their own fill or stroke, other than the instance's own fill or stroke pattern.
std::optional< ResolvedFilterEffect > resolvedFilter
 The resolved filter effect on this instance, if any.
std::optional< SubtreeInfo > subtreeInfo
 Information about this elements subtree, if there is a rendering-influencing subtree attached to this entity.

Detailed Description

An instance of the entity in the rendering tree.

Each renderered entity has an instance with a unique drawOrder, which enables this list to be sorted and traversed to render the tree.

Member Function Documentation

◆ dataHandle()

EntityHandle donner::svg::components::RenderingInstanceComponent::dataHandle ( Registry & registry) const
inline

Shortcut for creating a handle for the dataEntity, the entity containing the structural components of the instance like ClassComponent.

Parameters
registryThe registry to use.
Returns
A handle for the dataEntity.

◆ forEachDrawnContent()

template<typename Visit>
void donner::svg::components::RenderingInstanceComponent::forEachDrawnContent ( Visit && visit) const
inline

Calls visit with the mask, marker and pattern content drawn for this instance, including the pattern tiles of its text spans' own paint (spanPatternPaints).

That content is instantiated once, as rendering instances of its own, after the first element that draws it, and shared by every later element that draws the same marker, mask or pattern. It reaches the frame only through the elements that draw it, never as content of its own.

Parameters
visitCalled with the SubtreeInfo of each content subtree.

◆ isShadow()

bool donner::svg::components::RenderingInstanceComponent::isShadow ( Registry & registry) const
inline

Return true if this is a shadow tree instance.

Parameters
registryThe registry to use.
Returns
True if this is a shadow tree instance.

◆ styleHandle()

EntityHandle donner::svg::components::RenderingInstanceComponent::styleHandle ( Registry & registry) const
inline

A handle for the entity containing style information, which may be different than the dataHandle if this instance is within a shadow tree.

Parameters
registryThe registry to use.
Returns
A handle for the style entity.

Member Data Documentation

◆ spanPatternPaints

std::vector<SpanPatternPaint> donner::svg::components::RenderingInstanceComponent::spanPatternPaints

The distinct patterns that the text spans this instance paints reference from their own fill or stroke, other than the instance's own fill or stroke pattern.

Empty for an instance that does not paint text, and for text whose spans paint only the text element's own paint.

◆ textSpanRoot

Entity donner::svg::components::RenderingInstanceComponent::textSpanRoot = entt::null

Set when this instance paints part of a text element rather than its own geometry: the root <text> entity whose laid-out spans it draws.

A <tspan> or <textPath> that carries clip-path, mask, or filter becomes its own instance so those effects get their own layer, while dataEntity stays the span so objectBoundingBox effect regions resolve against the span's own box. The text root's instance paints every span that no such instance claims. A span nested inside a claimed span is painted by the outer instance, so its own effects are not applied yet, and a claimed span paints after the text root's remaining spans rather than in document order. A <use> copy has no span instances of its own, so it paints every span without the span-level effects.


The documentation for this struct was generated from the following file: