pub struct Resize { /* private fields */ }Expand description
Resample an image to a new size.
Implementations§
Source§impl Resize
impl Resize
Sourcepub fn new(
width: u32,
height: u32,
options: ResizeOptions,
) -> Result<Resize, PixelsError>
pub fn new( width: u32, height: u32, options: ResizeOptions, ) -> Result<Resize, PixelsError>
Resize to width by height with options.
§Errors
Returns PixelsError::InvalidArgument if either dimension is zero.
Sourcepub const fn options(&self) -> ResizeOptions
pub const fn options(&self) -> ResizeOptions
The options this op was built with.
Sourcepub fn target(&self, input: &ImageDescriptor) -> (u32, u32)
pub fn target(&self, input: &ImageDescriptor) -> (u32, u32)
The output size for a given input, after fit and enlargement rules.
Computed rather than stored, because the requested box is a constraint and the answer depends on the input the op is eventually chained onto.
Trait Implementations§
Source§impl Op for Resize
impl Op for Resize
Source§fn rescaled(&self) -> Option<Arc<dyn Op>>
fn rescaled(&self) -> Option<Arc<dyn Op>>
Resize pins its own output size, so a smaller input reaches the same answer with less work. This is the op shrink-on-load exists for.
The clone drops the filter tables, which are bound to the input shape they were first built for — reusing them against a reduced source is exactly the resample-at-the-wrong-scale this guards against.
Source§fn output_descriptor(
&self,
inputs: &[ImageDescriptor],
) -> Result<ImageDescriptor, PixelsError>
fn output_descriptor( &self, inputs: &[ImageDescriptor], ) -> Result<ImageDescriptor, PixelsError>
Compute the output shape from the input shapes. Read more
Source§fn input_regions(
&self,
output: Region,
inputs: &[ImageDescriptor],
) -> Result<Vec<Region>, PixelsError>
fn input_regions( &self, output: Region, inputs: &[ImageDescriptor], ) -> Result<Vec<Region>, PixelsError>
The input regions needed to produce
output. Read moreSource§fn access_pattern(&self) -> AccessPattern
fn access_pattern(&self) -> AccessPattern
How this op reads its inputs; drives tile negotiation (ADR-0003). Read more
Auto Trait Implementations§
impl !Freeze for Resize
impl RefUnwindSafe for Resize
impl Send for Resize
impl Sync for Resize
impl Unpin for Resize
impl UnsafeUnpin for Resize
impl UnwindSafe for Resize
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