#[non_exhaustive]pub enum Filter {
Nearest,
Box,
Bilinear,
CatmullRom,
Mitchell,
Lanczos2,
Lanczos3,
}Expand description
A resampling filter kernel (SPEC §Core ops).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Nearest
Nearest neighbour. Fastest, blockiest; the only filter that preserves exact sample values, which is why it is the right default for masks and palettes rather than photographs.
Box
Box average over the source footprint. The correct choice for large downscales, where it is both fast and alias-free.
Bilinear
Linear interpolation between the two nearest samples.
CatmullRom
Catmull-Rom cubic. Sharper than Mitchell, mild ringing.
Mitchell
Mitchell-Netravali cubic (B=C=1/3). The usual compromise between blurring and ringing.
Lanczos2
Lanczos windowed sinc, 2 lobes.
Lanczos3
Lanczos windowed sinc, 3 lobes. The default: sharpest of these at the cost of some ringing on hard edges.
Implementations§
Source§impl Filter
impl Filter
Sourcepub const fn support(self) -> f32
pub const fn support(self) -> f32
The filter’s radius in output units before scale is applied.
The actual support in input pixels is this scaled by the downsampling ratio, because downscaling must average over everything it discards or it aliases.