Skip to main content

OutputLayer

Struct OutputLayer 

Source
pub struct OutputLayer {
    pub video_source_id: String,
    pub bounds: Rect,
    pub fit: Fit,
    pub z_index: i32,
    pub opacity: f32,
    pub visible: bool,
}
Expand description

A single layer in an output, referencing a source with position and styling.

Stacked by z-index, 0 on top: an output is drawn from its highest z-index down to 0, and layers with the same z-index stack in the order they were added, the later one on top. Each layer independently specifies where and how large its source appears.

§Coordinates

Position and size are in output space, where (0, 0) is the top-left corner of the output texture, regardless of where the output is placed on a monitor.

Fields§

§video_source_id: String

Persistent ID of the video source to render (references VideoSource).

§bounds: Rect

Position and size of this layer within the output, in output coordinates.

§fit: Fit

How the source’s picture sits inside bounds when the shapes differ. Fit::Contain by default: the whole picture, letterboxed.

§z_index: i32

Stacking order: 0 is topmost, higher values are further back.

§opacity: f32

Layer opacity: 0.0 (transparent) to 1.0 (opaque).

§visible: bool

Whether this layer is visible. Hidden layers are skipped during rendering.

Implementations§

Source§

impl OutputLayer

Source

pub fn new(video_source_id: impl Into<String>, bounds: Rect) -> Self

Create a new layer referencing a video source.

Source

pub fn with_fit(self, fit: Fit) -> Self

Set how the picture sits inside the bounds.

Source

pub fn with_z_index(self, z_index: i32) -> Self

Set the stacking order (z-index).

Source

pub fn with_opacity(self, opacity: f32) -> Self

Set the opacity (0.0 to 1.0).

Source

pub fn with_visible(self, visible: bool) -> Self

Set visibility.

Trait Implementations§

Source§

impl Clone for OutputLayer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutputLayer

Source§

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.