cosmic::iced::advanced::graphics::image::image_rs::imageops

Function interpolate_nearest

source
pub fn interpolate_nearest<P>(
    img: &impl GenericImageView<Pixel = P>,
    x: f32,
    y: f32,
) -> Option<P>
where P: Pixel,
Expand description

Sample from an image using coordinates in [0, w-1] and [0, h-1], taking the nearest pixel.

Coordinates outside the image bounds will return None, however the behavior for points within half a pixel of the image bounds may change in the future.