/** * Shape geometry * * Pure functions from a rectangle to SVG path data. Kept free of DOM and * reactivity so they can be tested on numbers alone and reused server-side. */ import type { ShapeRect } from '@tachui/types/shapes'; /** * Format a length for path data: fixed precision with float noise trimmed, so * `19.999999999` and `20` produce the same attribute value. */ export declare function formatLength(value: number): string; /** * Shrink `rect` by `by` on every side. Matches SwiftUI's `InsettableShape` * for the built-in shapes, which are all symmetric about the rect's center. * A rect too small to inset collapses to zero size at its center rather than * inverting. */ export declare function insetRect(rect: ShapeRect, by: number): ShapeRect; /** * A circle inscribed in the short side of `rect`, centered, as SwiftUI's * `Circle` draws it. The path starts at the trailing point (3 o'clock) and * runs clockwise, which is the start point `trim` will count from. */ export declare function circlePath(rect: ShapeRect): string; /** * The rect itself. * * Starts at the top-left corner and runs clockwise. Every shape here shares * that direction, and the start point is what `trim` will count from. */ export declare function rectanglePath(rect: ShapeRect): string; /** * The largest corner radius `rect` can carry: half its short side, as SwiftUI * clamps `RoundedRectangle`. * * An SVG `` clamps each axis against its own dimension instead, so * a radius past the short side draws elliptical corners rather than the * capsule SwiftUI gives. That is one of the reasons a shape is drawn as a * ``. */ export declare function clampCornerRadius(rect: ShapeRect, radius: number): number; /** * A rounded rect with `cornerRadius` on all four corners, clamped to half the * short side. Corners are circular arcs, never elliptical. * * The straight edges are emitted even when a corner radius collapses them to * nothing — a capsule's short axis, for instance — so the command sequence is * the same whatever the radius. */ export declare function roundedRectPath(rect: ShapeRect, cornerRadius: number): string; /** * An ellipse filling `rect` — unlike `circlePath`, which inscribes in the * short side. Starts at the trailing point and runs clockwise, as a circle * does. */ export declare function ellipsePath(rect: ShapeRect): string; /** * A rounded rect whose corners are as round as the rect allows: semicircular * caps on the short axis, in either orientation. */ export declare function capsulePath(rect: ShapeRect): string; //# sourceMappingURL=geometry.d.ts.map