PitchKit
API Reference@pitchkit/coreFunctions

renderDensityLayersToCanvas()

function renderDensityLayersToCanvas(
   scene, 
   canvas, 
   options?
): void;

Defined in: packages/core/src/render/canvas/render-heatmap.ts:26

Paints every density-type layer in a Scene (heatmap, positionalHeatmap, hexbin, kde) onto a 2D canvas, ignoring every other layer type — the SVG renderer handles those. Backs the canvas at cssSize x devicePixelRatio physical pixels and scales the drawing context accordingly (docs/architecture.md#responsive-and-multi-device), so dense layers stay crisp on retina displays without every painter needing to know about DPR itself.

Does not attempt to composite with the SVG renderer's output — stacking the resulting canvas with an <svg> in the DOM is a consumer concern (@pitchkit/react's), not core's.

Parameters

ParameterType
sceneScene
canvasHTMLCanvasElement
optionsRenderHeatmapOptions

Returns

void

On this page