Internal post-process for small distance-transform
quantization artifacts on outline edges. The algorithm first calls
find_border_alpha_gaps() to mark only low-alpha pixels connected to the
image exterior. It then scans horizontal, vertical, and diagonal directions.
For each gap width up to max_gap, offset_alpha() samples the alpha values
on opposite sides of each candidate gap. A candidate pixel is raised to the
weaker of the two neighboring alpha values, and only if that pixel was marked
as border-connected. This bridges edge notches while leaving enclosed
interior holes unchanged.
fill_alpha_gaps(alpha, max_gap = 1, alpha_threshold = 0.25)Numeric alpha matrix with eligible border gaps filled.
Numeric alpha matrix.
Default 1. Maximum low-alpha run width, in pixels, to bridge.
Default 0.25. Alpha threshold used to decide which
pixels are low-alpha border gaps.