Skip to main content

ServerLayerVisual

Struct ServerLayerVisual 

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

Server-side counterpart of a LayerVisual: its children are composed into an offscreen layer (push_layer over the bounds of the subtree), which the opacity of the visual applies to as a whole.

With a shadow, the children are composed through a drop shadow effect when the drawing context has effects, so the shadow follows the alpha of the composed content; otherwise the box shadow of the rectangle of the visual is drawn under the layer. A shadow with a Mask (and the Default source policy) is the shadow of the alpha of the mask over the rectangle of the visual, drawn under the layer (ServerDropShadow::render_under_rect).

With an effect (an effect brush), the composed children are the first source parameter of its graph: what the graph draws under the layer and what wraps it are drawn and pushed before the children, inside the layer (or the shadow), and popped and drawn after them.

Deviation (winui-composition.md): without effect support in the drawing context the shadow is the box shadow of the rectangle of the visual, as for a sprite visual.

Implementations§

Source§

impl ServerLayerVisual

Source

pub fn new() -> Self

Source

pub fn props(&self) -> &ServerLayerVisualProps

The properties of the visual.

Source

pub fn shadow(&self) -> Option<Rc<ServerDropShadow>>

The shadow.

Source

pub fn effect_brush(&self) -> Option<Rc<ServerCompositionEffectBrush>>

The effect brush applied to the composed children (the WinUI Effect).

Trait Implementations§

Source§

impl Default for ServerLayerVisual

Source§

fn default() -> Self

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

impl IServerVisualContent for ServerLayerVisual

Source§

fn compute_own_content_bounds( &self, visual: &ServerCompositionVisual, ) -> Option<LtrbRect>

The area of the box shadow of the rectangle, when there is a shadow (what the fallback draws); a layer visual has no content of its own.

Source§

fn sub_tree_bounds_padding( &self, visual: &ServerCompositionVisual, ) -> Option<Thickness>

The shadow of the composed children extends the subtree as the drop shadow effect does, and the blurs of the effect around the layer as the blur effect does.

Source§

fn has_effect(&self, visual: &ServerCompositionVisual) -> bool

A shadow or an effect depends on every change of the subtree, as an effect does.

Source§

fn dependency_queued_invalidate(&self, visual: &ServerCompositionVisual)

The shadow or the effect changed.

Source§

fn deserialize_changes_core( &self, visual: &ServerCompositionVisual, reader: &mut BatchStreamReader<'_>, committed_at: Duration, )

DeserializeChangesCore of the class; the default is the one of the container visual.
Source§

fn size_changed(&self, visual: &ServerCompositionVisual)

Source§

fn render_core( &self, visual: &ServerCompositionVisual, context: &mut ServerVisualRenderContext<'_>, _current_transformed_clip: LtrbRect, )

Source§

fn render_after_children( &self, visual: &ServerCompositionVisual, context: &mut ServerVisualRenderContext<'_>, )

Called by the render walk after the children of the visual were rendered, before the opacity mask, effect, clips and transform of the visual are popped: what render_core pushed for the children is popped here (not from upstream; the layer of a layer visual).
Source§

fn dispose(&self, visual: &ServerCompositionVisual)

The visual has been disposed on the UI thread.
Source§

fn find_props(&self, type_id: TypeId) -> Option<&dyn Any>

The generated property block of the given type, if the class has one of its own.
Source§

fn get_composition_property( &self, name: &str, ) -> Option<&'static CompositionProperty>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn on_attached_to_root( &self, _visual: &ServerCompositionVisual, _target: &Rc<ServerCompositionTarget>, )

Source§

fn on_detached_from_root( &self, _visual: &ServerCompositionVisual, _target: &Rc<ServerCompositionTarget>, )

Source§

fn push_clip_to_bounds( &self, visual: &ServerCompositionVisual, canvas: &mut dyn IDrawingContextImpl, )

Source§

fn has_update_pass_content_bounds(&self) -> bool

Whether the bounds of the own content depend on other visuals and are computed again when the update pass of the target reaches the visual (not from upstream; a redirect visual covers the bounds of its source as that pass leaves them).

Auto Trait Implementations§

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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<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.