import { type PathCmd } from './geom.js'; import type { LetteringStyle, Point, Rect } from './types.js'; /** A balloon body: its outline, the polygon standing for it, its box. */ export interface Body { cmds: PathCmd[]; /** Outer outline as a polygon (the tips of a burst, the bumps of a * cloud), clockwise on the page. */ hull: Point[]; /** The smooth core the decoration grows from (the valleys of a burst or * a cloud); the hull itself for plain shapes. Tails leave from it. */ core: Point[]; bbox: Rect; centre: Point; /** Lengths that shape the tail (em of the text). */ em: number; /** Superellipse semi-axes of the core, when it is one. */ axes?: { a: number; b: number; }; /** A burst: `hull` alternates valley, spike tip, valley… (a tail then * grows out of a spike, see {@link buildTail}). */ star?: true; } /** The smallest-area superellipse `|x/a|^n + |y/b|^n <= 1` about `c` that * holds every point. */ export declare function fitSuperellipse(points: readonly Point[], c: Point, n: number): { a: number; b: number; }; /** Build the body of a balloon around its text's ink (`ink`, page px). */ export declare function buildBody(ink: readonly Rect[], em: number, style: LetteringStyle, seed: string): Body; /** A body moved by (dx, dy). */ export declare function translateBody(body: Body, dx: number, dy: number): Body; /** How a tail is drawn. */ export interface TailOptions { /** The target lies on the panel border (an off-panel speaker): the tip * runs right to it. */ offPanel?: boolean; /** Stroke width, px: how far inside the body the tail starts. */ strokeWidth: number; /** Bend sign for a curved tail (+1 / -1): Kurlander's tails curve away * from the reading side. */ bend?: number; /** The speaker's face: the tip stops short of it, so that the tail * points at the mouth without running over the face. */ face?: Rect; } /** A tail as path commands, and its tip. */ export interface Tail { cmds: PathCmd[]; tip: Point; /** Where it leaves the body. */ base: Point; /** The body's outline to draw with this tail, when the tail replaces a * part of it (a burst's tail is the spike it grows from: the spike is * left out, so no notch is left between the tail and the spike). */ body?: PathCmd[]; } /** * The tail of `body` toward `target` (SPEC D3.2): it leaves the body * perpendicular to the wall where the line from the centre to the target * crosses it, aims at the target, tapers, and stops `tailReach` of the way * there (never closer than `tailGap`), or at the border for an off-panel * speaker. Undefined when the target is inside the body or too close. */ export declare function buildTail(body: Body, target: Point, style: LetteringStyle, opts: TailOptions): Tail | undefined; /** * How long a tail runs from the body's wall toward a target `gap` px away: * `tailReach` of the way (Blambot's half to three fifths), never closer to * the target than `tailGap`, and never stopping farther from it than 2.5 * em — a balloon set far from its speaker gets a longer tail, so that every * tip ends about as near its mouth (Kurlander's tails end together). An * off-panel tail runs to the border. */ export declare function tailLength(gap: number, em: number, style: Pick, offPanel: boolean): number; /** A neck joining two bodies of one speaker (a connector, SPEC D3.2): it * runs from centre to centre, narrow in the middle, and starts inside * both bodies. */ export declare function buildNeck(a: Body, b: Body, strokeWidth: number): PathCmd[]; /** The dash pattern of a style, px (absent: solid). */ export declare function dashOf(style: LetteringStyle): number[] | undefined; //# sourceMappingURL=shapes.d.ts.map