/** * QA360 Visual Comparison Module * * P0 Features: Pixel diff for visual regression testing * - Pixel-by-pixel comparison * - Perceptual diff with anti-aliasing tolerance * - Configurable thresholds * - Diff image generation */ /** * Pixel comparison result */ export interface PixelDiffResult { /** Whether images are considered identical */ identical: boolean; /** Number of differing pixels */ diffPixels: number; /** Total pixels compared */ totalPixels: number; /** Percentage of difference (0-100) */ diffPercentage: number; /** Path to generated diff image */ diffImagePath?: string; } /** * Pixel comparison options */ export interface PixelDiffOptions { /** Maximum allowed difference percentage (0-100) */ threshold?: number; /** Pixel color difference threshold (0-255) */ pixelThreshold?: number; /** Whether to generate a diff image */ generateDiffImage?: boolean; /** Output directory for diff images */ outputDir?: string; /** Antialiasing tolerance (ignore minor color differences) */ antialiasing?: boolean; } /** * Pixel Diff Comparator */ export declare class PixelDiff { /** * Compare two images pixel by pixel * * @param image1Path - Path to baseline image * @param image2Path - Path to current image * @param options - Comparison options * @returns Comparison result */ static compare(image1Path: string, image2Path: string, options?: PixelDiffOptions): Promise; /** * Compare two image buffers directly * * @param buffer1 - First image buffer (PNG) * @param buffer2 - Second image buffer (PNG) * @param options - Comparison options * @returns Comparison result */ static compareBuffers(buffer1: Buffer, buffer2: Buffer, options?: PixelDiffOptions): Promise; /** * Calculate perceptual color difference * Uses Euclidean distance in RGB space */ private static colorDifference; /** * Load image from file path */ private static loadImage; /** * Decode PNG buffer to image data */ private static decodeBuffer; /** * Save diff image to file */ private static saveDiffImage; } /** * Convenience function to compare two images */ export declare function compareImages(image1Path: string, image2Path: string, options?: PixelDiffOptions): Promise; /** * Convenience function to compare two image buffers */ export declare function compareImageBuffers(buffer1: Buffer, buffer2: Buffer, options?: PixelDiffOptions): Promise;