pub struct Filter { /* private fields */ }
Expand description
Resampling filter.
Implementations§
source§impl Filter
impl Filter
sourcepub fn new(kernel: Box<dyn Fn(f32) -> f32>, support: f32) -> Self
pub fn new(kernel: Box<dyn Fn(f32) -> f32>, support: f32) -> Self
Create a new filter.
Examples
use resize::Filter;
fn kernel(x: f32) -> f32 { f32::max(1.0 - x.abs(), 0.0) }
let filter = Filter::new(Box::new(kernel), 1.0);
sourcepub fn hermite(radius: f32) -> Self
pub fn hermite(radius: f32) -> Self
Hermite filter.
A cubic filter that produces results between Type::Triangle and [Type::Box].
sourcepub fn lagrange(radius: f32) -> Self
pub fn lagrange(radius: f32) -> Self
Lagrange resizing.
Similar to Type::Lanczos3, but with less ringing.
sourcepub fn box_filter(radius: f32) -> Self
pub fn box_filter(radius: f32) -> Self
Box filter.
This is a simple average operation. It’s the ideal filter when downscaling by an integer fraction (e.g. 1/2x, 1/3x, 1/4x). When used for upscaling, it will behave like Type::Point.
Auto Trait Implementations§
impl !RefUnwindSafe for Filter
impl !Send for Filter
impl !Sync for Filter
impl Unpin for Filter
impl !UnwindSafe for Filter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more