import type { ComparePdfPageResult } from '../types/ComparePdfPageResult.js'; import type { ComparePdfSummary } from '../types/ComparePdfSummary.js'; /** * Computes the unrounded percentage of differing pixels for a compared page. * * The denominator is the area of the normalized comparison canvas — * `max(actualWidth, expectedWidth) * max(actualHeight, expectedHeight)` — which is exactly the * canvas `png-visual-compare` extends both pages onto before counting mismatches. This keeps the * result within `[0, 100]` even when the pages differ in size or aspect ratio; the larger-area * denominator would understate the canvas and could report more than 100%. Returns `0` when the * canvas area is not a positive finite number (e.g. a renderer reported zero or non-finite * dimensions), avoiding `NaN`/`Infinity` leaking into results. * * Percentage threshold decisions must use this unrounded value, not {@link computeMismatchPercent}: * rounding first can turn a real mismatch into an exact 0% match (e.g. 1 differing pixel on a * 5000x5000 canvas is 0.000004%, which rounds to 0.0000 and would incorrectly pass a * `compareThresholdPercent: 0` configuration). * * Named "Percent" rather than "Ratio": the return value is already on the 0–100 scale (directly * comparable to a `compareThresholdPercent`/`matchingThresholdPercent` input), not a 0–1 fraction. */ export declare function computeUnroundedMismatchPercent(mismatchCount: number, actualWidth: number, actualHeight: number, expectedWidth: number, expectedHeight: number): number; /** * Computes the percentage of differing pixels for a compared page, rounded to 4 decimal places * for reporting as the public `mismatchPercent` value. Threshold decisions must use * {@link computeUnroundedMismatchPercent} instead — see its doc comment for why. */ export declare function computeMismatchPercent(mismatchCount: number, actualWidth: number, actualHeight: number, expectedWidth: number, expectedHeight: number): number; /** * Builds the document-level summary from per-page results. Pure: no comparison work is performed. */ export declare function summarizePageResults(pages: readonly ComparePdfPageResult[]): ComparePdfSummary;