Function color_replace

Source
fn color_replace(
    img: &mut Frame,
    from: [f32; 3],
    to: [f32; 3],
    tol: f32,
    soft: f32,
)
Expand description

Key out colours near key (0..255) by their Cb/Cr distance, with spill removal. No edge shrink — that needs neighbourhood taps; shaders::CHROMA_KEY does it on the GPU. Blend every pixel within tol of from towards to, fading out over tol .. tol + soft. Distances are normalised so 1.0 is the full black-to-white diagonal, matching the GPU body.