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

Accumulates each primitive's input reach in device pixels, converting lengths with the same helpers and bounds the filter executors use. The executors round each primitive to whole pixels (offsets and morphology radii to the nearest pixel, blur kernels up), so each primitive's reach rounds up to whole pixels before the chain adds them. More...

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

Public Member Functions

double length (double value, int axis) const
 Device length of a nonnegative primitive length.
Vector2d footprint (Vector2d axisPixels) const
 Device footprint of a reach measured in pixels along each filter axis. Under rotation or skew, the transformed blur path samples along the filter axes, which land on slanted device directions: each device axis gets the absolute linear coefficients times the user-space reach. Primitives that execute on the device raster read along the device axes instead, so the footprint keeps at least the per-axis reach.
Vector2d offset (double dx, double dy) const
 Device extent of a primitive offset.
double user (double value, int axis) const
 User-space value of a primitive length or offset.
Vector2d localToDevice (Vector2d localPixels) const
 Device extent of local raster pixels, mapped through the filter's linear part.
Vector2d offsetReach (double dx, double dy) const
 Reach of an offset: rounded to whole device pixels on the device raster, or rounded to whole local pixels on the local raster and mapped back.
Vector2d blurReach (double stdDeviationX, double stdDeviationY) const
 Reach of a blur: three standard deviations, rounded up to whole pixels on the device raster or on the local raster.
void add (const components::filter_primitive::GaussianBlur &blur)
 Wrapping edges read the opposite side of the input, which may lie anywhere in the region.
void add (const components::filter_primitive::DropShadow &shadow)
void add (const components::filter_primitive::Offset &value)
void add (const components::filter_primitive::Morphology &morphology)
void add (const components::filter_primitive::DisplacementMap &displacement)
 The backends disagree on how displacement scales: one applies the scale directly in raster pixels, the other multiplies it by the transform's area scale. Bound both. Both sample bilinearly, reading one pixel past the rounded-down displaced position.
void add (const components::filter_primitive::ConvolveMatrix &convolve)
 Wrapping edges read the opposite side of the input, which may lie anywhere in the region.
void add (const components::filter_primitive::DiffuseLighting &)
 Surface normals read the neighboring pixels.
void add (const components::filter_primitive::SpecularLighting &)
 Surface normals read the neighboring pixels.
template<typename T>
void add (const T &)
 Point-wise primitives read only the input pixel under each output pixel.
void addTile (const components::FilterNode *input)
 feTile repeats its input's subregion, so the capture must cover that whole rectangle. It is known here only when the input primitive authors its region in user-space units; otherwise the tile may read anywhere in the filter region.

Static Public Member Functions

static Vector2d wholePixels (Vector2d pixels)
 Round a reach up to whole pixels.

Public Attributes

Transform2d deviceFromFilter
 Filter user space to raster pixels.
Vector2d scale
 Device scale of each filter axis.
Vector2d localScale
 Scale of the transformed path's local raster.
Vector2d bounds
 Element bounding box size, or 1 without one.
bool objectBounds = false
 Whether primitive lengths are bounding-box fractions.
FilterInputMargin margin
 Accumulated margin.

Detailed Description

Accumulates each primitive's input reach in device pixels, converting lengths with the same helpers and bounds the filter executors use. The executors round each primitive to whole pixels (offsets and morphology radii to the nearest pixel, blur kernels up), so each primitive's reach rounds up to whole pixels before the chain adds them.

Blur-family graphs under rotation or skew may instead run on the transformed path's local raster, scaled by each filter axis's length, where blurs and offsets round in local pixels before the result maps back to the device. Their reach is the larger of the two.

Member Function Documentation

◆ blurReach()

Vector2d donner::svg::FilterInputMarginBuilder::blurReach ( double stdDeviationX,
double stdDeviationY ) const
inline

Reach of a blur: three standard deviations, rounded up to whole pixels on the device raster or on the local raster.

Parameters
stdDeviationXX deviation.
stdDeviationYY deviation.

◆ footprint()

Vector2d donner::svg::FilterInputMarginBuilder::footprint ( Vector2d axisPixels) const
inline

Device footprint of a reach measured in pixels along each filter axis. Under rotation or skew, the transformed blur path samples along the filter axes, which land on slanted device directions: each device axis gets the absolute linear coefficients times the user-space reach. Primitives that execute on the device raster read along the device axes instead, so the footprint keeps at least the per-axis reach.

Parameters
axisPixelsReach in pixels along the filter X and Y axes.

◆ length()

double donner::svg::FilterInputMarginBuilder::length ( double value,
int axis ) const
inline

Device length of a nonnegative primitive length.

Parameters
valueLength.
axis0 or 1.

◆ localToDevice()

Vector2d donner::svg::FilterInputMarginBuilder::localToDevice ( Vector2d localPixels) const
inline

Device extent of local raster pixels, mapped through the filter's linear part.

Parameters
localPixelsSigned local raster pixels along each filter axis.

◆ offset()

Vector2d donner::svg::FilterInputMarginBuilder::offset ( double dx,
double dy ) const
inline

Device extent of a primitive offset.

Parameters
dxX offset.
dyY offset.

◆ offsetReach()

Vector2d donner::svg::FilterInputMarginBuilder::offsetReach ( double dx,
double dy ) const
inline

Reach of an offset: rounded to whole device pixels on the device raster, or rounded to whole local pixels on the local raster and mapped back.

Parameters
dxX offset.
dyY offset.

◆ user()

double donner::svg::FilterInputMarginBuilder::user ( double value,
int axis ) const
inline

User-space value of a primitive length or offset.

Parameters
valueValue.
axis0 or 1.

◆ wholePixels()

Vector2d donner::svg::FilterInputMarginBuilder::wholePixels ( Vector2d pixels)
inlinestatic

Round a reach up to whole pixels.

Parameters
pixelsReach per axis.

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