Struct Scene

Source
pub struct Scene {
    pub layers: Vec<Layer>,
}
Expand description

Ordered paint layers (base + overlays) with optional per-layer clips.

The vector is the final submission order; Scene does not sort or merge layers. An empty scene is valid and renders nothing.

§Examples

use ailloli_ui_runtime::scene::Scene;
assert!(Scene::default().layers.is_empty());

Fields§

§layers: Vec<Layer>

Layers in back-to-front submission order.

Implementations§

Source§

impl Scene

Provides the operations defined for Scene.

Source

pub fn push_layer(&mut self, layer: Layer)

Appends a layer without reordering it by LayerKind.

§Examples
use ailloli_ui_runtime::scene::{ClipStackSnapshot, Layer, Scene};
let mut scene = Scene::default();
scene.push_layer(Layer::base(ClipStackSnapshot::empty()));
assert_eq!(scene.layers.len(), 1);
Source

pub fn push_base_layer(&mut self, clip: ClipStackSnapshot)

Appends an empty base layer using clip.

§Examples
use ailloli_ui_runtime::scene::{ClipStackSnapshot, LayerKind, Scene};
let mut scene = Scene::default();
scene.push_base_layer(ClipStackSnapshot::empty());
assert_eq!(scene.layers[0].kind, LayerKind::Base);
Source

pub fn push_overlay_layer(&mut self, clip: ClipStackSnapshot)

Appends an empty overlay layer using clip.

§Examples
use ailloli_ui_runtime::scene::{ClipStackSnapshot, LayerKind, Scene};
let mut scene = Scene::default();
scene.push_overlay_layer(ClipStackSnapshot::empty());
assert_eq!(scene.layers[0].kind, LayerKind::Overlay);
Source

pub fn from_base_and_overlay( base_clip: Option<ClipShape>, base_cmds: Vec<DrawCmd>, overlay_clip: Option<ClipShape>, overlay_cmds: Vec<DrawCmd>, ) -> Self

Builds exactly two layers: base first and overlay second.

Command vectors are moved without cloning. None clips create empty clip snapshots, and both root flags are false.

§Examples
use ailloli_ui_runtime::scene::{LayerKind, Scene};
let scene = Scene::from_base_and_overlay(None, vec![], None, vec![]);
assert_eq!(scene.layers.len(), 2);
assert_eq!((scene.layers[0].kind, scene.layers[1].kind), (LayerKind::Base, LayerKind::Overlay));

Trait Implementations§

Source§

impl Clone for Scene

Source§

fn clone(&self) -> Scene

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Scene

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Scene

Source§

fn default() -> Scene

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Scene

§

impl !RefUnwindSafe for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl !UnwindSafe for Scene

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<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<A> IntoClickAction<A> for A
where A: Clone + 'static,

Source§

fn into_click_action(self) -> ClickAction<A>

Implements the into_click_action helper used by this module.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Props for T
where T: Clone + 'static,