Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
Show 17 fields pub shadows: Vec<Shadow>, pub quads: Vec<Quad>, pub backdrop_blur_rects: Vec<BackdropBlurRect>, pub effect_quads: Vec<EffectQuad>, pub effect_texture_sets: Vec<Arc<EffectTextureSet>>, pub paths: Vec<PaintedPath>, pub underlines: Vec<Underline>, pub monochrome_sprites: Vec<MonochromeSprite>, pub subpixel_sprites: Vec<SubpixelSprite>, pub polychrome_sprites: Vec<PolychromeSprite>, pub surfaces: Vec<PaintSurface>, pub vn_layers: Vec<VnLayer>, pub vn_layer_effects: Vec<Option<VnEffectLayer>>, pub vn_effect_draws: Vec<VnEffectDraw>, pub vn_clip_segments: Vec<[f32; 4]>, pub vn_text_backgrounds: Vec<VnTextBackground>, pub vn_captures: Vec<VnCapture>, /* private fields */
}

Fields§

§shadows: Vec<Shadow>§quads: Vec<Quad>§backdrop_blur_rects: Vec<BackdropBlurRect>§effect_quads: Vec<EffectQuad>§effect_texture_sets: Vec<Arc<EffectTextureSet>>

vue-native fork: the images effect quads sample; EffectQuad::texture_set indexes it.

§paths: Vec<PaintedPath>§underlines: Vec<Underline>§monochrome_sprites: Vec<MonochromeSprite>§subpixel_sprites: Vec<SubpixelSprite>§polychrome_sprites: Vec<PolychromeSprite>§surfaces: Vec<PaintSurface>§vn_layers: Vec<VnLayer>

vue-native fork: the composites of isolated layers (Scene::vn_push_isolation), each drawing one group through its clip shape. After Scene::finish every vector above holds the root group first and then each isolated group’s, in Scene::vn_group_ranges.

§vn_layer_effects: Vec<Option<VnEffectLayer>>

vue-native fork: beside each of Scene::vn_layers, the effects that composite it instead of its clip shape.

§vn_effect_draws: Vec<VnEffectDraw>

vue-native fork: the quads every VnEffectLayer draws, in no group’s order (a layer names its run).

§vn_clip_segments: Vec<[f32; 4]>

vue-native fork: every isolated layer’s clip edges, [x0, y0, x1, y1] in device pixels; a VnLayer names its run.

§vn_text_backgrounds: Vec<VnTextBackground>

Gradient stacks used by text-mask composites, shared across source groups.

§vn_captures: Vec<VnCapture>

vue-native fork: the groups painted for VnIsolation::capture, which the renderer draws first and keeps as snapshots.

Implementations§

Source§

impl Scene

Source

pub fn clear(&mut self)

Source

pub fn vn_push_isolation(&mut self, isolation: VnIsolation)

vue-native fork: opens an isolated layer. Every primitive inserted until the matching Scene::vn_pop_isolation goes into a group of its own, with its own draw orders: the renderer draws the group into an offscreen target and composites it through isolation’s clip, at the draw order the composite takes among its parent’s primitives.

The group is what CSS calls an isolated group: a backdrop filter in it sees what the group painted under it, not the page (the element is a Backdrop Root, Filter Effects 2 §3.1). The same group is where filters on an element’s own painting would apply.

Source

pub fn vn_push_effect(&mut self, effect: VnEffectPaint)

vue-native fork: opens the group effect’s draws read as their content; the matching Scene::vn_pop_isolation inserts them as one VnEffectLayer.

Source

pub fn vn_begin_mask(&mut self, luminance: bool)

vue-native fork: what the innermost isolated layer paints from here to its Scene::vn_pop_isolation is its mask: the group composites multiplied by the mask’s alpha, or its luminance.

Source

pub fn vn_is_isolating(&self) -> bool

vue-native fork: whether an isolated layer is open.

Source

pub fn vn_pop_isolation(&mut self)

vue-native fork: closes the innermost isolated layer (Scene::vn_push_isolation) and inserts its composite.

Source

pub fn vn_effect_layer(&self, index: usize) -> Option<VnEffectLayer>

vue-native fork: the VnEffectLayer that composites Scene::vn_layers[index], if effects do.

Source

pub fn vn_insert_snapshot(&mut self, paint: VnSnapshotPaint)

vue-native fork: composites the snapshot paint.id at the current draw position. Its mapping is settled after finish (Scene::vn_resolve_snapshots), once every capture is known.

Source

pub fn vn_resolve_snapshots( &mut self, known: impl Fn(u64) -> Option<(VnCaptureInfo, Bounds<ScaledPixels>)>, )

vue-native fork: maps each snapshot composite’s unit square onto its capture’s border box and names the snapshot’s rectangle. known finds a capture of an earlier frame; one of this scene wins. A composite whose capture is unknown draws nothing.

Source

pub fn vn_group_count(&self) -> usize

vue-native fork: how many groups a finished scene holds, the root included.

Source

pub fn vn_batches(&self, group: usize) -> impl Iterator<Item = VnBatch> + '_

vue-native fork: the batches of one group (0 is the root), with its isolated layers’ composites as VnBatch::Layers; a renderer that isolates draws each composite’s VnLayer::group through these too.

Source

pub fn len(&self) -> usize

Source

pub fn push_layer(&mut self)

Source

pub fn pop_layer(&mut self)

Source

pub fn insert_primitive(&mut self, primitive: impl Into<Primitive>)

Source

pub fn replay(&mut self, range: Range<usize>, prev_scene: &Scene)

Source

pub fn finish(&mut self)

Source

pub fn batches(&self) -> impl Iterator<Item = PrimitiveBatch> + '_

vue-native fork: an isolated layer’s group comes inline where its composite would draw, unclipped by its shape (cut to the shape’s box by the content mask). That is what a renderer without isolated layers draws; the DirectX, Metal and wgpu renderers walk Scene::vn_batches.

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !Send for Scene

§

impl !Sync for Scene

§

impl Forget for Scene

§

impl Freeze for Scene

§

impl Move for Scene

§

impl RefUnwindSafe 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<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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