Skip to content

PathRecorder

Defined in: core/path-recorder.ts:9

Records PathContext drawing calls into flattened polylines (subpaths). This is the retained-mode capture used by GPU backends: call a d3 generator into a PathRecorder once, then hand the subpaths to the tessellator.

new PathRecorder(tolerance?): PathRecorder

Defined in: core/path-recorder.ts:19

Flattening tolerance in coordinate units.

number = 0.25

PathRecorder

tolerance: number = 0.25

Defined in: core/path-recorder.ts:19

get subpaths(): readonly Subpath[]

Defined in: core/path-recorder.ts:21

readonly Subpath[]

arc(x, y, radius, startAngle, endAngle, counterclockwise?): void

Defined in: core/path-recorder.ts:80

number

number

number

number

number

boolean = false

void

PathContext.arc


arcTo(_x1, _y1, _x2, _y2, _radius): void

Defined in: core/path-recorder.ts:103

number

number

number

number

number

void

PathContext.arcTo


beginPath(): void

Defined in: core/path-recorder.ts:25

void

PathContext.beginPath


bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): void

Defined in: core/path-recorder.ts:65

number

number

number

number

number

number

void

PathContext.bezierCurveTo


closePath(): void

Defined in: core/path-recorder.ts:122

void

PathContext.closePath


lineTo(x, y): void

Defined in: core/path-recorder.ts:44

number

number

void

PathContext.lineTo


moveTo(x, y): void

Defined in: core/path-recorder.ts:35

number

number

void

PathContext.moveTo


quadraticCurveTo(cpx, cpy, x, y): void

Defined in: core/path-recorder.ts:57

number

number

number

number

void

PathContext.quadraticCurveTo


rect(x, y, w, h): void

Defined in: core/path-recorder.ts:113

number

number

number

number

void

PathContext.rect


translate(dx, dy): void

Defined in: core/path-recorder.ts:30

Shift all subsequent path coordinates by (dx, dy), accumulating like CanvasRenderingContext2D.translate. The canonical d3 idiom for placing an origin-centred generator (radial trees, chords, …) at an offset: call translate(cx, cy) once, then run the generator into this context unchanged.

This is the only transform in the seam — no rotate/scale/save/restore. Radial generators bake angle into their coordinates, so a translation is all they need; a richer transform stack would complicate every backend for no current consumer. The offset is part of context state (not reset by beginPath) and, in retained backends, lives only for the single drawable the callback is recording.

number

number

void

PathContext.translate