Skip to main content

TextLayer

Struct TextLayer 

Source
pub struct TextLayer { /* private fields */ }
Expand description

A timeline’s text clips, ready to render per segment.

Implementations§

Source§

impl TextLayer

Source

pub fn from_timeline( timeline: &Timeline, base_dir: impl Into<PathBuf>, ) -> Result<TextLayer, Error>

Collects the enabled ffcine.text clips of timeline; font files resolve against base_dir (the timeline’s directory).

Source

pub fn new( clips: Vec<TextClip>, frame_size: Option<[f32; 2]>, base_dir: impl Into<PathBuf>, ) -> TextLayer

Text clips (times in seconds of whatever clock Self::overlays is given) laid out on a frame of frame_size px (None: lengths relative to the output); font files resolve against base_dir.

Source

pub fn set_profile(&mut self, name: &str, safe: [f32; 4])

Renders for output profile name (reel, feed, …): a clip’s profiles.<name> parameters override the rest. When the output’s aspect differs from frame_size, lengths scale with the short side instead of the height and each text box is moved inside safe (top, right, bottom, left margins as fractions of the output).

Source

pub fn clips(&self) -> &[TextClip]

Source

pub fn in_range(&self, start: f64, end: f64) -> impl Iterator<Item = &TextClip>

Clips overlapping start..end (timeline seconds).

Source

pub fn cuts(&self) -> Vec<f64>

Every text in and out point, sorted: where a segment renderer should cut so each segment’s text is fixed.

Source

pub fn fingerprint(&self, start: f64, end: f64) -> u64

A hash of the text drawn over start..end: the clips’ parameters and their times relative to start. Equal fingerprints render equal pixels, so it belongs in a segment’s cache key.

Source

pub fn overlays( &mut self, start: f64, frames: u64, rate: f64, out: Size, ) -> Result<Vec<Overlay>, Error>

The overlays for a segment of frames frames at rate starting at timeline second start, rendered at out px. Frame ranges are relative to the segment’s first frame (they may start before 0 or end past frames, so fades carry across segment cuts).

Trait Implementations§

Source§

impl Debug for TextLayer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. 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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.