|
|
Donner
C++20 SVG rendering library
|
Backend-agnostic rendering interface consumed by the traversal driver. More...
#include "donner/svg/renderer/RendererInterface.h"
Public Member Functions | |
| virtual void | draw (SVGDocument &document)=0 |
| Renders the given SVG document. | |
| virtual int | width () const =0 |
| Returns the rendered width in device pixels. | |
| virtual int | height () const =0 |
| Returns the rendered height in device pixels. | |
| virtual void | beginFrame (const RenderViewport &viewport)=0 |
| Begins a render pass with the given viewport. | |
| virtual void | endFrame ()=0 |
| Completes the current render pass, flushing any pending work. | |
| virtual void | setTransform (const Transformd &transform)=0 |
| Sets the absolute transform on the renderer, replacing the current matrix. | |
| virtual void | pushTransform (const Transformd &transform)=0 |
| Pushes a transform onto the renderer stack, composing with the current transform. | |
| virtual void | popTransform ()=0 |
| Pops the most recent transform from the renderer stack. | |
| virtual void | pushClip (const ResolvedClip &clip)=0 |
| Pushes a clip path/mask onto the renderer stack. | |
| virtual void | popClip ()=0 |
| Pops the most recent clip from the renderer stack. | |
| virtual void | pushIsolatedLayer (double opacity)=0 |
| Pushes an isolated compositing layer with the given opacity. | |
| virtual void | popIsolatedLayer ()=0 |
| Pops the most recent isolated layer, compositing it with the given opacity. | |
| virtual void | pushFilterLayer (std::span< const FilterEffect > effects)=0 |
| Pushes a filter layer that applies the given effect chain to all content drawn within it. | |
| virtual void | popFilterLayer ()=0 |
| Pops the most recent filter layer. | |
| virtual void | pushMask (const std::optional< Boxd > &maskBounds)=0 |
| Begins mask rendering. | |
| virtual void | transitionMaskToContent ()=0 |
| Transitions from rendering mask content to rendering masked content. | |
| virtual void | popMask ()=0 |
| Pops the mask layer stack, compositing the masked content. | |
| virtual void | beginPatternTile (const Boxd &tileRect, const Transformd &patternToTarget)=0 |
| Begins recording content into a pattern tile. | |
| virtual void | endPatternTile (bool forStroke)=0 |
| Ends pattern tile recording and sets the resulting tiled shader as the current fill or stroke paint. | |
| virtual void | setPaint (const PaintParams &paint)=0 |
| Sets the active paint parameters used by subsequent draw calls. | |
| virtual void | drawPath (const PathShape &path, const StrokeParams &stroke)=0 |
| Draws an arbitrary path using the current paint state. | |
| virtual void | drawRect (const Boxd &rect, const StrokeParams &stroke)=0 |
| Convenience helper for drawing axis-aligned rectangles. | |
| virtual void | drawEllipse (const Boxd &bounds, const StrokeParams &stroke)=0 |
| Convenience helper for drawing ellipses bounded by the provided box. | |
| virtual void | drawImage (const ImageResource &image, const ImageParams ¶ms)=0 |
| Draws an image resource into the given target rectangle. | |
| virtual void | drawText (const components::ComputedTextComponent &text, const TextParams ¶ms)=0 |
| Draws pre-shaped text with the provided paint parameters. | |
| virtual RendererBitmap | takeSnapshot () const =0 |
| Captures a CPU-readable snapshot of the current frame buffer for testing or downstream consumers. | |
| virtual std::unique_ptr< RendererInterface > | createOffscreenInstance () const |
| Creates an independent offscreen renderer instance of the same type as this one. | |
Backend-agnostic rendering interface consumed by the traversal driver.
|
pure virtual |
Begins a render pass with the given viewport.
Implementations may allocate or reset backend-specific frame resources here.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Begins recording content into a pattern tile.
Content drawn between beginPatternTile and endPatternTile is captured as a repeating pattern.
| tileRect | The tile rectangle in pattern coordinate space. |
| patternToTarget | Transform from pattern tile space to target element space. |
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
inlinenodiscardvirtual |
Creates an independent offscreen renderer instance of the same type as this one.
Used for rendering sub-documents into intermediate pixmaps when a backend needs an isolated offscreen pass. Returns nullptr if offscreen rendering is not supported.
Reimplemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Renders the given SVG document.
Implementations prepare the document, traverse the render tree, and emit drawing commands.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Convenience helper for drawing ellipses bounded by the provided box.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Draws an image resource into the given target rectangle.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Draws an arbitrary path using the current paint state.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Convenience helper for drawing axis-aligned rectangles.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Draws pre-shaped text with the provided paint parameters.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Completes the current render pass, flushing any pending work.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Ends pattern tile recording and sets the resulting tiled shader as the current fill or stroke paint.
| forStroke | If true, set the pattern as the stroke paint; otherwise as the fill paint. |
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
nodiscardpure virtual |
Returns the rendered height in device pixels.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pops the most recent clip from the renderer stack.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pops the most recent filter layer.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pops the most recent isolated layer, compositing it with the given opacity.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pops the mask layer stack, compositing the masked content.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pops the most recent transform from the renderer stack.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pushes a clip path/mask onto the renderer stack.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pushes a filter layer that applies the given effect chain to all content drawn within it.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pushes an isolated compositing layer with the given opacity.
Content drawn between pushIsolatedLayer and popIsolatedLayer is composited as a group at the specified opacity.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Begins mask rendering.
The driver renders the mask content between pushMask and transitionMaskToContent, then renders the actual content between transitionMaskToContent and popMask.
| maskBounds | Optional clip rect for the mask region. |
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Pushes a transform onto the renderer stack, composing with the current transform.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Sets the active paint parameters used by subsequent draw calls.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Sets the absolute transform on the renderer, replacing the current matrix.
Unlike pushTransform, this does not interact with the save/restore stack.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
nodiscardpure virtual |
Captures a CPU-readable snapshot of the current frame buffer for testing or downstream consumers.
The snapshot must remain valid after the render pass completes.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
pure virtual |
Transitions from rendering mask content to rendering masked content.
Must be called between pushMask and popMask.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.
|
nodiscardpure virtual |
Returns the rendered width in device pixels.
Implemented in donner::svg::RendererSkia, and donner::svg::RendererTinySkia.