/** * Helpers of the vector design block (`VDTDesignPathBlock`, DESIGN §12.1, * #1055) the backends and the passes that move, recolour or read design * blocks share: the outline of a marker, the SVG `d` of the outline, the * box of the ink, a quadratic curve as a cubic (PDF has no quadratic), and * moving every point of a block. */ import { type BoundingBox, type VDTDesignPathBlock, type VDTPathCommand, type VDTPathMarker } from '../vdt.js'; /** The shape of a marker: a dot is a circle `sizePx` across centred on the * point; an arrow a triangle whose tip is the point, `sizePx` long along * `angle`, its base `0.7 × sizePx` wide; both filled. A ring (#1079) is a * circle stroked `widthPx` wide whose outer edge is `sizePx` across (`r` * the stroke's middle), centred on the point; a bar (#1079) a segment * `sizePx` long across `angle`, centred on the point, stroked `widthPx` * wide with square-cut ends. */ export type PathMarkerOutline = { kind: 'dot'; cx: number; cy: number; r: number; } | { kind: 'arrow'; points: [{ x: number; y: number; }, { x: number; y: number; }, { x: number; y: number; }]; } | { kind: 'ring'; cx: number; cy: number; r: number; widthPx: number; } | { kind: 'bar'; points: [{ x: number; y: number; }, { x: number; y: number; }]; widthPx: number; }; export declare function pathMarkerOutline(m: VDTPathMarker): PathMarkerOutline; /** * `color` (a `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa` hex) with its alpha * times `opacity` (#1079), as `#rrggbbaa`. An opacity that is not a number * below 1 leaves the colour as it is; any other colour form is returned * unchanged. */ export declare function colorWithOpacity(color: string, opacity: number | undefined): string; /** The SVG path data of `subpaths`, shifted by `(-ox, -oy)` (an `` * placed at `(ox, oy)` on the page). */ export declare function pathSvgData(subpaths: readonly (readonly VDTPathCommand[])[], ox?: number, oy?: number): string; /** The SVG path data of a marker's outline, shifted by `(-ox, -oy)`: the * shape a dot or an arrow fills, the line a ring or a bar strokes. */ export declare function markerSvgData(m: VDTPathMarker, ox?: number, oy?: number): string; /** A marker as an SVG `` element, shifted by `(-ox, -oy)`: filled * (a dot, an arrow) or stroked (a ring, a bar). `attr` escapes the colour * for an attribute. */ export declare function markerSvgElement(m: VDTPathMarker, ox: number, oy: number, attr: (v: string) => string): string; /** The cubic Bézier of a quadratic one from `(x0, y0)` (control points at * two thirds of the way to the quadratic's control point). */ export declare function quadToCubic(x0: number, y0: number, q: Extract): Extract; /** The box of everything a path block inks: its points and control points * (a curve stays inside them), grown by half the stroke's width (a square * cap or a mitre may reach a little further: the box is for hit tests and * clips, not a tight bound), and its markers. An empty block: a zero box * at the origin. */ export declare function pathInkBox(block: Pick): BoundingBox; /** Every point of `block` (outline, control points, markers, `bbox`) * moved by `(dx, dy)`, in place. */ export declare function offsetPathBlock(block: VDTDesignPathBlock, dx: number, dy: number): void; /** A copy of `block` with every point moved by `(dx, dy)`. */ export declare function translatedPathBlock(block: VDTDesignPathBlock, dx: number, dy: number): VDTDesignPathBlock; /** The colours `block` inks: its fill, its stroke and its markers'. */ export declare function pathBlockColors(block: VDTDesignPathBlock): string[]; /** Each colour of `block` (fill, stroke, markers) through `map`, in place. */ export declare function recolorPathBlock(block: VDTDesignPathBlock, map: (color: string) => string): void; /** * Whether `p` falls on the ink of `block`: inside its fill (by its fill * rule), within half its stroke's width of its outline (at least * `tolerancePx`, so a hairline can be hit), or on a marker. A point in the * block's box but off its ink (between the arms of a connector) misses, * so a path never takes a click meant for what lies under it. */ export declare function pathHit(block: VDTDesignPathBlock, p: { x: number; y: number; }, tolerancePx?: number): boolean; //# sourceMappingURL=pathBlock.d.ts.map