pub struct ResizeOptions {
pub algorithm: ResizeAlg,
pub cropping: SrcCropping,
pub mul_div_alpha: bool,
}Expand description
Options for configuring a resize process.
Fields§
§algorithm: ResizeAlgDefault: ResizeAlg::Convolution(FilterType::Lanczos3)
cropping: SrcCroppingDefault: SrcCropping::None.
mul_div_alpha: boolEnable or disable consideration of the alpha channel when resizing.
Default: true.
Implementations§
Source§impl ResizeOptions
impl ResizeOptions
pub fn new() -> Self
Sourcepub fn resize_alg(&self, resize_alg: ResizeAlg) -> Self
pub fn resize_alg(&self, resize_alg: ResizeAlg) -> Self
Set resize algorythm.
Sourcepub fn crop(&self, left: f64, top: f64, width: f64, height: f64) -> Self
pub fn crop(&self, left: f64, top: f64, width: f64, height: f64) -> Self
Set crop box for source image.
Sourcepub fn fit_into_destination(&self, centering: Option<(f64, f64)>) -> Self
pub fn fit_into_destination(&self, centering: Option<(f64, f64)>) -> Self
Fit a source image into the aspect ratio of a destination image without distortions.
centering is used to control the cropping position. Use (0.5, 0.5) for
center cropping (e.g. if cropping the width, take 50% off
of the left side, and therefore 50% off the right side).
(0.0, 0.0) will crop from the top left corner (i.e. if
cropping the width, take all the crop off of the right
side, and if cropping the height, take all of it off the
bottom). (1.0, 0.0) will crop from the bottom left
corner, etc. (i.e. if cropping the width, take all the
crop off the left side, and if cropping the height, take
none from the top, and therefore all off the bottom).
Trait Implementations§
Source§impl Clone for ResizeOptions
impl Clone for ResizeOptions
Source§fn clone(&self) -> ResizeOptions
fn clone(&self) -> ResizeOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more