pub struct TextLayer { /* private fields */ }Expand description
A timeline’s text clips, ready to render per segment.
Implementations§
Source§impl TextLayer
impl TextLayer
Sourcepub fn from_timeline(
timeline: &Timeline,
base_dir: impl Into<PathBuf>,
) -> Result<TextLayer, Error>
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).
Sourcepub fn new(
clips: Vec<TextClip>,
frame_size: Option<[f32; 2]>,
base_dir: impl Into<PathBuf>,
) -> TextLayer
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.
Sourcepub fn set_profile(&mut self, name: &str, safe: [f32; 4])
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).
pub fn clips(&self) -> &[TextClip]
Sourcepub fn in_range(&self, start: f64, end: f64) -> impl Iterator<Item = &TextClip>
pub fn in_range(&self, start: f64, end: f64) -> impl Iterator<Item = &TextClip>
Clips overlapping start..end (timeline seconds).
Sourcepub fn cuts(&self) -> Vec<f64>
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.
Sourcepub fn fingerprint(&self, start: f64, end: f64) -> u64
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.
Sourcepub fn overlays(
&mut self,
start: f64,
frames: u64,
rate: f64,
out: Size,
) -> Result<Vec<Overlay>, Error>
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).