TPDFVisualCompareResult
Data types, document comparison, rendering
Description
TPDFVisualCompareResult receives the outcome of CompareRenderedPagesWith: the compared bitmap size, pixel counters, the changed bounding box, connected changed regions and the optional mask and overlay artifacts.
A failed comparison resets the record to an empty result, with zero sizes and counters and no regions, mask or overlay.
Syntax
Delphi
TPDFVisualCompareResult = record
Width, Height: Integer;
ComparedPixels, ChangedPixels, IgnoredPixels: Int64;
ChangedRatio: Double;
BoundingBox: TPDFVisualRect;
Regions: TPDFVisualRegionArray;
Mask: TBytes;
Overlay: TPDFVisualBitmap;
end;Fields
| Width | Bitmap width in pixels |
|---|---|
| Height | Bitmap height in pixels |
| ComparedPixels | Number of pixels examined, excluding ignored pixels |
| ChangedPixels | Number of compared pixels whose channel difference exceeded ColorTolerance |
| IgnoredPixels | Number of pixels covered by IgnoreRects |
| ChangedRatio | ChangedPixels divided by ComparedPixels; 0 when no pixel was compared |
| BoundingBox | Smallest top-left-origin, half-open rectangle enclosing every changed pixel |
| Regions | Four-connected groups of changed tiles, each with its own bounds and changed-pixel count |
| Mask | One byte per pixel, 255 for changed and 0 for unchanged or ignored; populated only when IncludeMask was True |
| Overlay | RGB bitmap of the second page with changed pixels blended towards red; populated only when IncludeOverlay was True |
Remarks
Region bounds are derived from whole tiles, while BoundingBox follows the actual changed pixels, so a region can be larger than the bounding box.
The Mask and Overlay buffers are owned by the caller after a successful call and are released with the record.