fill_alpha_gaps: Fill Border Alpha Gaps

View source: R/render_alpha_outline.R

fill_alpha_gapsR Documentation

Fill Border Alpha Gaps

Description

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.

Usage

fill_alpha_gaps(alpha, max_gap = 1, alpha_threshold = 0.25)

Arguments

alpha

Numeric alpha matrix.

max_gap

Default 1. Maximum low-alpha run width, in pixels, to bridge.

alpha_threshold

Default 0.25. Alpha threshold used to decide which pixels are low-alpha border gaps.

Value

Numeric alpha matrix with eligible border gaps filled.


rayimage documentation built on June 12, 2026, 5:06 p.m.