fn inside<P>(image: &Image<P>, x: i32, y: i32, target_pixel: P) -> bool
where
    P: Pixel + PartialEq,
{
    if x < 0 || y < 0 {
        return false;
    }
    let x = x as u32;
    let y = y as u32;
    let (width, height) = image.dimensions();
    x < width && y < height && *image.get_pixel(x, y) == target_pixel
}
Determines whether (x,y) is within the image bounds and if the pixel there is equal to target_color
src/drawing/fill.rs