Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::FilterRegionContext Struct Reference

Per-invocation filter coordinates and subregion history, independent of GPU resources. More...

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

Public Types

using FilterGraph = components::FilterGraph
 Filter graph type.
using FilterInput = components::FilterInput
 Primitive input reference type.
using FilterNode = components::FilterNode
 Primitive node type.

Public Member Functions

 FilterRegionContext (const FilterGraph &graph, Vector2i sourceSize, const Box2d &filterRegion, const Transform2d &deviceFromFilter, std::optional< Box2d > primitiveBounds=std::nullopt, std::optional< Box2d > rasterRegion=std::nullopt)
 Build a coordinate snapshot for the actual source raster and referencing filter.
double toPixelX (double value) const
 Resolve an effect length along X.
double toPixelY (double value) const
 Resolve an effect length along Y.
Vector2d toPixelOffset (double dx, double dy) const
 Resolve an offset vector.
Box2d resolveInputSubregion (const FilterInput &input) const
 Look up an input region, falling back to the previous output for missing names.
Box2d computeNodeSubregion (const FilterNode &node) const
 Resolve explicit or input-derived primitive bounds.
FilterRegionSample sampleNodeSubregion (const FilterNode &node) const
 Evaluate admitted region stacks after the default subregion is known.
void recordSubregion (const FilterNode &node, const Box2d &bounds)
 Retain a user-space primitive region for later input-derived defaults.
void recordRasterSubregion (const FilterNode &node, std::optional< Box2d > bounds)
 Retain the raster executor's already-converted and bounded primitive region.
void setPaintInputRegions (std::optional< Box2d > fill, std::optional< Box2d > stroke)
 Use admitted CPU paint-input coverage for standard-input default regions.
double resolvePrimitivePosition (const Lengthd &length, Lengthd::Extent extent, double origin, double boundingBoxDimension) const
 Resolve a position.
double resolvePrimitiveSize (const Lengthd &length, Lengthd::Extent extent, double boundingBoxDimension) const
 Resolve a size.

Public Attributes

Box2d filterRegion
 Filter region in user coordinates.
Transform2d deviceFromFilter
 Filter-to-device transform.
double scaleX = 1.0
 Device scale along X derived from deviceFromFilter.
double scaleY = 1.0
 Device scale along Y derived from deviceFromFilter.
bool isObjectBoundingBox = false
 Whether primitiveUnits is objectBoundingBox.
double boundingBoxWidth = 1.0
 Element bounding box width, or 1 without one.
double boundingBoxHeight = 1.0
 Element bounding box height, or 1 without one.
double boundingBoxX = 0.0
 Element bounding box left edge, or 0 without one.
double boundingBoxY = 0.0
 Element bounding box top edge, or 0 without one.
bool invertible = true
 Whether deviceFromFilter has a finite inverse.
Transform2d filterFromDevice
 Finite inverse of deviceFromFilter, or identity if none.
Box2d primitiveUnitsBounds
 Reference bounds for percentage primitive lengths.
bool historyInDeviceSpace = false
 Whether subregion history is kept in raster space.
Box2d historyFilterRegion
 Region that clips default subregions, in history space.
Box2d historySourceRegion
 Subregion of the standard inputs, in history space.
std::optional< Box2d > fillPaintRegion
 FillPaint coverage bounds, when admitted.
std::optional< Box2d > strokePaintRegion
 StrokePaint coverage bounds, when admitted.
Box2d previousOutputSubregion
 Subregion of the most recently recorded primitive.
std::unordered_map< std::string, Box2d > namedSubregions
 Subregions of recorded primitives, by result name.

Detailed Description

Per-invocation filter coordinates and subregion history, independent of GPU resources.

Construction snapshots coordinate metadata. The caller records each completed primitive's subregion in execution order; no document handles or borrowed transforms are retained.

Constructor & Destructor Documentation

◆ FilterRegionContext()

donner::svg::FilterRegionContext::FilterRegionContext ( const FilterGraph & graph,
Vector2i sourceSize,
const Box2d & filterRegion,
const Transform2d & deviceFromFilter,
std::optional< Box2d > primitiveBounds = std::nullopt,
std::optional< Box2d > rasterRegion = std::nullopt )
inline

Build a coordinate snapshot for the actual source raster and referencing filter.

Parameters
graphEffective filter units and object bounds.
sourceSizeSource raster dimensions in pixels.
filterRegionFilter region in user coordinates.
deviceFromFilterFilter-to-device transform, copied into this context.
primitiveBoundsOptional backend-resolved percentage reference bounds.
rasterRegionRaster-space clipping region when default history follows raster execution.

Member Function Documentation

◆ computeNodeSubregion()

Box2d donner::svg::FilterRegionContext::computeNodeSubregion ( const FilterNode & node) const
inline

Resolve explicit or input-derived primitive bounds.

Parameters
nodePrimitive to evaluate.

◆ recordRasterSubregion()

void donner::svg::FilterRegionContext::recordRasterSubregion ( const FilterNode & node,
std::optional< Box2d > bounds )
inline

Retain the raster executor's already-converted and bounded primitive region.

Parameters
nodeCompleted primitive.
boundsExplicit region, or absent for input defaults.

◆ recordSubregion()

void donner::svg::FilterRegionContext::recordSubregion ( const FilterNode & node,
const Box2d & bounds )
inline

Retain a user-space primitive region for later input-derived defaults.

Parameters
nodeCompleted primitive.
boundsRegion used for that primitive.

◆ resolveInputSubregion()

Box2d donner::svg::FilterRegionContext::resolveInputSubregion ( const FilterInput & input) const
inline

Look up an input region, falling back to the previous output for missing names.

Parameters
inputInput reference.

◆ resolvePrimitivePosition()

double donner::svg::FilterRegionContext::resolvePrimitivePosition ( const Lengthd & length,
Lengthd::Extent extent,
double origin,
double boundingBoxDimension ) const
inline

Resolve a position.

Parameters
lengthValue.
extentAxis.
originObject origin.
boundingBoxDimensionObject extent on that axis.

◆ resolvePrimitiveSize()

double donner::svg::FilterRegionContext::resolvePrimitiveSize ( const Lengthd & length,
Lengthd::Extent extent,
double boundingBoxDimension ) const
inline

Resolve a size.

Parameters
lengthValue.
extentAxis.
boundingBoxDimensionExtent.

◆ sampleNodeSubregion()

FilterRegionSample donner::svg::FilterRegionContext::sampleNodeSubregion ( const FilterNode & node) const
inline

Evaluate admitted region stacks after the default subregion is known.

Parameters
nodePrimitive with immutable recipes. Its execution cost must already be admitted.

◆ setPaintInputRegions()

void donner::svg::FilterRegionContext::setPaintInputRegions ( std::optional< Box2d > fill,
std::optional< Box2d > stroke )
inline

Use admitted CPU paint-input coverage for standard-input default regions.

Parameters
fillFillPaint alpha bounds.
strokeStrokePaint alpha bounds.

◆ toPixelOffset()

Vector2d donner::svg::FilterRegionContext::toPixelOffset ( double dx,
double dy ) const
inline

Resolve an offset vector.

Parameters
dxX offset.
dyY offset.

◆ toPixelX()

double donner::svg::FilterRegionContext::toPixelX ( double value) const
inline

Resolve an effect length along X.

Parameters
valueLength in primitive units.

◆ toPixelY()

double donner::svg::FilterRegionContext::toPixelY ( double value) const
inline

Resolve an effect length along Y.

Parameters
valueLength in primitive units.

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