Skip to main content

CrossfadeNode

Struct CrossfadeNode 

Source
pub struct CrossfadeNode {
    pub factor: f32,
    pub to_rgba: Vec<u8>,
    pub to_width: u32,
    pub to_height: u32,
}
Expand description

Linear crossfade between two RGBA frames.

  • factor = 0.0 → output equals the input frame (inputs[0] / process_cpu argument).
  • factor = 1.0 → output equals to_rgba.
  • factor = 0.5 → arithmetic mean of both frames.

The “to” frame is stored in the node at construction time.

Fields§

§factor: f32

Blend factor: 0.0 (from) → 1.0 (to).

§to_rgba: Vec<u8>

The “to” frame as RGBA bytes. Length must equal to_width × to_height × 4.

§to_width: u32

Width of to_rgba.

§to_height: u32

Height of to_rgba.

Implementations§

Source§

impl CrossfadeNode

Source

pub fn new(factor: f32, to_rgba: Vec<u8>, to_width: u32, to_height: u32) -> Self

Construct a crossfade node.

to_rgba is the “to” frame (second input). It must be to_width × to_height × 4 bytes of RGBA data.

Trait Implementations§

Source§

impl RenderNodeCpu for CrossfadeNode

Source§

fn process_cpu(&self, rgba: &mut [u8], _w: u32, _h: u32)

Process rgba in-place. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.