| 1 | // Last module patch version validated against: 3.1.0
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * A D3 path serializer implementing CanvasPathMethods
|
|---|
| 5 | */
|
|---|
| 6 | export interface Path {
|
|---|
| 7 | /**
|
|---|
| 8 | * Move to the specified point ⟨x, y⟩. Equivalent to context.moveTo and SVG’s “moveto” command.
|
|---|
| 9 | *
|
|---|
| 10 | * @param x x-Coordinate of point to move to
|
|---|
| 11 | * @param y y-Coordinate of point to move to
|
|---|
| 12 | */
|
|---|
| 13 | moveTo(x: number, y: number): void;
|
|---|
| 14 |
|
|---|
| 15 | /**
|
|---|
| 16 | * Ends the current subpath and causes an automatic straight line to be drawn from the current point to the initial point of the current subpath.
|
|---|
| 17 | * Equivalent to context.closePath and SVG’s “closepath” command.
|
|---|
| 18 | */
|
|---|
| 19 | closePath(): void;
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * Draws a straight line from the current point to the specified point ⟨x, y⟩.
|
|---|
| 23 | * Equivalent to context.lineTo and SVG’s “lineto” command.
|
|---|
| 24 | *
|
|---|
| 25 | * @param x x-Coordinate of point to draw the line to
|
|---|
| 26 | * @param y y-Coordinate of point to draw the line to
|
|---|
| 27 | */
|
|---|
| 28 | lineTo(x: number, y: number): void;
|
|---|
| 29 |
|
|---|
| 30 | /**
|
|---|
| 31 | * Draws a quadratic Bézier segment from the current point to the specified point ⟨x, y⟩, with the specified control point ⟨cpx, cpy⟩.
|
|---|
| 32 | * Equivalent to context.quadraticCurveTo and SVG’s quadratic Bézier curve commands.
|
|---|
| 33 | *
|
|---|
| 34 | * @param cpx x-Coordinate of the control point for the quadratic Bézier curve
|
|---|
| 35 | * @param cpy y-Coordinate of the control point for the quadratic Bézier curve
|
|---|
| 36 | * @param x x-Coordinate of point to draw the curve to
|
|---|
| 37 | * @param y y-Coordinate of point to draw the curve to
|
|---|
| 38 | */
|
|---|
| 39 | quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
|
|---|
| 40 |
|
|---|
| 41 | /**
|
|---|
| 42 | * Draws a cubic Bézier segment from the current point to the specified point ⟨x, y⟩, with the specified control points ⟨cpx1, cpy1⟩ and ⟨cpx2, cpy2⟩.
|
|---|
| 43 | * Equivalent to context.bezierCurveTo and SVG’s cubic Bézier curve commands.
|
|---|
| 44 | *
|
|---|
| 45 | * @param cpx1 x-Coordinate of the first control point for the Bézier curve
|
|---|
| 46 | * @param cpy1 y-Coordinate of the first control point for the Bézier curve
|
|---|
| 47 | * @param cpx2 x-Coordinate of the second control point for the Bézier curve
|
|---|
| 48 | * @param cpy2 y-Coordinate of the second control point for the Bézier curve
|
|---|
| 49 | * @param x x-Coordinate of point to draw the curve to
|
|---|
| 50 | * @param y y-Coordinate of point to draw the curve to
|
|---|
| 51 | */
|
|---|
| 52 | bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): void;
|
|---|
| 53 |
|
|---|
| 54 | /**
|
|---|
| 55 | * Draws a circular arc segment with the specified radius that starts tangent to the line between the current point and the specified point ⟨x1, y1⟩
|
|---|
| 56 | * and ends tangent to the line between the specified points ⟨x1, y1⟩ and ⟨x2, y2⟩. If the first tangent point is not equal to the current point,
|
|---|
| 57 | * a straight line is drawn between the current point and the first tangent point. Equivalent to context.arcTo and uses SVG’s elliptical arc curve commands.
|
|---|
| 58 | *
|
|---|
| 59 | * @param x1 x-Coordinate of the first tangent point
|
|---|
| 60 | * @param y1 y-Coordinate of the first tangent point
|
|---|
| 61 | * @param x2 x-Coordinate of the second tangent point
|
|---|
| 62 | * @param y2 y-Coordinate of the second tangent point
|
|---|
| 63 | * @param radius Radius of the arc segment
|
|---|
| 64 | */
|
|---|
| 65 | arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|---|
| 66 |
|
|---|
| 67 | /**
|
|---|
| 68 | * Draws a circular arc segment with the specified center ⟨x, y⟩, radius, startAngle and endAngle. If anticlockwise is true,
|
|---|
| 69 | * the arc is drawn in the anticlockwise direction; otherwise, it is drawn in the clockwise direction.
|
|---|
| 70 | * If the current point is not equal to the starting point of the arc, a straight line is drawn from the current point to the start of the arc.
|
|---|
| 71 | * Equivalent to context.arc and uses SVG’s elliptical arc curve commands.
|
|---|
| 72 | *
|
|---|
| 73 | * @param x x-Coordinate of the center point of the arc segment
|
|---|
| 74 | * @param y y-Coordinate of the center point of the arc segment
|
|---|
| 75 | * @param radius Radius of the arc segment
|
|---|
| 76 | * @param startAngle Start angle of arc segment
|
|---|
| 77 | * @param endAngle End angle of arc segment
|
|---|
| 78 | * @param anticlockwise Flag indicating directionality (true = anti-clockwise, false = clockwise)
|
|---|
| 79 | */
|
|---|
| 80 | arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
|---|
| 81 |
|
|---|
| 82 | /**
|
|---|
| 83 | * Creates a new subpath containing just the four points ⟨x, y⟩, ⟨x + w, y⟩, ⟨x + w, y + h⟩, ⟨x, y + h⟩,
|
|---|
| 84 | * with those four points connected by straight lines, and then marks the subpath as closed. Equivalent to context.rect and uses SVG’s “lineto” commands.
|
|---|
| 85 | *
|
|---|
| 86 | * @param x x-Coordinate of starting point for drawing the rectangle
|
|---|
| 87 | * @param y y-Coordinate of starting point for drawing the rectangle
|
|---|
| 88 | * @param w Width of rectangle
|
|---|
| 89 | * @param h Height of rectangle
|
|---|
| 90 | */
|
|---|
| 91 | rect(x: number, y: number, w: number, h: number): void;
|
|---|
| 92 |
|
|---|
| 93 | /**
|
|---|
| 94 | * Returns the string representation of this path according to SVG’s path data specification.
|
|---|
| 95 | */
|
|---|
| 96 | toString(): string;
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | /**
|
|---|
| 100 | * Construct a D3 Path serializer
|
|---|
| 101 | */
|
|---|
| 102 | export function path(): Path;
|
|---|
| 103 |
|
|---|
| 104 | /**
|
|---|
| 105 | * Like {@link path}, except limits the digits after the decimal to the specified number of digits.
|
|---|
| 106 | * Useful for reducing the size of generated SVG path data.
|
|---|
| 107 | */
|
|---|
| 108 | export function pathRound(digits?: number): Path;
|
|---|