pub struct ResizePlan { /* private fields */ }Expand description
A validated, reusable full-canvas RGBA resize operation.
Build one plan per source canvas, then apply it to each composited frame of
an animation. Self::transform_frame preserves the frame duration.
Implementations§
Source§impl ResizePlan
impl ResizePlan
Sourcepub fn new(
source: CanvasSize,
options: ResizeOptions,
) -> Result<Self, ResizeError>
pub fn new( source: CanvasSize, options: ResizeOptions, ) -> Result<Self, ResizeError>
Validates resize options and derives the destination canvas.
The destination preserves the source aspect ratio, fits within the configured maximum, and never crops or pads pixels.
Sourcepub const fn source(&self) -> CanvasSize
pub const fn source(&self) -> CanvasSize
Returns the source canvas expected by this plan.
Sourcepub const fn destination(&self) -> CanvasSize
pub const fn destination(&self) -> CanvasSize
Returns the destination canvas produced by this plan.
Sourcepub fn transform_rgba(&self, source_rgba: &[u8]) -> Result<Vec<u8>, ResizeError>
pub fn transform_rgba(&self, source_rgba: &[u8]) -> Result<Vec<u8>, ResizeError>
One-shot convenience API for one complete, tightly packed RGBA canvas.
It allocates a workspace and output buffer for this call. For sequential
animation frames, create one ResizeWorkspace with Self::workspace
and reuse it instead.
Sourcepub fn workspace(&self) -> Result<ResizeWorkspace, ResizeError>
pub fn workspace(&self) -> Result<ResizeWorkspace, ResizeError>
Creates reusable resize state for sequential animation frames.
Reuse this workspace for the full animation to retain its resizer and destination buffer between frames.
Sourcepub fn transform_frame(
&self,
frame: AnimationFrame,
) -> Result<AnimationFrame, ResizeError>
pub fn transform_frame( &self, frame: AnimationFrame, ) -> Result<AnimationFrame, ResizeError>
One-shot convenience API that transforms a decoded frame and preserves its duration.
It allocates for every call. For animation processing, prefer a reused
ResizeWorkspace and construct the output frame at the call site.
Trait Implementations§
Source§impl Clone for ResizePlan
impl Clone for ResizePlan
Source§fn clone(&self) -> ResizePlan
fn clone(&self) -> ResizePlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more