Skip to main content

Module render

Module render 

Source
Expand description

Rendering backend trait and default traversal logic.

Renderer defines the atomic drawing methods (Canvas API style). The default method Renderer::render_scene is responsible for: sorting nodes stably by z_index via crate::scene::Scene::iter_ordered → applying node attributes (visible / opacity / name / clip) and Transform → recursing into Groups (internally reusing crate::scene::SceneNode::ordered). It also draws the default nodes layer first, then each crate::scene::Layer in order (Renderer::render_layer, applying visible / opacity / transform / name to the whole layer). A backend only needs to implement the atomic methods.

Convention for new primitives: every draw_* has a default implementation that converts the geometry into a kurbo::BezPath and delegates to Renderer::draw_path, so a new backend renders correctly even without overriding them. Backends may override these to emit native markup (e.g. SVG <ellipse> / <rect rx>).

Structs§

SvgRenderer
SVG renderer: accumulates the SVG string.
VelloPixmapRenderer
vello_cpu rasterization renderer.

Enums§

SvgSizing
根节点 width / height 的写法 —— 即 SVG 视口尺寸的来源。

Traits§

Renderer
Rendering backend interface (Canvas API style).