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
impl ServerDropShadow
Sourcepub fn new(compositor: &Rc<ServerCompositor>) -> Rc<ServerDropShadow>
pub fn new(compositor: &Rc<ServerCompositor>) -> Rc<ServerDropShadow>
Creates the shadow, active: the UI-thread shadow activates its server object when it is created.
Sourcepub fn props(&self) -> &ServerDropShadowProps
pub fn props(&self) -> &ServerDropShadowProps
The properties of the shadow.
pub fn is_disposed(&self) -> bool
Sourcepub fn effective_color(&self) -> Color
pub fn effective_color(&self) -> Color
The colour of the shadow with its opacity in the alpha.
Sourcepub fn plane_offset(&self, visual: Option<&ServerCompositionVisual>) -> Vector
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.
Sourcepub fn box_shadow_in(
&self,
visual: Option<&ServerCompositionVisual>,
) -> BoxShadow
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.
Sourcepub fn box_shadow(&self) -> BoxShadow
pub fn box_shadow(&self) -> BoxShadow
box_shadow_in without a visual.
Sourcepub fn box_shadows_in(
&self,
visual: Option<&ServerCompositionVisual>,
) -> BoxShadows
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.
Sourcepub fn box_shadows(&self) -> BoxShadows
pub fn box_shadows(&self) -> BoxShadows
box_shadows_in without a visual.
Sourcepub fn bounds_in(
&self,
visual: Option<&ServerCompositionVisual>,
rect: Rect,
) -> Rect
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.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Whether the shadow is drawn at all: its colour and opacity leave some alpha.
Sourcepub fn inherits_from_visual_content(&self) -> bool
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.
Sourcepub fn effective_mask(&self) -> Option<Rc<dyn IServerObject>>
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.
Sourcepub fn render_under_rect(
&self,
canvas: &mut dyn IDrawingContextImpl,
rect: Rect,
)
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.
Sourcepub fn render_with_content(
&self,
canvas: &mut dyn IDrawingContextImpl,
rect: Rect,
paint: impl FnOnce(&mut dyn IDrawingContextImpl),
) -> bool
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.
Sourcepub fn render_under_rect_in(
&self,
canvas: &mut dyn IDrawingContextImpl,
visual: Option<&ServerCompositionVisual>,
rect: Rect,
)
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.
Sourcepub fn render_shadow_of(
&self,
canvas: &mut dyn IDrawingContextImpl,
visual: Option<&ServerCompositionVisual>,
rect: Rect,
paint: impl FnOnce(&mut dyn IDrawingContextImpl),
) -> bool
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
impl IAnimatedServerObject for ServerDropShadow
Source§fn server_object(&self) -> &ServerObject
fn server_object(&self) -> &ServerObject
ServerObject part.Source§fn get_composition_property(
&self,
field_name: &str,
) -> Option<&'static CompositionProperty>
fn get_composition_property( &self, field_name: &str, ) -> Option<&'static CompositionProperty>
Source§fn as_server_object_dyn(&self) -> &dyn IServerObject
fn as_server_object_dyn(&self) -> &dyn IServerObject
Source§fn read_property_variant(
&self,
property: &'static CompositionProperty,
) -> ExpressionVariant
fn read_property_variant( &self, property: &'static CompositionProperty, ) -> ExpressionVariant
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,
)
fn write_property_variant( &self, property: &'static CompositionProperty, value: ExpressionVariant, )
CompositionProperty::set_variant; an object with dynamic properties writes its own
storage.Source§impl IServerAnimatedPropertyHost for ServerDropShadow
impl IServerAnimatedPropertyHost for ServerDropShadow
Source§fn set_animated_value(
&self,
property: &'static CompositionProperty,
current_value: ExpressionVariant,
committed_at: Duration,
animation: Rc<dyn IAnimationInstance>,
)
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)
fn remove_animation_for_property(&self, property: &'static CompositionProperty)
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)
fn notify_animated_value_changed(&self, _property: &'static CompositionProperty)
property.Source§impl IServerObject for ServerDropShadow
impl IServerObject for ServerDropShadow
Source§fn deserialize_changes_core(
&self,
reader: &mut BatchStreamReader<'_>,
committed_at: Duration,
)
fn deserialize_changes_core( &self, reader: &mut BatchStreamReader<'_>, committed_at: Duration, )
Source§fn values_invalidated(&self)
fn values_invalidated(&self)
Source§fn as_render_resource(self: Rc<Self>) -> Option<Rc<dyn IServerRenderResource>>
fn as_render_resource(self: Rc<Self>) -> Option<Rc<dyn IServerRenderResource>>
Source§fn as_animated(self: Rc<Self>) -> Option<Rc<dyn IAnimatedServerObject>>
fn as_animated(self: Rc<Self>) -> Option<Rc<dyn IAnimatedServerObject>>
Source§fn get_props(&self, type_id: TypeId) -> Option<&dyn Any>
fn get_props(&self, type_id: TypeId) -> Option<&dyn Any>
find_props; composition properties locate their
fields through it.fn as_any(&self) -> &dyn Any
fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>
Source§fn deserialize_changes(
&self,
reader: &mut BatchStreamReader<'_>,
committed_at: Duration,
)
fn deserialize_changes( &self, reader: &mut BatchStreamReader<'_>, committed_at: Duration, )
Source§fn as_brush(self: Rc<Self>) -> Option<Rc<dyn IBrush>>
fn as_brush(self: Rc<Self>) -> Option<Rc<dyn IBrush>>
Source§fn as_pen(self: Rc<Self>) -> Option<Rc<dyn IPen>>
fn as_pen(self: Rc<Self>) -> Option<Rc<dyn IPen>>
Source§fn as_render_data_geometry(
self: Rc<Self>,
) -> Option<Rc<dyn IRenderDataGeometry>>
fn as_render_data_geometry( self: Rc<Self>, ) -> Option<Rc<dyn IRenderDataGeometry>>
Source§fn as_transform(self: Rc<Self>) -> Option<Rc<dyn ITransform>>
fn as_transform(self: Rc<Self>) -> Option<Rc<dyn ITransform>>
Source§fn as_gradient_stop(self: Rc<Self>) -> Option<Rc<dyn IGradientStop>>
fn as_gradient_stop(self: Rc<Self>) -> Option<Rc<dyn IGradientStop>>
Source§fn as_surface(self: Rc<Self>) -> Option<Rc<dyn IServerCompositionSurface>>
fn as_surface(self: Rc<Self>) -> Option<Rc<dyn IServerCompositionSurface>>
Source§impl IServerPropertyHost for ServerDropShadow
impl IServerPropertyHost for ServerDropShadow
Source§fn server_compositor(&self) -> Option<Rc<ServerCompositor>>
fn server_compositor(&self) -> Option<Rc<ServerCompositor>>
Source§fn set_value(
&self,
_property: &'static CompositionProperty,
change: ServerValueChange<'_>,
)
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
impl IServerRenderResource for ServerDropShadow
fn add_observer(&self, observer: &Rc<dyn IServerRenderResourceObserver>)
fn remove_observer(&self, observer: &Rc<dyn IServerRenderResourceObserver>)
fn queued_invalidate(&self)
Source§impl IServerRenderResourceHost for ServerDropShadow
impl IServerRenderResourceHost for ServerDropShadow
Source§fn compositor(&self) -> Option<Rc<ServerCompositor>>
fn compositor(&self) -> Option<Rc<ServerCompositor>>
Source§fn as_render_resource_rc(&self) -> Option<Rc<dyn IServerRenderResource>>
fn as_render_resource_rc(&self) -> Option<Rc<dyn IServerRenderResource>>
Source§fn resource_property_changed(&self)
fn resource_property_changed(&self)
Source§impl IServerRenderResourceObserver for ServerDropShadow
impl IServerRenderResourceObserver for ServerDropShadow
fn dependency_queued_invalidate(&self, _sender: &dyn IServerRenderResource)
Source§impl ServerDropShadowHooks for ServerDropShadow
impl ServerDropShadowHooks for ServerDropShadow
fn deserialize_changes_extra(&self, _reader: &mut BatchStreamReader<'_>)
fn on_fields_deserialized(&self, _changed: DropShadowChangedFields)
fn on_mask_changed(&self)
fn on_mask_changing(&self)
fn on_source_policy_changed(&self)
fn on_source_policy_changing(&self)
Auto Trait Implementations§
impl !Freeze for ServerDropShadow
impl !RefUnwindSafe for ServerDropShadow
impl !Send for ServerDropShadow
impl !Sync for ServerDropShadow
impl !UnwindSafe for ServerDropShadow
impl Unpin for ServerDropShadow
impl UnsafeUnpin for ServerDropShadow
Blanket Implementations§
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<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more