#[non_exhaustive]pub struct ResizeOptions {
pub filter: Filter,
pub fit: Fit,
pub without_enlargement: bool,
pub without_reduction: bool,
pub position: Position,
pub background: [u8; 4],
}Expand description
Options for Resize.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.filter: FilterThe resampling filter. Defaults to Filter::Lanczos3.
fit: FitHow the target box is interpreted.
without_enlargement: boolNever scale up: an image already smaller than the box is left alone.
without_reduction: boolNever scale down: an image already larger than the box is left
alone (sharp’s withoutReduction).
position: PositionWhich part Fit::Cover keeps and where Fit::Contain places the
image. Centred by default, as in sharp.
background: [u8; 4]The RGBA colour Fit::Contain pads with: opaque black by default,
as in sharp. Grey formats take its luma; formats without alpha
ignore its alpha.
Implementations§
Source§impl ResizeOptions
impl ResizeOptions
Sourcepub const fn with_filter(self, filter: Filter) -> ResizeOptions
pub const fn with_filter(self, filter: Filter) -> ResizeOptions
Options with an explicit filter.
Sourcepub const fn with_fit(self, fit: Fit) -> ResizeOptions
pub const fn with_fit(self, fit: Fit) -> ResizeOptions
Options with an explicit fit mode.
Sourcepub const fn with_background(self, rgba: [u8; 4]) -> ResizeOptions
pub const fn with_background(self, rgba: [u8; 4]) -> ResizeOptions
Options with an explicit padding colour for Fit::Contain.
Sourcepub const fn without_enlargement(self, refuse: bool) -> ResizeOptions
pub const fn without_enlargement(self, refuse: bool) -> ResizeOptions
Options that refuse to enlarge.
Sourcepub const fn without_reduction(self, refuse: bool) -> ResizeOptions
pub const fn without_reduction(self, refuse: bool) -> ResizeOptions
Options that refuse to reduce.
Sourcepub const fn with_position(self, position: Position) -> ResizeOptions
pub const fn with_position(self, position: Position) -> ResizeOptions
Options with an explicit Position for Fit::Cover and
Fit::Contain.
Trait Implementations§
Source§impl Clone for ResizeOptions
impl Clone for ResizeOptions
Source§fn clone(&self) -> ResizeOptions
fn clone(&self) -> ResizeOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more