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

Rendering controller, which instantiates and and manages the rendering tree. More...

#include "donner/svg/renderer/RenderingContext.h"

Classes

struct  FeImageSubtreeResult
 Result from createFeImageShadowTree. More...

Public Member Functions

 RenderingContext (Registry &registry)
 Constructor.
void instantiateRenderTree (bool verbose, ParseWarningSink &warningSink)
 Create the render tree for the document, optionally returning parse warnings found when parsing deferred parts of the tree.
void ensureComputedComponents (ParseWarningSink &warningSink)
 Create all computed components needed for text/layout/style queries without instantiating render instances.
Entity findIntersecting (const Vector2d &point)
 Find the first entity that intersects the given point, using spatial acceleration when the document has enough elements.
std::vector< EntityfindAllIntersecting (const Vector2d &point)
 Find all entities that intersect the given point, ordered front-to-back.
std::vector< EntityfindIntersectingRect (const Box2d &rect)
 Find all entities whose world-space bounds intersect the given rectangle, ordered front-to-back.
std::optional< Box2dgetWorldBounds (Entity entity)
 Get the world-space bounding box of an entity (fill bounds only, not including stroke).
void invalidateRenderTree ()
 Invalidate the rendering tree, forcing it to be recreated on the next render.
std::optional< FeImageSubtreeResultcreateFeImageShadowTree (Entity hostEntity, Entity targetEntity, bool verbose)
 Create a shadow tree for an feImage fragment reference, allowing elements inside <defs> to be rendered offscreen.
void setInitialContextPaint (const ResolvedPaintServer &fill, const ResolvedPaintServer &stroke)
 Set initial context-fill and context-stroke values for sub-document rendering.
void clearInitialContextPaint ()
 Clear previously set context-fill and context-stroke values.

Detailed Description

Rendering controller, which instantiates and and manages the rendering tree.

Used during the rendering phase in combination with the rendering backend.


Class Documentation

◆ donner::svg::components::RenderingContext::FeImageSubtreeResult

struct donner::svg::components::RenderingContext::FeImageSubtreeResult

Result from createFeImageShadowTree.

Class Members
Entity firstEntity First entity in the shadow subtree.
Entity lastEntity Last entity in the shadow subtree.

Member Function Documentation

◆ clearInitialContextPaint()

void donner::svg::components::RenderingContext::clearInitialContextPaint ( )

Clear previously set context-fill and context-stroke values.

Call after rendering a sub-document to prevent stale context paint from leaking to subsequent renders of the same cached sub-document handle.

◆ ensureComputedComponents()

void donner::svg::components::RenderingContext::ensureComputedComponents ( ParseWarningSink & warningSink)

Create all computed components needed for text/layout/style queries without instantiating render instances.

Parameters
warningSinkSink to collect warnings.

◆ findAllIntersecting()

std::vector< Entity > donner::svg::components::RenderingContext::findAllIntersecting ( const Vector2d & point)

Find all entities that intersect the given point, ordered front-to-back.

Parameters
pointPoint to find intersecting entities for

◆ findIntersecting()

Entity donner::svg::components::RenderingContext::findIntersecting ( const Vector2d & point)

Find the first entity that intersects the given point, using spatial acceleration when the document has enough elements.

Parameters
pointPoint to find the intersecting entity for

◆ findIntersectingRect()

std::vector< Entity > donner::svg::components::RenderingContext::findIntersectingRect ( const Box2d & rect)

Find all entities whose world-space bounds intersect the given rectangle, ordered front-to-back.

Uses the spatial grid for acceleration when available.

Parameters
rectRectangle in world coordinates to test intersection against

◆ getWorldBounds()

std::optional< Box2d > donner::svg::components::RenderingContext::getWorldBounds ( Entity entity)

Get the world-space bounding box of an entity (fill bounds only, not including stroke).

Parameters
entityEntity to get bounds for
Returns
The world-space AABB, or std::nullopt if the entity has no shape

◆ instantiateRenderTree()

void donner::svg::components::RenderingContext::instantiateRenderTree ( bool verbose,
ParseWarningSink & warningSink )

Create the render tree for the document, optionally returning parse warnings found when parsing deferred parts of the tree.

Parameters
verboseIf true, enable verbose logging.
warningSinkSink to collect warnings.

◆ setInitialContextPaint()

void donner::svg::components::RenderingContext::setInitialContextPaint ( const ResolvedPaintServer & fill,
const ResolvedPaintServer & stroke )

Set initial context-fill and context-stroke values for sub-document rendering.

When a <use> element references an external SVG, the <use> element's resolved fill and stroke become the initial context-fill/context-stroke in the sub-document.

Parameters
fillInitial context-fill value.
strokeInitial context-stroke value.

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