Function exr::image::crop::try_find_smaller_bounds

source ยท
pub fn try_find_smaller_bounds(
    current_bounds: IntegerBounds,
    pixel_at: impl Fn(Vec2<usize>) -> bool,
) -> Option<IntegerBounds>
Expand description

Return the smallest bounding rectangle including all pixels that satisfy the predicate. Worst case: Fully transparent image, visits each pixel once. Best case: Fully opaque image, visits two pixels. Returns None if the image is fully transparent. Returns [(0,0), size] if the image is fully opaque. Designed to be cache-friendly linear search. Optimized for row-major image vectors.