/* auto-generated by NAPI-RS */ /* eslint-disable */ /** Compares two images, returning a promise. */ export declare function compare(a: Source, b: Source, options?: JsCompareOptions | undefined | null): Promise /** Compares two images on the calling thread. */ export declare function compareSync(a: Source, b: Source, options?: JsCompareOptions | undefined | null): JsCompareResult /** A connected group of differing pixels. */ export interface JsCluster { x: number y: number width: number height: number diffPixels: number /** The offset the group moved by, when the layout-shift search found one. */ displacement?: JsDisplacement /** Structural similarity to the other image over the group's rectangle. */ ssim?: number } /** * Options controlling a comparison. * * Every field is optional and falls back to the engine default. The names * mirror `CompareOptions` in the Rust API with the anti-aliasing flag renamed * to the word pixelmatch users know it by. */ export interface JsCompareOptions { /** Matching threshold in `[0, 1]`. Defaults to `0.1`, as in pixelmatch. */ threshold?: number /** * Whether pixels differing only by anti-aliasing are excluded. Defaults to * `true`, matching pixelmatch's `includeAA: false`. */ antialiasing?: boolean /** Regions left out of the comparison. */ ignoreRegions?: Array /** Stops the scan once more than `maxDiffPixels` pixels differ. */ failFast?: JsFailFast /** Whether differing pixels are grouped into clusters. Defaults to `false`. */ cluster?: boolean /** * Whether each cluster is searched for the offset it moved by. Defaults to * `false`. */ layoutShift?: boolean /** * Style of the diff image to render, or omitted to render none. * * Passing `{}` renders it with the default style; `alpha` and `color` * override the parts given. */ diff?: JsDiffStyle } /** Result of a comparison. */ export interface JsCompareResult { /** `'match'`, `'differ'` or `'sizeMismatch'`. */ verdict: string /** Number of differing pixels. A lower bound when `stoppedEarly` is set. */ diffPixels: number /** `diffPixels` over the number of compared pixels, or `0` when none were. */ diffRatio: number /** Whether the scan stopped at the fail-fast limit. */ stoppedEarly: boolean /** * Connected groups of differing pixels. Empty unless `cluster` or * `layoutShift` was set. */ clusters: Array /** The rendered diff image, or `null` unless `diff` was set. */ diffImage?: JsDiffImage } /** A rendered diff image in RGBA8. */ export interface JsDiffImage { width: number height: number /** Pixel bytes, `width * height * 4` of them, row by row. */ data: Uint8Array } /** Colors and dimming for the diff image. */ export interface JsDiffStyle { /** * How far unchanged pixels are pulled toward white, in `[0, 1]`. Defaults * to `0.1`. */ alpha?: number /** Color painted over differing pixels, as `[r, g, b]`. Defaults to red. */ color?: Array } /** An offset in pixels. */ export interface JsDisplacement { dx: number dy: number } /** The fail-fast limit. */ export interface JsFailFast { /** Number of differing pixels to tolerate before stopping. */ maxDiffPixels: number } /** A rectangle in pixel coordinates, covering `[x, x + width) x [y, y + height)`. */ export interface JsRect { x: number y: number width: number height: number }