Skip to main content

Scene

Struct Scene 

Source
pub struct Scene { /* private fields */ }
Expand description

An ordered list of primitives in painter’s order.

Implementations§

Source§

impl Scene

Source

pub fn new() -> Self

Source

pub fn clear(&mut self)

Source

pub fn layer_depth(&self) -> u32

Number of layers currently open (see Scene::push_layer).

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn stats(&self) -> SceneStats

Source

pub fn push_quad(&mut self, quad: &Quad, state: &DrawState)

Source

pub fn push_shadow(&mut self, shadow: &Shadow, state: &DrawState)

Source

pub fn push_mono_sprite( &mut self, bounds: Bounds, tile: &AtlasTile, color: Color, state: &DrawState, )

Draws a coverage-mask sprite (glyph, tintable icon) in color.

Source

pub fn push_poly_sprite( &mut self, bounds: Bounds, tile: &AtlasTile, radii: Corners<f32>, grayscale: bool, state: &DrawState, )

Draws a full color sprite (image, emoji) with optional rounded corners.

Source

pub fn push_backdrop_blur( &mut self, bounds: Bounds, radii: Corners<f32>, blur: f32, tint: Color, state: &DrawState, )

Frosted glass: blurs everything drawn so far behind bounds and draws it clipped to the rounded rect, tinted with tint.

Source

pub fn push_layer(&mut self)

Starts a layer: everything pushed until the matching Scene::pop_layer is drawn into a transparent offscreen target, then composited through a mask. Layers nest.

Source

pub fn pop_layer(&mut self, bounds: Bounds, mask: LayerMask, state: &DrawState)

Ends the innermost layer and composites it inside bounds (device px, transformed and clipped by state) with mask and state.opacity. Content of the layer outside bounds is discarded, like CSS masks.

Source

pub fn push_custom( &mut self, shader: ShaderId, bounds: Bounds, radii: Corners<f32>, params: [f32; 8], time: f32, color: Color, scale: f32, state: &DrawState, )

Draws bounds (rounded by radii) with a registered custom shader. params reach the shader as input.params0/params1, time as input.time, color as input.color; scale is the device scale (device px per logical px).

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Self

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 UnsafeUnpin 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<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> 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, 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.
Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,