HPDFSampleDataMatrixQuadrilateral

Unit: HPDFDataMatrixGeometry

function HPDFSampleDataMatrixQuadrilateral(const Mask: TBytes;
  Width, Height, Rows, Columns, RegionRows, RegionColumns: Integer;
  const Corners: THPDFBarcodeQuadrilateral;
  CancellationToken: THPDFCancellationToken; StartTick: Cardinal;
  out Grid: THPDFBarcodeModuleGrid): Boolean;

Sample an ECC 200 Data Matrix quadrilateral with finder-border validation before data-module sampling; successful output matches the five-sample majority rule used by HPDFSampleBarcodeQuadrilateral

Mask contains one byte per raster pixel, with nonzero bytes representing dark pixels; Width and Height describe that raster, Rows and Columns describe the complete module grid including finder borders, and RegionRows and RegionColumns count the data regions vertically and horizontally

Region counts must be positive and divide their corresponding module dimensions; each region must be at least three modules wide and high, module dimensions range from 8 to 144, raster dimensions are at most 4096 by 4096, and at most 4,194,304 raster pixels are accepted

Corners follow the normalised top-left, top-right, bottom-right, bottom-left order of the candidate symbol, including its intended orientation and reflection; the sampler checks the solid left and bottom borders and alternating top and right borders of every region

The permitted number of incorrect finder modules is Max(1, BorderModuleCount div 50), matching the decoder's existing ECC 200 finder check; a rejected finder pattern or invalid input returns false with an empty Grid, and successful sampling establishes neither a decoded payload nor valid Reed–Solomon codewords

StartTick is the Windows GetTickCount value from the start of the complete operation; the existing 2,000 ms deadline includes finder and data sampling, and cancellation surfaces as EHPDFOperationCancelled

The generic HPDFSampleBarcodeQuadrilateral function carries on sampling arbitrary module grids without imposing ECC 200 finder semantics

Multi-symbol raster barcode scanning