Custom Renderer
Overview
rs-grid's architecture is renderer-agnostic. The scene layer produces
a SceneFrame — a flat list of drawing primitives — that any rendering
backend can consume. The built-in Canvas2D renderer is just one implementation.
Architecture
Your custom renderer only depends on rs-grid-scene. It does not need
rs-grid-core, rs-grid-web, or rs-grid-render-canvas.
Steps
1. Add the dependency
2. Build a SceneFrame
3. Iterate primitives
Coordinate system
All coordinates are in logical pixels (CSS pixels). Your renderer must apply the device pixel ratio (DPR) scaling:
Draw order
Primitives in SceneFrame are ordered back-to-front. Draw them in
sequence — later primitives should paint over earlier ones.
Rules
- Do not modify
rs-grid-coreorrs-grid-scene SceneFrameis immutable — produced fresh each frame- All state lives in
GridState, not in your renderer