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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PathRecorder(
tolerance?):PathRecorder
Defined in: core/path-recorder.ts:19
Flattening tolerance in coordinate units — see DEFAULT_CURVE_TOLERANCE.
Parameters
Section titled “Parameters”tolerance?
Section titled “tolerance?”number = DEFAULT_CURVE_TOLERANCE
Returns
Section titled “Returns”PathRecorder
Properties
Section titled “Properties”tolerance
Section titled “tolerance”tolerance:
number=DEFAULT_CURVE_TOLERANCE
Defined in: core/path-recorder.ts:19
Accessors
Section titled “Accessors”subpaths
Section titled “subpaths”Get Signature
Section titled “Get Signature”get subpaths(): readonly
Subpath[]
Defined in: core/path-recorder.ts:21
Returns
Section titled “Returns”readonly Subpath[]
Methods
Section titled “Methods”arc(
x,y,radius,startAngle,endAngle,counterclockwise?):void
Defined in: core/path-recorder.ts:80
Parameters
Section titled “Parameters”number
number
radius
Section titled “radius”number
startAngle
Section titled “startAngle”number
endAngle
Section titled “endAngle”number
counterclockwise?
Section titled “counterclockwise?”boolean = false
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”arcTo()
Section titled “arcTo()”arcTo(
x1,y1,x2,y2,radius):void
Defined in: core/path-recorder.ts:103
Tangent arc with Canvas-2D semantics (#86): line to the point where the circle of
radius touches the segment from the current point towards (x1, y1), then sweep the
short arc to where it touches the segment from (x1, y1) towards (x2, y2), leaving
the current point there. The rounded-corner primitive (rounded bars, CSS-style cards).
Degenerate inputs — zero radius, coincident or collinear points — draw a straight line
to (x1, y1); a negative radius is an error. Retained backends bake it to a polyline
once, at tolerance, so every backend draws the identical geometry.
Parameters
Section titled “Parameters”number
number
number
number
radius
Section titled “radius”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”beginPath()
Section titled “beginPath()”beginPath():
void
Defined in: core/path-recorder.ts:25
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”bezierCurveTo()
Section titled “bezierCurveTo()”bezierCurveTo(
cp1x,cp1y,cp2x,cp2y,x,y):void
Defined in: core/path-recorder.ts:65
Parameters
Section titled “Parameters”number
number
number
number
number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”closePath()
Section titled “closePath()”closePath():
void
Defined in: core/path-recorder.ts:130
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”lineTo()
Section titled “lineTo()”lineTo(
x,y):void
Defined in: core/path-recorder.ts:44
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”moveTo()
Section titled “moveTo()”moveTo(
x,y):void
Defined in: core/path-recorder.ts:35
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”quadraticCurveTo()
Section titled “quadraticCurveTo()”quadraticCurveTo(
cpx,cpy,x,y):void
Defined in: core/path-recorder.ts:57
Parameters
Section titled “Parameters”number
number
number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”rect()
Section titled “rect()”rect(
x,y,w,h):void
Defined in: core/path-recorder.ts:121
Parameters
Section titled “Parameters”number
number
number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”translate()
Section titled “translate()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void