Skip to main content

LayerRef

Struct LayerRef 

Source
pub struct LayerRef<'a> { /* private fields */ }
Expand description

One record of a SceneStore: a layer, a wrapper, a draw group or a leaf drawn in its parent’s layer.

Implementations§

Source§

impl<'a> LayerRef<'a>

Source

pub fn store(self) -> &'a SceneStore

The store that holds the record.

Source

pub fn id(self) -> RecordId

The record’s id in its store.

Source

pub fn kind(self) -> RecordKind

What the record draws for.

Source

pub fn node_id(self) -> Option<NodeId>

The layout node of a node’s layer or leaf; None for a wrapper, a draw group and an overlay.

Source

pub fn wraps(self) -> Option<NodeId>

The node whose outer draws a wrapper holds.

Source

pub fn identity(self) -> (Option<NodeId>, Option<NodeId>)

Self::node_id and Self::wraps from one read of the record.

Source

pub fn owner(self) -> Option<NodeId>

The layout node the record draws for, whatever its kind.

Source

pub fn parent(self) -> Option<Self>

The record that holds this one.

Source

pub fn props(self) -> Option<&'a LayerProps>

The properties the record keeps beyond its fixed-size parts.

Source

pub fn flags(self) -> RecordFlags

The record’s flags.

Source

pub fn node_rect(self) -> Rect

The node’s rect, (0, 0, size), where its pointer handlers are.

Source

pub fn size(self) -> Size

The node’s size.

Source

pub fn local_bounds(self) -> Rect

The bounds of the layer, where its clip cuts, its transforms pivot and an offscreen pass draws it.

Source

pub fn node_bounds(self) -> Option<Rect>

The node’s rect when it differs from Self::local_bounds.

Source

pub fn origin(self) -> Point

The record’s top left in its parent’s layer: its placement and the parent’s content offset. A leaf’s transform moves it there.

Source

pub fn transform_to_parent(self) -> ProjectiveTransform

Maps the record’s space to its parent’s content space, with the placement, the graphics layer transform and the parent’s content offset applied.

Source

pub fn placement(self) -> Placement

Where the record sits in its parent’s layer: Self::transform_to_parent without making a transform of a point.

Source

pub fn content_offset(self) -> Point

Offset of the node’s content box from its origin, where its children are placed.

Source

pub fn origin_in_parent(self) -> Point

Where layout placed the record within its parent’s content, before the parent’s content offset.

Source

pub fn motion_context_animated(self) -> bool

Whether the record lies in a motion context such as an animated scroll, where a renderer must not snap its content rigidly to the pixel grid.

Source

pub fn translated_content_context(self) -> bool

Whether the record moves its content as one translated block, so a renderer may snap that content to the pixel grid as a whole.

Source

pub fn translated_content_offset(self) -> Point

Translation of the content in a translated content context.

Source

pub fn graphics_layer(self) -> &'a GraphicsLayer

The graphics layer properties; defaults when none were set.

Source

pub fn clip_to_bounds(self) -> bool

Whether the record cuts its content to its local bounds.

Source

pub fn hit_test(self) -> Option<&'a HitTestNode>

Pointer handling of the node.

Source

pub fn has_hit_targets(self) -> bool

Whether the record or a record beneath it handles pointers.

Source

pub fn has_origin_sinks(self) -> bool

Whether the record’s subtree publishes live window origins: a text field’s popup anchor, a scroll container’s viewport rect.

Source

pub fn has_space(self) -> bool

Whether the record or a record beneath it is a scene, a mesh surface or a 3D transform.

Source

pub fn own_draw_facts(self) -> OwnDrawFacts

What the record’s own draws hold that decides how a renderer snaps them to the pixel grid.

Source

pub fn reach(self) -> Reach

Where the record’s subtree draws, in its own space: what its items draw and its children’s extents, within its clip. A change beneath the record since SceneStore::refresh_reach leaves it unknown.

Source

pub fn own_reach(self) -> Reach

Where the record’s own draws reach, beside its children’s, in its own space and within its clip. A change beneath the record since SceneStore::refresh_reach leaves it unknown.

Source

pub fn extent(self) -> Extent

What the record draws in its parent’s space.

Source

pub fn draws_within_bounds(self) -> bool

Whether everything the record’s subtree draws lies within its local bounds, give or take crate::graph::CONTAINED_DRAW_SLACK.

Source

pub fn isolation(self) -> IsolationReasons

The reasons the record is drawn through its own offscreen buffer.

Source

pub fn needs_surface(self) -> bool

Whether the record’s own composition needs its content on a texture of its own: a reason to draw offscreen, or a graphics layer that composites apart.

Source

pub fn draw_phase(self) -> Option<PrimitivePhase>

The phase a draw group paints in among its node’s own draws; None for every other kind.

Source

pub fn cache_policy(self) -> CachePolicy

Whether a renderer may keep the record’s pixels between frames.

Source

pub fn clip_rect(self) -> Option<Rect>

The rectangle that cuts the content and pointer hits: the local bounds when the record clips to them or its graphics layer clips.

Source

pub fn shadow_clip(self) -> Option<Rect>

Where the record’s own shadow is cut: its bounds when it clips its content to them. A graphics-layer clip leaves the shadow whole.

Source

pub fn visual_clip_rect(self) -> Option<Rect>

Where the record’s drawing is cut: its clip or, when it composites through an offscreen buffer for its alpha or by request, its bounds.

Source

pub fn visual_clip_of( self, graphics: &GraphicsLayer, bounds: Rect, ) -> Option<Rect>

Self::visual_clip_rect of the record whose graphics layer graphics and local bounds bounds a reader holds already.

Source

pub fn effect(self) -> Option<&'a RenderEffect>

The render effect applied to the record’s content.

Source

pub fn backdrop(self) -> Option<&'a RenderEffect>

The effect applied to what lies behind the record.

Source

pub fn opacity(self) -> f32

Alpha of the record from 0.0 (transparent) to 1.0 (opaque).

Source

pub fn blend_mode(self) -> BlendMode

How the record composites onto what lies beneath it.

Source

pub fn color_filter(self) -> Option<&'a ColorFilter>

The color filter applied to the record’s content.

Source

pub fn target_content_hash(self) -> u64

Hash of everything the record draws into its target. Equal hashes mean cached pixels are still valid.

Source

pub fn motion_source_content_hash(self) -> u64

Hash of the record’s content like Self::target_content_hash, without the translated content offset, so it stays equal while the content only moves.

Source

pub fn effect_hash(self) -> u64

Hash of the record’s render effect, for keying cached effect output.

Source

pub fn content_churns(self, update: SceneUpdate) -> bool

Whether what the record draws changed in scene update update and in the one before it, so a raster cache keyed on its content would miss again.

Source

pub fn changes(self) -> RecordChanges

What the record and its subtree were at their last changes, and where it sat in its parent’s layer.

Source

pub fn only_translated_since(self, held: RecordChanges) -> bool

Whether the record itself, its properties, draws and items, changed since held at most by the offset at which it moves its translated content, whatever changed beneath it. A record that draws nothing of its own keeps its children through such a change.

Source

pub fn item_count(self) -> usize

How many items the record holds.

Source

pub fn item(self, index: usize) -> Option<ItemRef<'a>>

The record’s item at index in draw order, read without the items before it.

Source

pub fn items( self, ) -> impl DoubleEndedIterator<Item = ItemRef<'a>> + ExactSizeIterator + 'a

The record’s items in draw order.

Source

pub fn item_kinds(self) -> impl Iterator<Item = ItemKind> + 'a

The kinds of the record’s items in draw order, read without the items themselves.

Source

pub fn own_draws(self) -> impl Iterator<Item = ItemRef<'a>> + 'a

The record’s own draws in draw order: its items without its children.

Source

pub fn children(self) -> impl DoubleEndedIterator<Item = Self> + 'a

The child records among the items, in draw order.

Trait Implementations§

Source§

impl<'a> Clone for LayerRef<'a>

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<'a> Copy for LayerRef<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for LayerRef<'a>

§

impl<'a> !Send for LayerRef<'a>

§

impl<'a> !Sync for LayerRef<'a>

§

impl<'a> !UnwindSafe for LayerRef<'a>

§

impl<'a> Forget for LayerRef<'a>

§

impl<'a> Freeze for LayerRef<'a>

§

impl<'a> Move for LayerRef<'a>

§

impl<'a> Unpin for LayerRef<'a>

§

impl<'a> UnsafeUnpin for LayerRef<'a>

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> 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, 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> 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.