Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::geode::GeodePathEncoder Class Reference

Encodes a Path into Slug band decomposition format for GPU rendering. More...

#include "donner/svg/renderer/geode/GeodePathEncoder.h"

Static Public Member Functions

static EncodedPath encode (const Path &path, FillRule fillRule, double tolerance=0.1)
 Encode a path for GPU rendering.

Detailed Description

Encodes a Path into Slug band decomposition format for GPU rendering.

The encoding pipeline:

  1. Convert cubics to quadratics (Path::cubicToQuadratic)
  2. Split curves at Y-monotone points (Path::toMonotonic)
  3. Compute path bounds and determine band count
  4. Assign curves to bands and sort
  5. Generate the whole-path bounding quad (6 vertices = 2 triangles)

The output EncodedPath contains all data needed to fill the path on the GPU.

Member Function Documentation

◆ encode()

EncodedPath donner::geode::GeodePathEncoder::encode ( const Path & path,
FillRule fillRule,
double tolerance = 0.1 )
static

Encode a path for GPU rendering.

Parameters
pathThe path to encode. Will be preprocessed (cubic→quadratic, monotonic split).
fillRuleThe fill rule (non-zero or even-odd) - stored for the fragment shader.
toleranceQuadratic approximation tolerance (default 0.1, suitable for text-size).
Returns
Encoded path data ready for GPU upload, or empty if the path is degenerate.

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