/* auto-generated by NAPI-RS */ /* eslint-disable */ /** Mutable SVG builder exposed to JavaScript. */ export declare class SvgFile { /** Create an empty SVG document. */ constructor(width: number, height: number, pathPrecision?: number | undefined | null); /** SVG width in pixels. */ get width(): number; /** SVG height in pixels. */ get height(): number; /** Decimal precision used when writing path data. */ get pathPrecision(): number | null; /** Number of paths currently stored in the SVG. */ get pathCount(): number; /** Serialize the SVG document to a string. */ toString(): string; } export type JsSvgFile = SvgFile; /** RGBA color value. */ export interface Color { /** Red channel from 0 to 255. */ r: number; /** Green channel from 0 to 255. */ g: number; /** Blue channel from 0 to 255. */ b: number; /** Optional alpha channel from 0 to 255. */ a?: number; } /** Check whether an RGB color exists in decoded image data asynchronously. */ export declare function colorExistsInImage( img: ImageData, color: Color, signal?: AbortSignal | undefined | null, ): Promise; /** Check whether an RGB color exists in decoded image data synchronously. */ export declare function colorExistsInImageSync(img: ImageData, color: Color): boolean; /** Input color interpretation mode. */ export declare enum ColorMode { /** Trace the image using color clusters. */ Color = 0, /** Trace the image as a black and white image. */ Binary = 1, } /** Vectorization configuration. */ export interface Config { /** True color image or binary image (black and white) */ colorMode: ColorMode; /** Hierarchial clustering or non-stacked. Only applicable to color images. */ hierarchical: Hierarchical; /** Discard patches smaller than X pixels in size (cleaner) */ filterSpeckle: number; /** The number of significant bits to use in an RGB channel (more accurate) */ colorPrecision: number; /** The color difference between gradient layers (less layers) */ layerDifference: number; /** Curve fitting mode */ mode: PathSimplifyMode; /** Minimum momentary angle (degree) to be considered a corner (smoother) */ cornerThreshold: number; /** Perform iterative subdivide smooth until all segments are shorter than this length */ lengthThreshold: number; /** The maximum number of iterations to perform */ maxIterations: number; /** Minimum angle displacement (degree) to splice a spline (less accurate) */ spliceThreshold: number; /** Number of decimal places to use in path string */ pathPrecision?: number; /** Random color search attempts after the reserved key colors are exhausted */ unusedColorIterations?: number; /** Transparent boundary fraction required before keying is applied */ keyingThreshold?: number; /** Maximum cluster bounds treated as a small circle in spline mode */ smallCircle?: number; } /** Find an RGB color that does not exist in decoded image data asynchronously. */ export declare function findUnusedColorInImage( img: ImageData, options?: InternalOptions | undefined | null, signal?: AbortSignal | undefined | null, ): Promise; /** Find an RGB color that does not exist in decoded image data synchronously. */ export declare function findUnusedColorInImageSync(img: ImageData, options?: InternalOptions | undefined | null): Color; /** Color image layer composition mode. */ export declare enum Hierarchical { /** Render traced layers stacked on top of each other. */ Stacked = 0, /** Render traced layers as cutouts. */ Cutout = 1, } /** Decoded RGBA image data. */ export interface ImageData { /** Image width in pixels. */ width: number; /** Image height in pixels. */ height: number; /** RGBA pixel data with four bytes per pixel. */ pixels: Buffer; } /** Internal helper options. */ export interface InternalOptions { /** Random color search attempts after reserved key colors are exhausted. */ unusedColorIterations?: number; } /** Optimize an SVG string asynchronously. */ export declare function optimize( input: string, options?: OptimizeOptions | undefined | null, signal?: AbortSignal | undefined | null, ): Promise; /** Options for SVG optimization. */ export interface OptimizeOptions { /** Built-in optimizer job preset. */ preset?: OptimizePreset; /** SVGO Config["plugins"] compatible job config. When provided, this defines the optimizer job set. */ plugins?: Array; /** Optimizer job names to omit. Names can be camelCase, kebab-case, or snake_case. */ omit?: Array; /** Run optimization repeatedly until output stops changing or the iteration limit is reached. */ multipass?: boolean; /** Maximum multipass iterations. Defaults to 10 when multipass is enabled. */ multipassIterations?: number; } /** Built-in optimization presets. */ export declare enum OptimizePreset { /** Run the default OXVG optimizer job set. */ Default = 0, /** Run the safer OXVG optimizer job set. */ Safe = 1, /** Start with no optimizer jobs. */ None = 2, } /** Optimize an SVG string synchronously. */ export declare function optimizeSync(input: string, options?: OptimizeOptions | undefined | null): string; /** Path simplification strategy used while fitting vector paths. */ export declare enum PathSimplifyMode { /** Do not simplify paths. */ None = 0, /** Simplify paths into polygons. */ Polygon = 1, /** Fit paths as splines. */ Spline = 2, } /** Preconfigured vectorization settings. */ export declare enum Preset { /** Black and white tracing preset. */ Bw = 0, /** Poster-like color tracing preset. */ Poster = 1, /** Photo-like color tracing preset. */ Photo = 2, } /** Dimensions for raw RGBA pixel buffers. */ export interface RawDataConfig { /** Raw image width in pixels. */ width: number; /** Raw image height in pixels. */ height: number; } /** Decode an encoded image buffer or raw RGBA pixel buffer asynchronously. */ export declare function readImage( source: Buffer, args?: RawDataConfig | undefined | null, signal?: AbortSignal | undefined | null, ): Promise; /** Decode an encoded image buffer or raw RGBA pixel buffer synchronously. */ export declare function readImageSync(source: Buffer, args?: RawDataConfig | undefined | null): ImageData; /** Vectorize an encoded image buffer asynchronously. */ export declare function vectorize( source: Buffer, config?: Config | Preset | undefined | null, signal?: AbortSignal | undefined | null, ): Promise; /** Vectorize a raw RGBA pixel buffer asynchronously. */ export declare function vectorizeRaw( source: Buffer, args: RawDataConfig, config?: Config | Preset | undefined | null, signal?: AbortSignal | undefined | null, ): Promise; /** Vectorize a raw RGBA pixel buffer synchronously. */ export declare function vectorizeRawSync( source: Buffer, args: RawDataConfig, config?: Config | Preset | undefined | null, ): string; /** Vectorize a raw RGBA pixel buffer and emit SVG chunks to a callback. */ export declare function vectorizeRawToCallback( source: Buffer, args: RawDataConfig, config: Config | Preset | undefined | null, callback: (chunk: string, progress: number) => void, ): void; /** Vectorize an encoded image buffer synchronously. */ export declare function vectorizeSync(source: Buffer, config?: Config | Preset | undefined | null): string; /** Vectorize an encoded image buffer and emit SVG chunks to a callback. */ export declare function vectorizeToCallback( source: Buffer, config: Config | Preset | undefined | null, callback: (chunk: string, progress: number) => void, ): void;