Skip to main content

fit_within

Function fit_within 

Source
pub fn fit_within(src: (u32, u32), bounds: (u32, u32)) -> (u32, u32)
Expand description

Scale src down to fit inside bounds, preserving aspect ratio. Returns src unchanged when it already fits — the never-upscale rule.