Skip to main content

fit_within

Function fit_within 

Source
pub fn fit_within(source: [u32; 2], bounds: [u32; 2]) -> [u32; 2]
Expand description

fit_within scales source down to fit bounds, keeping its aspect ratio and never returning a zero side. A source that already fits is returned unchanged.