/** * SVG path data (`d`) read into the commands of a vector design block * (`VDTPathCommand`, DESIGN §12.8, #1060): `M L H V C S Q T A Z`, absolute * and relative, with implicit repeats (`M0 0 1 1` is a move and a line). * Horizontal and vertical lines become lines, the smooth curves (`S`, `T`) * their full cubic and quadratic with the reflected control point, an arc * cubic curves of at most a quarter turn each. The outcome is in the units * the data is written in (a design element's `viewBox`); `mapPath` places * it on the page. * * One pass over the characters, no regular expressions: the time is linear * in the length of the data, whatever it holds. Data that breaks the * grammar (a letter that is no command, a command short of its numbers, a * path that does not open with a move, an arc flag other than 0 or 1) * yields an error and no outline: a design draws nothing rather than half * a shape. */ import type { VDTPathCommand } from '../vdt.js'; /** The longest path data read (characters): a design's shape is a few * hundred; anything far longer is no decoration. */ export declare const MAX_PATH_DATA_LENGTH = 65536; export type SvgPathParse = { ok: true; subpaths: VDTPathCommand[][]; } | { ok: false; error: string; at: number; }; /** The outline `d` describes, in its own units; or why it cannot be read. */ export declare function parseSvgPath(d: string): SvgPathParse; /** * An elliptical arc from `(x0, y0)` to `(x, y)` as cubic Bézier curves * (SVG 1.1 implementation notes F.6): radii scaled up when too small to * reach, a zero radius a straight line, the same point nothing. Each curve * spans at most a quarter turn. */ export declare function arcToCubics(x0: number, y0: number, rxIn: number, ryIn: number, angleDeg: number, largeArc: boolean, sweep: boolean, x: number, y: number): VDTPathCommand[]; /** `subpaths` mapped by `x' = ox + x·sx`, `y' = oy + y·sy` (a viewBox laid * on a box: an affine map, under which a Bézier curve stays one). */ export declare function mapPath(subpaths: readonly (readonly VDTPathCommand[])[], ox: number, oy: number, sx: number, sy: number): VDTPathCommand[][]; /** `parseSvgPath`, remembered per data string. The outline returned is * shared: map it (`mapPath`), never change it. */ export declare function parseSvgPathCached(d: string): SvgPathParse; /** The `viewBox` a path element is written in: `[1, 1]` when unset, none * when either side is not a positive finite number. */ export declare function pathViewBox(vb: unknown): [number, number] | undefined; //# sourceMappingURL=svgPath.d.ts.map