|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
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...
#include "donner/svg/components/shape/ComputedPathComponent.h"
Public Member Functions | |
| Box2d | localBounds () const |
| Returns the tight fill bounds of the path in local (pre-transform) space. | |
| Box2d | transformedBounds (const Transform2d &pathFromTarget) |
| Returns the tight bounds of the shape, transformed to the target coordinate system. | |
Public Attributes | |
| Path | spline |
| Path used for rendering the shape. | |
| std::optional< Box2d > | cachedLocalBounds |
| Lazily-populated cache for localBounds(). Left as a public data member (rather than hidden behind a private: section) so the component stays an aggregate — entt's emplace_or_replace<T>(args...) path initializes components via aggregate initialization on older compilers and breaks once a non-public section is added. | |
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.
All shapes create computed paths, and these paths can be rendered using a unified rendering pipeline.
|
inline |
Returns the tight fill bounds of the path in local (pre-transform) space.
Memoized — Path::bounds() walks every command (O(N) in path size), so hot-path callers (culling, hit-testing, filter-region computation) should prefer this accessor. The cache is tied to the ComputedPathComponent's lifetime; ShapeSystem rebuilds the component whenever the underlying geometry changes, which invalidates the cache. Style-only changes (fill color, opacity, stroke-width) leave the component — and the cached bounds — intact.
|
inline |
Returns the tight bounds of the shape, transformed to the target coordinate system.
| pathFromTarget | Transform to transform the path to the target coordinate system. |