pub struct Compositor {
layer: Frame,
src: Frame,
fx: Frame,
pre: Frame,
cov: Vec<u8>,
shapes: ShapeRasterizer,
wipe: Frame,
seq: Vec<Frame>,
sub_style: TextStyle,
sub_key: u64,
}Expand description
Holds scratch buffers so rendering does not allocate per frame.
Fields§
§layer: Frame§src: Frame§fx: FrameEffects scratch (blur passes).
pre: FramePre-effect copy of the layer, for mixing a masked effect back in.
cov: Vec<u8>Mask coverage (0..255), one byte per pixel of whatever buffer the mask is rasterised over.
shapes: ShapeRasterizerVector shapes / drawings (own cache; one per compositor, like the GPU’s texture cache).
wipe: FrameWipe-transition scratch canvas.
seq: Vec<Frame>Nested sequence canvases, one per recursion depth.
sub_style: TextStyleCached subtitle style (subtitle_style + current cue text) to avoid per-frame clones.
sub_key: u64Implementations§
Source§impl Compositor
impl Compositor
pub fn new() -> Self
Sourcepub fn render(
&mut self,
project: &Project,
t: f64,
w: u32,
h: u32,
pool: &mut DecoderPool,
text: &mut TextRasterizer,
out: &mut Frame,
)
pub fn render( &mut self, project: &Project, t: f64, w: u32, h: u32, pool: &mut DecoderPool, text: &mut TextRasterizer, out: &mut Frame, )
Render timeline time t into out at w×h (out is resized). Never panics on missing media:
a clip whose decoder fails is simply skipped.
Sourcefn render_tracks(
&mut self,
project: &Project,
tracks: &[Track],
pw: u32,
t: f64,
w: u32,
h: u32,
pool: &mut DecoderPool,
text: &mut TextRasterizer,
out: &mut Frame,
depth: usize,
)
fn render_tracks( &mut self, project: &Project, tracks: &[Track], pw: u32, t: f64, w: u32, h: u32, pool: &mut DecoderPool, text: &mut TextRasterizer, out: &mut Frame, depth: usize, )
Render a track list onto a fresh opaque-black canvas (recursion entry for nested sequences).
pw = the “project width” the tracks’ clips are placed against (project or sequence width).
Sourcefn render_transition(
&mut self,
project: &Project,
pw: u32,
tr: &Transition,
left: Option<&Clip>,
right: Option<&Clip>,
t: f64,
w: u32,
h: u32,
pool: &mut DecoderPool,
text: &mut TextRasterizer,
out: &mut Frame,
depth: usize,
)
fn render_transition( &mut self, project: &Project, pw: u32, tr: &Transition, left: Option<&Clip>, right: Option<&Clip>, t: f64, w: u32, h: u32, pool: &mut DecoderPool, text: &mut TextRasterizer, out: &mut Frame, depth: usize, )
Blend the two sides of a transition per kind at progress tr.progress. Edge transitions have
one side missing (In: no left, Out: no right): that side is nothing — the black canvas.
Sourcefn render_clip(
&mut self,
project: &Project,
pw: u32,
clip: &Clip,
t: f64,
w: u32,
h: u32,
pool: &mut DecoderPool,
text: &mut TextRasterizer,
out: &mut Frame,
depth: usize,
extra: Extra,
)
fn render_clip( &mut self, project: &Project, pw: u32, clip: &Clip, t: f64, w: u32, h: u32, pool: &mut DecoderPool, text: &mut TextRasterizer, out: &mut Frame, depth: usize, extra: Extra, )
Render one clip’s layer onto out. Does NOT check contains — transitions render clips
virtually extended past their window (source times are clamped to the asset/sequence).
Sourcefn draw_bitmap(
&mut self,
project: &Project,
pw: u32,
clip: &Clip,
img: &Frame,
native: (u32, u32),
t: f64,
w: u32,
h: u32,
out: &mut Frame,
extra: Extra,
opacity: f32,
)
fn draw_bitmap( &mut self, project: &Project, pw: u32, clip: &Clip, img: &Frame, native: (u32, u32), t: f64, w: u32, h: u32, out: &mut Frame, extra: Extra, opacity: f32, )
Draw an already-rasterised layer bitmap (text / shape): effects, fade-to-colour, clip mask.
native is the layer size in canvas px (the bitmap itself may be rasterised smaller).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compositor
impl RefUnwindSafe for Compositor
impl Send for Compositor
impl Sync for Compositor
impl Unpin for Compositor
impl UnwindSafe for Compositor
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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