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

WidthBitmap width in pixels
HeightBitmap height in pixels
ComparedPixelsNumber of pixels examined, excluding ignored pixels
ChangedPixelsNumber of compared pixels whose channel difference exceeded ColorTolerance
IgnoredPixelsNumber of pixels covered by IgnoreRects
ChangedRatioChangedPixels divided by ComparedPixels; 0 when no pixel was compared
BoundingBoxSmallest top-left-origin, half-open rectangle enclosing every changed pixel
RegionsFour-connected groups of changed tiles, each with its own bounds and changed-pixel count
MaskOne byte per pixel, 255 for changed and 0 for unchanged or ignored; populated only when IncludeMask was True
OverlayRGB 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.

See also

CompareRenderedPagesWith, TPDFVisualCompareOptions