/**
 * Shared canvas-rendering primitives used by `bar`/`area`/`line`/`point`
 * renderers (and any future mark renderer that paints a fill, a stroke,
 * or a linear gradient).
 *
 * These are extractions, not abstractions: every function in this module
 * was inline-duplicated across two or more renderers in byte-identical
 * (or near-identical) form. Centralizing them eliminates drift at the
 * "what does the canvas seam look like for a stream renderer" boundary
 * and keeps each renderer focused on its mark-specific path tracing.
 *
 * Anything genuinely chart-shape-specific — `buildBarGradient`'s
 * tip-vs-base coordinate computation from `node.roundedEdge`, the
 * area's strip-decay path, the line's threshold-color crossing logic —
 * stays in the renderer that owns the mark. The helpers here are the
 * mechanical bits that recur regardless of the shape being painted.
 */
import type { CurveType } from "../types";
import type { CurveFactory } from "d3-shape";
/**
 * Structural shapes for the gradient configs the helpers accept. Kept
 * local rather than exported from `types.ts` because today's scene-node
 * interfaces (`AreaSceneNode`, `RectSceneNode`, `LineSceneNode`) declare
 * the same shapes inline. TS structural typing means a caller passing
 * `node.fillGradient` satisfies these types without an explicit cast.
 */
type ColorStop = {
    offset: number;
    color: string;
};
export type ColorStopGradient = {
    colorStops: ColorStop[];
};
export type OpacityGradient = {
    topOpacity: number;
    bottomOpacity: number;
};
export type FillGradient = ColorStopGradient | OpacityGradient;
/**
 * Map a `CurveType` string to a d3-shape curve factory. Returns `null`
 * for `"linear"` and `undefined` so callers can branch on a single
 * "use linear fallback" sentinel instead of a separate has-curve check.
 *
 * Identical implementations previously lived in `areaCanvasRenderer.ts`
 * and `lineCanvasRenderer.ts` — every new curve token had to be added
 * to both switches in lockstep.
 */
export declare function resolveCurveFactory(curve: CurveType | undefined): CurveFactory | null;
/**
 * Resolve a node's `style.fill` (or `style.stroke`) to something the
 * canvas can accept as `fillStyle` / `strokeStyle`:
 *
 *   - Strings go through `resolveCSSColor` so `var(...)` references
 *     resolve via the canvas DOM ancestor's computed style. Without
 *     this, canvas silently rejects CSS-variable strings and falls
 *     back to `#000000`.
 *   - `CanvasPattern` values pass through untouched.
 *   - `null` / `undefined` returns the caller-provided fallback.
 *
 * The previous inline form was
 * `(typeof X === "string" ? resolveCSSColor(ctx, X) : X) || fallback`,
 * repeated once per renderer per fill/stroke site.
 */
export declare function resolveCanvasFill(ctx: CanvasRenderingContext2D, fill: string | CanvasPattern | null | undefined, fallback: string): string | CanvasPattern;
/**
 * Build a linear gradient from a `FillGradient` config. Returns `null`
 * when the gradient cannot be constructed (fewer than two valid color
 * stops in the `colorStops` form, or a non-finite opacity in the
 * `topOpacity` form).
 *
 * The renderer is responsible for choosing the gradient axis (a bar
 * runs tip→base along its value axis; an area runs minTop→maxBottom
 * vertically). The opacity-form path color-normalizes through the
 * canvas via `parseCanvasColor` so named colors (`steelblue`), hsl(),
 * etc. all produce gradients that match the mark's actual fill.
 *
 * Replaces `buildBarGradient` (bar) and the inline gradient block in
 * `areaCanvasRenderer` — both implemented the same two-shape switch
 * with the same offset-clamping and the same parseCanvasColor flow.
 */
export declare function buildLinearFillGradient(ctx: CanvasRenderingContext2D, fillGradient: FillGradient, baseFill: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
/**
 * Build a linear gradient from a `ColorStopGradient` (the stroke-side
 * shape — only the `colorStops` form, no opacity variant). Returns
 * `null` when there aren't enough valid stops to render a gradient.
 *
 * Caller picks the axis. Identical patterns previously lived inline in
 * `areaCanvasRenderer`'s top-stroke branch and `lineCanvasRenderer`'s
 * stroke branch.
 */
export declare function buildColorStopGradient(ctx: CanvasRenderingContext2D, strokeGradient: ColorStopGradient, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
export {};
