pub struct ScaleNode {
pub width: u32,
pub height: u32,
pub algorithm: ScaleAlgorithm,
/* private fields */
}Expand description
Resample a frame to a target resolution.
The GPU path renders into a width x height output target (the executor
allocates a differently sized target from output_dimensions) using the
node’s ScaleAlgorithm sampler, so it truly resizes rather than blitting
same-size. The CPU path is exposed as scale_cpu, which
returns a new resized buffer (the in-place RenderNodeCpu::process_cpu
cannot change dimensions, so it stays a no-op).
A width or height of 0 means “keep the input size” (passthrough).
Fields§
§width: u32Target width in pixels (0 = keep input width).
height: u32Target height in pixels (0 = keep input height).
algorithm: ScaleAlgorithmSampling algorithm.
Implementations§
Source§impl ScaleNode
impl ScaleNode
pub fn new(width: u32, height: u32, algorithm: ScaleAlgorithm) -> Self
Sourcepub fn target_size(&self, in_w: u32, in_h: u32) -> (u32, u32)
pub fn target_size(&self, in_w: u32, in_h: u32) -> (u32, u32)
Output size for the given input size: the configured width x height,
or the input size when either is 0 (passthrough).
Sourcepub fn scale_cpu(&self, src: &[u8], in_w: u32, in_h: u32) -> (Vec<u8>, u32, u32)
pub fn scale_cpu(&self, src: &[u8], in_w: u32, in_h: u32) -> (Vec<u8>, u32, u32)
Resize an RGBA frame on the CPU, returning (pixels, out_w, out_h).
src is in_w x in_h RGBA (in_w * in_h * 4 bytes). The output is
target_size at the node’s ScaleAlgorithm
(Bilinear -> triangle, Bicubic -> Catmull-Rom, Lanczos -> Lanczos3). A
malformed src (wrong length) is returned unchanged.
Trait Implementations§
Source§impl RenderNode for ScaleNode
Available on crate feature wgpu only.
impl RenderNode for ScaleNode
wgpu only.