pub struct PipLayout {
pub id: PipId,
pub base_clip: ClipId,
pub pip_clip: ClipId,
pub start: i64,
pub end: i64,
pub keyframes: Vec<PipKeyframe>,
pub default_state: PipState,
pub maintain_aspect: bool,
}Expand description
A picture-in-picture composition that places a secondary video clip
(pip_clip) over a primary clip (base_clip).
The secondary clip’s geometry is driven by a set of keyframes. If there are no keyframes a static default state is used.
Fields§
§id: PipIdUnique identifier.
base_clip: ClipIdThe primary (background) clip.
pip_clip: ClipIdThe secondary (overlay) clip.
start: i64Timeline start (inclusive).
end: i64Timeline end (exclusive).
keyframes: Vec<PipKeyframe>Keyframe list, sorted by time.
default_state: PipStateDefault / static state used when no keyframes are defined.
maintain_aspect: boolWhether to maintain the PiP clip’s aspect ratio when scaling.
Implementations§
Source§impl PipLayout
impl PipLayout
Sourcepub fn new(
id: PipId,
base_clip: ClipId,
pip_clip: ClipId,
start: i64,
end: i64,
) -> Self
pub fn new( id: PipId, base_clip: ClipId, pip_clip: ClipId, start: i64, end: i64, ) -> Self
Create a new PiP layout with the bottom-right preset.
Sourcepub fn add_keyframe(&mut self, kf: PipKeyframe)
pub fn add_keyframe(&mut self, kf: PipKeyframe)
Add a keyframe (sorted insertion).
Sourcepub fn remove_keyframes_at(&mut self, time: i64)
pub fn remove_keyframes_at(&mut self, time: i64)
Remove all keyframes at the given time.
Sourcepub fn state_at(&self, time: i64) -> PipState
pub fn state_at(&self, time: i64) -> PipState
Evaluate the PiP state at time by linearly interpolating keyframes.
If there are no keyframes the default_state is
returned. If time is before the first keyframe the first keyframe’s
state is returned; if after the last, the last is returned.
Sourcepub fn is_active_at(&self, time: i64) -> bool
pub fn is_active_at(&self, time: i64) -> bool
Returns true if the layout is active at time.
Sourcepub fn keyframe_count(&self) -> usize
pub fn keyframe_count(&self) -> usize
Number of keyframes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PipLayout
impl RefUnwindSafe for PipLayout
impl Send for PipLayout
impl Sync for PipLayout
impl Unpin for PipLayout
impl UnsafeUnpin for PipLayout
impl UnwindSafe for PipLayout
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more