pub struct LayerTree { /* private fields */ }Expand description
Renderer-independent retained layer arena. Picture display lists are owned once and scene flattening only emits a transient linear command stream. This deliberately has no GPU resources or offscreen textures.
Implementations§
Source§impl LayerTree
impl LayerTree
pub fn new() -> Self
pub fn diagnostics(&self) -> CompositorDiagnostics
pub fn root(&self) -> Option<LayerId>
pub fn set_root(&mut self, root: LayerId)
Sourcepub fn scene_bounds(&self) -> Option<Rect>
pub fn scene_bounds(&self) -> Option<Rect>
Returns the retained scene’s conservative world-space visual bounds after compositor transforms, rectangular clipping, blur support, and drop-shadow support have been applied.
This is renderer-independent geometry. It is useful to embedders that need to size a native host around retained content without inspecting widget types or GPU commands.
pub fn create_picture( &mut self, display_list: DisplayList, bounds: Rect, ) -> LayerId
pub fn create_transform(&mut self, transform: Transform) -> LayerId
pub fn create_clip_rect(&mut self, rect: Rect) -> LayerId
Sourcepub fn create_clip_rrect(&mut self, rrect: RRect) -> LayerId
pub fn create_clip_rrect(&mut self, rrect: RRect) -> LayerId
Creates a rounded-rectangle clip stage in local space; the world
shape resolves at flatten time like Self::create_clip_rect.
Sourcepub fn create_clip_oval(&mut self, rect: Rect) -> LayerId
pub fn create_clip_oval(&mut self, rect: Rect) -> LayerId
Creates an oval clip stage in local space; the world shape resolves
at flatten time like Self::create_clip_rect.
Sourcepub fn create_clip_path(
&mut self,
path: Arc<Path>,
fill_rule: FillRule,
) -> LayerId
pub fn create_clip_path( &mut self, path: Arc<Path>, fill_rule: FillRule, ) -> LayerId
Creates a path clip stage in local space; the world shape resolves
at flatten time like Self::create_clip_rect.
Sourcepub fn create_opacity(&mut self, alpha: f32) -> LayerId
pub fn create_opacity(&mut self, alpha: f32) -> LayerId
Creates an isolated compositor group. Alpha is normalized at the renderer-neutral boundary so every backend observes identical values.
Sourcepub fn create_blur(&mut self, blur: GaussianBlur) -> LayerId
pub fn create_blur(&mut self, blur: GaussianBlur) -> LayerId
Creates an isolated Gaussian-filtered compositor group.
Sourcepub fn create_drop_shadow(&mut self, shadow: DropShadowEffect) -> LayerId
pub fn create_drop_shadow(&mut self, shadow: DropShadowEffect) -> LayerId
Creates an isolated arbitrary-subtree drop-shadow compositor group.
Sourcepub fn create_color_filter(&mut self, filter: ColorFilter) -> LayerId
pub fn create_color_filter(&mut self, filter: ColorFilter) -> LayerId
Creates an isolated color-matrix stage. Matrix changes are compositor updates and deliberately do not change the source generation.
Sourcepub fn create_blend(&mut self, mode: BlendMode) -> LayerId
pub fn create_blend(&mut self, mode: BlendMode) -> LayerId
Creates a retained blend group whose source remains cached when only the discrete blend mode changes.
Sourcepub fn create_shader_mask(
&mut self,
shader: Brush,
blend_mode: BlendMode,
mask_size: Size,
mask_transform: Transform,
) -> LayerId
pub fn create_shader_mask( &mut self, shader: Brush, blend_mode: BlendMode, mask_size: Size, mask_transform: Transform, ) -> LayerId
Creates an isolated shader-mask stage. The callback is evaluated by the retained widget during paint; this layer only owns the resolved, renderer-neutral shader description and its local coordinate space.
Sourcepub fn create_backdrop_filter(
&mut self,
blur: GaussianBlur,
blend_mode: BlendMode,
enabled: bool,
) -> LayerId
pub fn create_backdrop_filter( &mut self, blur: GaussianBlur, blend_mode: BlendMode, enabled: bool, ) -> LayerId
Creates a backdrop-filter stage. Unlike Self::create_blur, this
stage samples the already painted destination before its child is
composited.
pub fn create_annotated_region( &mut self, annotation: Annotation, sized: bool, size: Size, ) -> LayerId
pub fn create_leader(&mut self, link: LayerLink, size: Size) -> LayerId
pub fn create_follower(&mut self, follower: FollowerLayer) -> LayerId
pub fn remove(&mut self, id: LayerId)
pub fn set_children(&mut self, id: LayerId, children: Vec<LayerId>)
Sourcepub fn set_surface_partition(
&mut self,
id: LayerId,
partition: Option<SurfacePartitionId>,
)
pub fn set_surface_partition( &mut self, id: LayerId, partition: Option<SurfacePartitionId>, )
Marks one retained layer subtree as detachable presentation content. The marker is renderer-neutral and does not alter layout, painting, or the retained layer topology.
Sourcepub fn clear_surface_partitions(&mut self)
pub fn clear_surface_partitions(&mut self)
Clears every detachable-surface marker. WidgetTree reapplies markers for the currently visible transient portals before flattening each frame.
pub fn update_picture( &mut self, id: LayerId, display_list: DisplayList, bounds: Rect, )
pub fn update_transform(&mut self, id: LayerId, transform: Transform) -> bool
pub fn update_clip(&mut self, id: LayerId, rect: Rect) -> bool
pub fn update_clip_rrect(&mut self, id: LayerId, rrect: RRect) -> bool
pub fn update_clip_oval(&mut self, id: LayerId, rect: Rect) -> bool
pub fn update_clip_path( &mut self, id: LayerId, path: Arc<Path>, fill_rule: FillRule, ) -> bool
Sourcepub fn update_opacity(&mut self, id: LayerId, alpha: f32) -> bool
pub fn update_opacity(&mut self, id: LayerId, alpha: f32) -> bool
Updates only the group alpha. This deliberately does not change the content generation, allowing a cached offscreen texture to be reused while an opacity animation is ticking.
Sourcepub fn update_blur(&mut self, id: LayerId, blur: GaussianBlur) -> bool
pub fn update_blur(&mut self, id: LayerId, blur: GaussianBlur) -> bool
Updates Gaussian parameters without changing the retained source generation. A backend recomputes only the filtered result.
Sourcepub fn update_drop_shadow(
&mut self,
id: LayerId,
shadow: DropShadowEffect,
) -> bool
pub fn update_drop_shadow( &mut self, id: LayerId, shadow: DropShadowEffect, ) -> bool
Updates shadow presentation properties without changing source pixels. Sigma invalidates the filtered mask; offset/color remain composite-only in GPU backends.
pub fn update_color_filter(&mut self, id: LayerId, filter: ColorFilter) -> bool
pub fn update_blend(&mut self, id: LayerId, mode: BlendMode) -> bool
pub fn update_shader_mask( &mut self, id: LayerId, shader: Brush, blend_mode: BlendMode, mask_size: Size, mask_transform: Transform, ) -> bool
pub fn update_shader_mask_blend( &mut self, id: LayerId, blend_mode: BlendMode, ) -> bool
pub fn update_backdrop_filter( &mut self, id: LayerId, blur: GaussianBlur, blend_mode: BlendMode, enabled: bool, ) -> bool
pub fn update_annotated_region( &mut self, id: LayerId, annotation: Annotation, sized: bool, size: Size, ) -> bool
pub fn update_leader( &mut self, id: LayerId, link: LayerLink, size: Size, ) -> bool
pub fn update_leader_size(&mut self, id: LayerId, size: Size) -> bool
pub fn update_follower(&mut self, id: LayerId, follower: FollowerLayer) -> bool
Sourcepub fn flattened_pictures(&self) -> &[FlattenedPicture]
pub fn flattened_pictures(&self) -> &[FlattenedPicture]
World-space logical bounds captured by the most recent Self::flatten
call. This keeps coordinate diagnostics out of the renderer hot path.
pub fn flattened_annotations(&self) -> &[FlattenedAnnotation]
Sourcepub fn find_annotation<T: Any + Clone>(&self, point: Offset) -> Option<T>
pub fn find_annotation<T: Any + Clone>(&self, point: Offset) -> Option<T>
Returns the front-most annotation of type T at point. Annotation
lookup follows layer paint order, honours ancestor clips, and treats
sized: false regions as covering the entire clipped subtree.
pub fn find_annotations<T: Any + Clone>(&self, point: Offset) -> Vec<T>
pub fn flatten(&mut self) -> DisplayList
Sourcepub fn publish_leader_links(&mut self)
pub fn publish_leader_links(&mut self)
Republishes leader links from current layer state for readers that
run before flatten (notably semantic collection, which the frame
runs pre-paint). Same pass flatten runs, so follower visibility
reflects this frame’s layout instead of the previous paint;
genuinely hidden leaders still stay unpublished. Idempotent.
pub fn debug_tree(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LayerTree
impl !Send for LayerTree
impl !Sync for LayerTree
impl !UnwindSafe for LayerTree
impl Freeze for LayerTree
impl Unpin for LayerTree
impl UnsafeUnpin for LayerTree
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more