Skip to main content

EditorPreview

Struct EditorPreview 

Source
pub struct EditorPreview {
    compose: RecordingCompose,
    screen_slot: FrameSlot,
    cam_slot: FrameSlot,
    width: u32,
    height: u32,
    pad: (f64, f64),
    aspect_fit: (f64, f64),
}
Expand description

Composes the editor preview frame for a source_w × source_h clip into a canvas_w × canvas_h output (the project’s aspect-ratio canvas).

Fields§

§compose: RecordingCompose§screen_slot: FrameSlot§cam_slot: FrameSlot

Always empty — the editor source is pre-composited, so the scene’s camera channel never renders.

§width: u32§height: u32§pad: (f64, f64)

Per-axis screen shrink applied to the transform: the aspect-fit matte (AUT-513) optionally multiplied by the Self::set_background padding inset (ED.18). Defaults to the aspect-fit so an un-styled render still letterboxes the source into a differently-shaped canvas.

§aspect_fit: (f64, f64)

The aspect-fit-only factor (no padding) — the matte that fits the source into the canvas. set_background re-derives pad as padding · this.

Implementations§

Source§

impl EditorPreview

Source

pub fn new(width: u32, height: u32) -> Result<Self, Error>

Allocate the compose pipeline for a clip rendered at its own dimensions (source aspect == canvas aspect, no matte). Equivalent to Self::with_canvas(width, height, width, height).

§Errors

Returns the underlying [wisp::Error] if the wgpu device can’t be created.

Source

pub fn with_canvas( source_w: u32, source_h: u32, canvas_w: u32, canvas_h: u32, ) -> Result<Self, Error>

Allocate the compose pipeline for a source_w × source_h clip rendered into a canvas_w × canvas_h output canvas (AUT-513). When the canvas aspect differs from the source aspect the source is aspect-fit into the canvas (letterbox / pillarbox) rather than stretched — the matte area shows the background. Use [EditProject::canvas_dims] for the canvas; the export path additionally clamps it to the HW-encoder edge cap.

§Errors

Returns the underlying [wisp::Error] if the wgpu device can’t be created.

Source

pub fn set_background(&mut self, bg: &BackgroundConfig)

Apply the project’s background framing (ED.18): the backdrop fill, the padding inset, and the rounded-corner frame window. Call once when the config changes — the export sets it once at generator construction; a live preview re-applies it on edit. After this, the per-frame Self::render_framed folds the stored padding factor into the screen transform, the screen sprite is clipped to the rounded window, and the backdrop renders behind it.

Drop-shadow (shadow) lifts the screen off the backdrop; the inset border (inset) traces a colored edge just inside the frame — both rendered here (ED.18). A Wallpaper source renders a procedural backdrop (wallpaper_rgba, ISS-15) — license-clean, no bundled asset.

Source

fn apply_shadow_and_border( &mut self, bg: &BackgroundConfig, window: Rect, corner_ndc: f32, )

Apply the drop shadow + inset border for the frame window (ED.18). shadow (0..=100) scales a dark, down-right-offset rounded-rect behind the screen; inset (px) strokes a colored border tracing the window. Each hides its node when its value is 0.

Source

pub fn render_frame(&mut self, bgra: Vec<u8>) -> Option<ComposedFrame>

Compose a single source frame. bgra is top-down packed BGRA8 of exactly width * height * 4 bytes (the decoder’s native output); the scene flips it to wisp’s convention internally. Returns None if the byte count doesn’t match the configured dimensions.

Source

pub fn render_framed( &mut self, bgra: Vec<u8>, zoom: ZoomTransform, crop: CropRect, ) -> Option<ComposedFrame>

Compose a source frame with the editor’s framing applied — the crop/aspect reframe (ED.15), the zoom punch-in (ED.16), and the background padding inset (ED.18) are written into the screen sprite’s transform, then the frame composes through the same path as Self::render_frame. The backdrop + rounded-corner clip are set once via Self::set_background; this only updates the per-frame transform. The padding factor is (1, 1) until set_background runs, so an un-styled call is the plain ED.16 transform. This is the export generator’s entry point (ED.20), so preview and export agree frame-for-frame. bgra is top-down packed BGRA8 of width*height*4.

Source

pub fn render_framed_with_cursor( &mut self, bgra: Vec<u8>, zoom: ZoomTransform, crop: CropRect, cursor: Option<(f32, f32)>, ripples: &[(f32, f32, f32)], cfg: &CursorConfig, ) -> Option<ComposedFrame>

Like Self::render_framed, plus the cursor overlay (ED.19). cursor is the smoothed normalized position at this frame ([edit::telemetry::cursor_at]); ripples are the active click ripples ((x, y, age) from [edit::telemetry::ripples_at]). Both the pointer and each ripple are mapped through the same screen transform as the frame, so the cursor stays glued to its pixel through zoom / crop / padding. cursor = None hides the overlay (e.g. before any sample, or a hide_static gap the caller decides).

Source

pub fn render_at( &mut self, stream: &mut EditorVideoStream, player: &EditorPlayer, ) -> Option<ComposedFrame>

Compose the frame at the player’s current playhead, pulling it from the seekable stream. Returns None past the end of the stream.

Source

pub fn dimensions(&self) -> (u32, u32)

Output dimensions in pixels.

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> WasmNotSend for T
where T: Send,