Function sdf_glyph_renderer::clamp_to_u8[][src]

pub fn clamp_to_u8(sdf: &[f64], cutoff: f64) -> Vec<u8>

Compresses a Vec into a Vec for efficiency.

The highest cutoff percent of values in the range (0-255) will be used to encode negative values (points inside the glyph). This can be tuned based on the intended application.

Panics

The cutoff value must be in the range (0, 1). Values outside this range make no sense and will cause a panic.