PlottingSVG::SVGRectangleRenderer
PlottingSVG::SVGRectangleRenderer
Stateless conversion from [CorePlotting::RenderableRectangleBatch]() to SVG <rect> strings. More…
#include <SVGRectangleRenderer.hpp>
Public Functions
| Name | |
|---|---|
| std::vector< std::string > | render(CorePlotting::RenderableRectangleBatch const & batch, glm::mat4 const & view, glm::mat4 const & projection, int canvas_width, int canvas_height) Convert one rectangle batch to SVG fragments in canvas pixel space. |
Detailed Description
class PlottingSVG::SVGRectangleRenderer;Stateless conversion from [CorePlotting::RenderableRectangleBatch]() to SVG <rect> strings.
Each bounds[i] is (x, y, width, height) in world space (same packing as the GL path). Corners are transformed with [transformVertexToSVG](/api_generated/Namespaces/namespacePlottingSVG.md#function-transformvertextosvg); SVG x/y/width/height use min and abs so negative width or height still yield a non-negative axis-aligned box. entity_ids and selection_flags on the batch are not consulted here (no stroke or highlight pass in SVG).
Public Functions Documentation
function render
static std::vector< std::string > render(
CorePlotting::RenderableRectangleBatch const & batch,
glm::mat4 const & view,
glm::mat4 const & projection,
int canvas_width,
int canvas_height
)Convert one rectangle batch to SVG fragments in canvas pixel space.
Parameters:
- batch Per-instance
boundsasglm::vec4(x, y, width, height)in world space; optional parallelcolors(RGBA per rectangle whencolors.size() > i). - view Shared view matrix (same convention as OpenGL rendering).
- projection Shared projection matrix.
- canvas_width Target SVG width in pixels.
- canvas_height Target SVG height in pixels.
Precondition:
canvas_width > 0andcanvas_height > 0if output should match the same NDC→pixel mapping as live OpenGL rendering (enforcement: none) [IMPORTANT]batch.bounds[i]components should be finite for meaningful pixel geometry (enforcement: none) [LOW]- If
batch.colorsis non-empty, only indicesi < batch.colors.size()read a per-rect color; otherwise each rectangle uses RGB white withfill-opacity``0.5fas the implementation default (enforcement: none) [LOW]
Postcondition:
- Returns an empty vector when
batch.boundsis empty. - Otherwise returns exactly one
<rect fill="…" fill-opacity="…" stroke="none"/>string per bounds entry, in order. - Fill RGB comes from
[colorToSVGHex](/api_generated/Namespaces/namespacePlottingSVG.md#function-colortosvghex); alpha is written asfill-opacity(unlike stroke-only paths that sometimes omit alpha). - Does not throw under normal
std::string/ostringstreambehavior.
Updated on 2026-11-13 at 20:25:41 +0000