Skip to main content

ServerDropShadow

Struct ServerDropShadow 

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

The server-side counterpart of a DropShadow.

The shadow of the rectangle of a visual is the box shadow of the drawing context. The shadow of an alpha (a Mask brush, or the content of the visual with the InheritFromVisualContent source policy) is drawn by render_shadow_of the same way on every backend that has effects: the source, coloured by the shadow, offset and blurred.

Implementations§

Source§

impl ServerDropShadow

Source

pub fn new(compositor: &Rc<ServerCompositor>) -> Rc<ServerDropShadow>

Creates the shadow, active: the UI-thread shadow activates its server object when it is created.

Source

pub fn props(&self) -> &ServerDropShadowProps

The properties of the shadow.

Source

pub fn is_disposed(&self) -> bool

Source

pub fn effective_color(&self) -> Color

The colour of the shadow with its opacity in the alpha.

Source

pub fn plane_offset(&self, visual: Option<&ServerCompositionVisual>) -> Vector

The offset of the shadow in the plane of visual: the X and Y of Offset, and its Z as the renderers project that depth for the visual (ServerCompositionVisual::depth_offset); without a visual the X and Y alone.

Source

pub fn box_shadow_in( &self, visual: Option<&ServerCompositionVisual>, ) -> BoxShadow

The shadow of the rectangle of visual as a box shadow: offset, blur radius, and the colour with the opacity of the shadow in its alpha.

Source

pub fn box_shadow(&self) -> BoxShadow

box_shadow_in without a visual.

Source

pub fn box_shadows_in( &self, visual: Option<&ServerCompositionVisual>, ) -> BoxShadows

The box shadows the shadow draws under a rectangle of visual: empty when the shadow is invisible.

Source

pub fn box_shadows(&self) -> BoxShadows

box_shadows_in without a visual.

Source

pub fn bounds_in( &self, visual: Option<&ServerCompositionVisual>, rect: Rect, ) -> Rect

The area the shadow of rect of visual covers, together with rect: the rectangle moved by the offset and grown by the blur radius. The shadow of an alpha inside rect stays inside it too.

Source

pub fn bounds(&self, rect: Rect) -> Rect

bounds_in without a visual.

Source

pub fn is_visible(&self) -> bool

Whether the shadow is drawn at all: its colour and opacity leave some alpha.

Source

pub fn inherits_from_visual_content(&self) -> bool

Whether the shadow takes the alpha of the content of its visual (SourcePolicy InheritFromVisualContent), which wins over the mask.

Source

pub fn effective_mask(&self) -> Option<Rc<dyn IServerObject>>

The mask that shapes the shadow: the Mask brush, unless the shadow takes the alpha of the content of its visual.

Source

pub fn render_under_rect( &self, canvas: &mut dyn IDrawingContextImpl, rect: Rect, )

Draws the shadow of a sprite or layer visual whose area is rect, outside the plane of any visual: render_under_rect_in without a visual.

Source

pub fn render_with_content( &self, canvas: &mut dyn IDrawingContextImpl, rect: Rect, paint: impl FnOnce(&mut dyn IDrawingContextImpl), ) -> bool

Draws the content of a visual whose area is rect (paint) with the shadow of the alpha of that content under it, through a drop shadow effect of the drawing context: the InheritFromVisualContent source policy. Returns false, drawing nothing, when the drawing context has no effects; the caller then draws the shadow with render_under_rect and the content itself.

Source

pub fn render_under_rect_in( &self, canvas: &mut dyn IDrawingContextImpl, visual: Option<&ServerCompositionVisual>, rect: Rect, )

Draws the shadow of a sprite or layer visual whose area is rect, without the content of the visual: the shadow of the alpha of the mask when there is one (render_shadow_of), otherwise the box shadow of the rectangle. Nothing for an invisible shadow or an empty rectangle.

Deviation (winui-composition.md): without effects in the drawing context, the shadow of a mask is the box shadow of the rectangle.

Source

pub fn render_shadow_of( &self, canvas: &mut dyn IDrawingContextImpl, visual: Option<&ServerCompositionVisual>, rect: Rect, paint: impl FnOnce(&mut dyn IDrawingContextImpl), ) -> bool

Draws the shadow of the alpha of what paint draws inside rect (a mask brush, the brush of a sprite visual, the image of a mask): that alpha in the colour of the shadow, moved by its offset and blurred by its blur radius, and nothing of the source itself. Returns false, drawing nothing, when the drawing context has no effects or there is no render interface for the bitmap of the colour; the caller then draws the box shadow of the rectangle.

Inside a blur effect, the source is painted into a layer at the offset of the shadow and a bitmap of the colour of the shadow is drawn over it with source-in blending, which keeps the colour where the source has alpha, in the proportion of that alpha: the operations every drawing context with effects has, so Skia and Vello draw the same shadow.

Trait Implementations§

Source§

impl IAnimatedServerObject for ServerDropShadow

Source§

fn server_object(&self) -> &ServerObject

The embedded ServerObject part.
Source§

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

The composition property with the given name, if the class has one.
Source§

fn as_server_object_dyn(&self) -> &dyn IServerObject

The object as the base contract (an explicit upcast).
Source§

fn read_property_variant( &self, property: &'static CompositionProperty, ) -> ExpressionVariant

Reads a property of the object as a variant. The default reads the field through CompositionProperty::get_variant; an object with dynamic properties (a property set) reads its own storage.
Source§

fn write_property_variant( &self, property: &'static CompositionProperty, value: ExpressionVariant, )

Writes a variant into a property of the object without notification (what an animation does with the value it evaluated). The default writes the field through CompositionProperty::set_variant; an object with dynamic properties writes its own storage.
Source§

impl IServerAnimatedPropertyHost for ServerDropShadow

Source§

fn set_animated_value( &self, property: &'static CompositionProperty, current_value: ExpressionVariant, committed_at: Duration, animation: Rc<dyn IAnimationInstance>, )

SetAnimatedValue(prop, ref field, committedAt, animation): starts animation on the property. current_value is the value of the field as a variant; the animation writes the field through CompositionProperty::set_variant.
Source§

fn remove_animation_for_property(&self, property: &'static CompositionProperty)

The tail of SetAnimatedValue(prop, out field, value): the field has been assigned directly, so the animation of the property, if any, is removed.
Source§

fn notify_animated_value_changed(&self, _property: &'static CompositionProperty)

An animation wrote a new value into the field of property.
Source§

impl IServerObject for ServerDropShadow

Source§

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

Reads the changes of the object from a batch.
Source§

fn values_invalidated(&self)

Called after a group of values of the object changed.
Source§

fn dispose(&self)

Releases the object: it has been disposed on the UI thread.
Source§

fn as_render_resource(self: Rc<Self>) -> Option<Rc<dyn IServerRenderResource>>

The object as a render resource, if it is one.
Source§

fn as_animated(self: Rc<Self>) -> Option<Rc<dyn IAnimatedServerObject>>

The object as an animatable object, if it is one.
Source§

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

The generated property block of the given type embedded in the object, if it has one. A class that embeds generated properties forwards to their find_props; composition properties locate their fields through it.
Source§

fn as_any(&self) -> &dyn Any

Source§

fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>

Source§

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

Applies the changes of the object from a batch.
Source§

fn as_brush(self: Rc<Self>) -> Option<Rc<dyn IBrush>>

The object as a brush, if it is a server-side brush.
Source§

fn as_pen(self: Rc<Self>) -> Option<Rc<dyn IPen>>

The object as a pen, if it is a server-side pen.
Source§

fn as_render_data_geometry( self: Rc<Self>, ) -> Option<Rc<dyn IRenderDataGeometry>>

The object as a geometry usable by render data, if it is a server-side geometry.
Source§

fn as_transform(self: Rc<Self>) -> Option<Rc<dyn ITransform>>

The object as a transform, if it is a server-side transform.
Source§

fn as_gradient_stop(self: Rc<Self>) -> Option<Rc<dyn IGradientStop>>

The object as a gradient stop, if it is a server-side gradient stop.
Source§

fn as_surface(self: Rc<Self>) -> Option<Rc<dyn IServerCompositionSurface>>

The object as a composition surface, if it is one.
Source§

impl IServerPropertyHost for ServerDropShadow

Source§

fn server_compositor(&self) -> Option<Rc<ServerCompositor>>

The compositor of the object, while it is alive. Used to resolve the server objects a batch refers to.
Source§

fn set_value( &self, _property: &'static CompositionProperty, change: ServerValueChange<'_>, )

SetValue(prop, ref field, value) as the class of the object defines it. A plain server object assigns; an animated object also invalidates the subscriptions of the property; a render resource goes through super::ServerRenderResourceCore::set_value.
Source§

impl IServerRenderResource for ServerDropShadow

Source§

impl IServerRenderResourceHost for ServerDropShadow

Source§

fn compositor(&self) -> Option<Rc<ServerCompositor>>

The compositor of the resource, while it is alive.
Source§

fn as_render_resource_rc(&self) -> Option<Rc<dyn IServerRenderResource>>

The resource as a shared handle, for the invalidation queue.
Source§

fn resource_property_changed(&self)

Called once per group of property changes, before the queued invalidation.
Source§

impl IServerRenderResourceObserver for ServerDropShadow

Source§

impl ServerDropShadowHooks for ServerDropShadow

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.