Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
screenshot_compare.hpp File Reference

Compare two PNG screenshots for visual similarity. More...

#include <string>
#include <vector>
#include <cstdint>

Go to the source code of this file.

Classes

struct  pulp::view::CompareResult
 Result of comparing two screenshots. More...
struct  pulp::view::DiffBounds
 Bounding box of changed pixels between two screenshots. More...
struct  pulp::view::ScreenshotContentStats
 Basic content statistics for a decoded PNG. More...
 Decoder-independent PNG structure and dimensions. More...

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Functions

PngMetadata pulp::view::inspect_png_metadata (const std::vector< uint8_t > &png)
CompareResult pulp::view::compare_screenshots (const std::vector< uint8_t > &reference_png, const std::vector< uint8_t > &rendered_png, uint8_t tolerance=32)
 Compare two PNG images for visual similarity.
CompareResult pulp::view::compare_screenshot_files (const std::string &reference_path, const std::string &rendered_path, uint8_t tolerance=32)
 Compare two PNG files for visual similarity.
std::vector< uint8_t > pulp::view::generate_diff_image (const std::vector< uint8_t > &reference_png, const std::vector< uint8_t > &rendered_png, uint8_t tolerance=32)
 Generate a visual diff image highlighting differences between two PNGs.
std::vector< uint8_t > pulp::view::crop_png (const std::vector< uint8_t > &png, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 Crop a rectangular region from a PNG image and return it as a new PNG.
DiffBounds pulp::view::diff_bounds (const std::vector< uint8_t > &reference_png, const std::vector< uint8_t > &rendered_png, uint8_t tolerance=32)
 Compute the bounding box of pixels that differ beyond the given tolerance.
ScreenshotContentStats pulp::view::analyze_screenshot_content (const std::vector< uint8_t > &png)
 Decode a PNG and compute content statistics suitable for catching empty or stable single-color captures before any parity claim is accepted.

Variables

constexpr float pulp::view::kDefaultSimilarityThreshold = 0.85f
 The default similarity a render must reach to count as matching its reference, as a fraction (0.0-1.0).

Detailed Description

Compare two PNG screenshots for visual similarity.

Used by the design import pipeline to validate that generated Pulp code renders close to the original design.