pub fn resize<I: GenericImage + 'static>(
    image: &I,
    nwidth: u32,
    nheight: u32,
    filter: FilterType,
) -> ImageBuffer<I::Pixel, Vec<<I::Pixel as Pixel>::Subpixel>>
where
    I::Pixel: 'static,
    <I::Pixel as Pixel>::Subpixel: 'static,
{
    let mut method = match filter {
        FilterType::Nearest => Filter {
            kernel: Box::new(box_kernel),
            support: 0.0,
        },
        FilterType::Triangle => Filter {
            kernel: Box::new(triangle_kernel),
            support: 1.0,
        },
        FilterType::CatmullRom => Filter {
            kernel: Box::new(catmullrom_kernel),
            support: 2.0,
        },
        FilterType::Gaussian => Filter {
            kernel: Box::new(gaussian_kernel),
            support: 3.0,
        },
        FilterType::Lanczos3 => Filter {
            kernel: Box::new(lanczos3_kernel),
            support: 3.0,
        },
    };

    let tmp = vertical_sample(image, nheight, &mut method);
    horizontal_sample(&tmp, nwidth, &mut method)
}
/// Resize the supplied image to the specified dimensions.
/// ```nwidth``` and ```nheight``` are the new dimensions.
/// ```filter``` is the sampling filter to use.
// TODO: Do we really need the 'static bound on `I`? Can we avoid it?
Resize the supplied image to the specified dimensions.
Resize the supplied image to the specified dimensions .
pub fn resize<I: GenericImage + 'static>(
    image: &I,
    nwidth: u32,
    nheight: u32,
    filter: FilterType,
) -> ImageBuffer<I::Pixel, Vec<<I::Pixel as Pixel>::Subpixel>>
where
    I::Pixel: 'static,
    <I::Pixel as Pixel>::Subpixel: 'static,
{
    let mut method = match filter {
        FilterType::Nearest => Filter {
            kernel: Box::new(box_kernel),
            support: 0.0,
        },
        FilterType::Triangle => Filter {
            kernel: Box::new(triangle_kernel),
            support: 1.0,
        },
        FilterType::CatmullRom => Filter {
            kernel: Box::new(catmullrom_kernel),
            support: 2.0,
        },
        FilterType::Gaussian => Filter {
            kernel: Box::new(gaussian_kernel),
            support: 3.0,
        },
        FilterType::Lanczos3 => Filter {
            kernel: Box::new(lanczos3_kernel),
            support: 3.0,
        },
    };
    let tmp = vertical_sample(image, nheight, &mut method);
    horizontal_sample(&tmp, nwidth, &mut method)
}
pub fn resize < I : GenericImage + ' static > ( image : & I , nwidth : u32 , nheight : u32 , filter : FilterType , ) -> ImageBuffer < I :: Pixel , Vec < < I :: Pixel as Pixel > :: Subpixel > > where I :: Pixel : ' static , < I :: Pixel as Pixel > :: Subpixel : ' static , { let mut method = match filter { FilterType :: Nearest => Filter { kernel : Box :: new ( box_kernel ) , support : 0.0 , } , FilterType :: Triangle => Filter { kernel : Box :: new ( triangle_kernel ) , support : 1.0 , } , FilterType :: CatmullRom => Filter { kernel : Box :: new ( catmullrom_kernel ) , support : 2.0 , } , FilterType :: Gaussian => Filter { kernel : Box :: new ( gaussian_kernel ) , support : 3.0 , } , FilterType :: Lanczos3 => Filter { kernel : Box :: new ( lanczos3_kernel ) , support : 3.0 , } , } ; let tmp = vertical_sample ( image , nheight , & mut method ) ; horizontal_sample ( & tmp , nwidth , & mut method ) }
Resize the supplied image to the specified dimensions.
Resize the supplied image to the specified dimensions .
image
&I
nwidth
u32
nheight
u32
filter
FilterType