/** * Round `value * pixelRatio` to a whole device pixel, nudging exact half-pixel ties up so tiny * floating-point jitter near a `.5` boundary does not flip the result ±1px across recomputations. */ export declare function deviceDimension(pixelRatio: number, value: number): number; /** * Snap a device-space centre coordinate to the nearest crisp position for a shape of the given * whole-device-pixel extent (a fill width or a stroke width). Even extents land the centre on a * device-pixel boundary; odd extents land it on a pixel centre. Both pick the *nearest* such * position, so the snap is symmetric about the true centre (max ±0.5 device px) rather than biased. * * A naive `round(centre) + oddExtent/2` is biased: it rounds to a boundary first, so a centre that * already sits on a pixel centre (e.g. 88.5) is pushed a whole pixel to the next one (89.5). Both * bars ({@link alignCentre}) and gridline/crosshair strokes (`Line.render`) share this so a bar and * a matching-parity gridline resolve to the identical device coordinate (AG-17856). */ export declare function snapDeviceCentre(centreDev: number, deviceExtent: number): number; export declare function align(pixelRatio: number, start: number, length?: number): number; export interface AlignedInterval { start: number; length: number; } /** * Whether a bar of this logical length is wide enough for the centre-preserving snap to be worthwhile. * At or below one device pixel {@link alignCentre} falls back to the edge snap: a single-pixel centre * snap offsets the origin by half a device pixel, making the position acutely sensitive to sub-pixel * input jitter (e.g. the float noise very large magnitudes produce, AG-16608), and such a thin bar is * too narrow for centre alignment to be perceptible. */ export declare function centreSnapApplies(pixelRatio: number, length: number): boolean; /** * Snaps a band/bar edge-pair to the device grid while preserving its centre: the length is rounded * to a whole number of device pixels and the centre is snapped so both edges land on device-pixel * boundaries. Odd device-pixel widths snap the centre to a pixel centre (mirroring the odd-stroke * offset in `Line.render`); even widths snap it to a boundary. Unlike {@link align}, which snaps the * two edges independently and can drift the midpoint by up to half a device pixel, this keeps a bar's * centre coincident with its axis tick/gridline. * * Pass `out` to write into a caller-owned scratch object and avoid per-call allocation on hot paths. */ export declare function alignCentre(pixelRatio: number, start: number, length: number, out?: AlignedInterval): AlignedInterval; export declare function alignBefore(pixelRatio: number, value: number): number; export declare function alignAfter(pixelRatio: number, value: number): number;