pub struct DropShadow { /* private fields */ }Expand description
The shadow of a sprite or layer visual (WinUI
Microsoft.UI.Composition.DropShadow), with animatable BlurRadius,
Color, Offset and Opacity.
On a sprite visual the shadow is cast by the rectangle of the visual (a
box shadow of the drawing context), by the alpha of its
mask (any composition brush, such as the brush of
GetAlphaMask of a shape, a text block or an image), or, with the
InheritFromVisualContent source_policy, by the
alpha of the brush of the visual. On a layer visual it is cast by the
composed children, or by the mask. The shadow is drawn under the content
and nothing of it is removed; the Z of the offset moves it as the
renderers project that depth for the visual (a visual turned out of its
plane).
Deviation (winui-composition.md): without effects in the drawing context
the shadow is the box shadow of the rectangle. WinUI’s CompositionShadow
base class has no members and is not a separate type.
Implementations§
Source§impl DropShadow
impl DropShadow
pub fn compositor(&self) -> &Rc<Compositor>
Sourcepub fn object(&self) -> &CompositionObject
pub fn object(&self) -> &CompositionObject
The embedded CompositionObject.
Sourcepub fn server(&self) -> ServerObjectId
pub fn server(&self) -> ServerObjectId
The id of the server-side shadow.
pub fn is_disposed(&self) -> bool
pub fn dispose(&self)
Sourcepub fn props(&self) -> &DropShadowProps
pub fn props(&self) -> &DropShadowProps
The generated properties of the shadow.
Sourcepub fn blur_radius(&self) -> f32
pub fn blur_radius(&self) -> f32
The radius of the blur (default 9).
pub fn set_blur_radius(&self, value: f32)
pub fn set_color(&self, value: Color)
Sourcepub fn offset(&self) -> Vector3D
pub fn offset(&self) -> Vector3D
The offset of the shadow from the visual (WinUI Vector3). The Z is
a depth in the space of the visual: it moves the shadow only where
the visual is turned out of its plane (Orientation, RotationAxis),
as the renderers project that visual.
pub fn set_offset(&self, value: Vector3D)
pub fn set_opacity(&self, value: f32)
Sourcepub fn mask(&self) -> Option<Rc<CompositionBrush>>
pub fn mask(&self) -> Option<Rc<CompositionBrush>>
The brush whose alpha shapes the shadow, painted over the area of the
visual; None for the shape of the visual. Ignored with the
InheritFromVisualContent source policy.
pub fn set_mask(&self, value: Option<Rc<CompositionBrush>>)
Sourcepub fn source_policy(&self) -> CompositionDropShadowSourcePolicy
pub fn source_policy(&self) -> CompositionDropShadowSourcePolicy
What the shadow is cast from: Default for the mask (or the shape of
the visual), InheritFromVisualContent for the alpha of the content
of the visual (the brush of a sprite visual, the children of a layer
visual).
pub fn set_source_policy(&self, value: CompositionDropShadowSourcePolicy)
Trait Implementations§
Source§impl AsCompositionObject for DropShadow
impl AsCompositionObject for DropShadow
Source§fn as_composition_object(&self) -> &CompositionObject
fn as_composition_object(&self) -> &CompositionObject
CompositionObject.Source§fn composition_type_name(&self) -> &'static str
fn composition_type_name(&self) -> &'static str
Source§fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>
fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>
is CompositionPropertySet test of upstream).Source§impl DropShadowHooks for DropShadow
InitializeDefaultsExtra activates the server object: done when the
server object is created.
impl DropShadowHooks for DropShadow
InitializeDefaultsExtra activates the server object: done when the
server object is created.
fn initialize_defaults_extra(&self)
fn validate_blur_radius_change(&self, _old_value: f32, _new_value: f32)
fn on_blur_radius_changed(&self)
fn on_blur_radius_changing(&self)
fn validate_color_change(&self, _old_value: Color, _new_value: Color)
fn on_color_changed(&self)
fn on_color_changing(&self)
fn validate_mask_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )
fn on_mask_changed(&self)
fn on_mask_changing(&self)
fn validate_offset_change(&self, _old_value: Vector3D, _new_value: Vector3D)
fn on_offset_changed(&self)
fn on_offset_changing(&self)
fn validate_opacity_change(&self, _old_value: f32, _new_value: f32)
fn on_opacity_changed(&self)
fn on_opacity_changing(&self)
fn validate_source_policy_change( &self, _old_value: CompositionDropShadowSourcePolicy, _new_value: CompositionDropShadowSourcePolicy, )
fn on_source_policy_changed(&self)
fn on_source_policy_changing(&self)
Source§impl ICompositionObject for DropShadow
impl ICompositionObject for DropShadow
Source§impl ICompositionObjectAnimations for DropShadow
impl ICompositionObjectAnimations for DropShadow
Source§fn try_start_animation(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
) -> bool
fn try_start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, ) -> bool
StartAnimation(propertyName, animation, finalValue) of the class:
returns false for a property the class does not know.Source§fn get_composition_property(
&self,
property_name: &str,
) -> Option<&'static CompositionProperty>
fn get_composition_property( &self, property_name: &str, ) -> Option<&'static CompositionProperty>
Source§fn composition_object(&self) -> &CompositionObject
fn composition_object(&self) -> &CompositionObject
CompositionObject.Source§fn start_animation(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
)
fn start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, )
Source§fn start_animation_with_final_value(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
)
fn start_animation_with_final_value( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, )
start_animation. property_name may
name a sub-channel of a vector property (Offset.X, Scale.XY,
components X, Y, Z, W in any case): the animation then animates a
value of the sub-channel’s type (a scalar for one component, a
Vector2 for two, …) and leaves the other components alone. Several
sub-channels of one property run together; an animation of the whole
property replaces them.Source§fn start_animation_with_controller(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
controller: &Rc<AnimationController>,
)
fn start_animation_with_controller( &self, property_name: &str, animation: &dyn ICompositionAnimation, controller: &Rc<AnimationController>, )
StartAnimation(propertyName, animation, animationController): starts
the animation under controller, which can pause, resume, scrub and
speed it up. property_name may name a sub-channel, as for
start_animation.Source§fn try_get_animation_controller(
&self,
property_name: &str,
) -> Option<Rc<AnimationController>>
fn try_get_animation_controller( &self, property_name: &str, ) -> Option<Rc<AnimationController>>
TryGetAnimationController): the controller it was started with, or
a new controller that takes the running animation over. None when no
animation was started on the property through this object, or it was
stopped.Source§fn stop_animation(&self, property_name: &str)
fn stop_animation(&self, property_name: &str)
property_name may name a sub-channel
(Offset.X): the animations of the sub-channels that share a
component with it are stopped.Source§fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)
fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)
Source§fn start_animation_group_part(
&self,
animation: &dyn ICompositionAnimation,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group_part( &self, animation: &dyn ICompositionAnimation, target: &str, final_value: ExpressionVariant, ) -> bool
StartAnimationGroupPart.Source§fn start_animation_group_for(
&self,
grp: &dyn ICompositionAnimationBase,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group_for( &self, grp: &dyn ICompositionAnimationBase, target: &str, final_value: ExpressionVariant, ) -> bool
target to final_value. Returns whether one of the
animations targets that property.Source§fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)
fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)
Source§impl ICompositionObjectHost for DropShadow
impl ICompositionObjectHost for DropShadow
Source§fn server(&self) -> ServerObjectId
fn server(&self) -> ServerObjectId
Source§fn pending_animations(&self) -> &PendingAnimations
fn pending_animations(&self) -> &PendingAnimations
Source§fn implicit_animation(
&self,
property_name: &str,
) -> Option<Rc<dyn ICompositionAnimationBase>>
fn implicit_animation( &self, property_name: &str, ) -> Option<Rc<dyn ICompositionAnimationBase>>
ImplicitAnimations?.TryGetValue(name)).Source§fn start_animation_group(
&self,
grp: &Rc<dyn ICompositionAnimationBase>,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group( &self, grp: &Rc<dyn ICompositionAnimationBase>, target: &str, final_value: ExpressionVariant, ) -> bool
target to final_value. Returns whether one of the
animations targets that property.Source§impl ICompositorSerializable for DropShadow
impl ICompositorSerializable for DropShadow
Source§fn try_get_server(&self, c: &Compositor) -> Option<ServerObjectId>
fn try_get_server(&self, c: &Compositor) -> Option<ServerObjectId>
c, if it
has one.Source§fn serialize_changes(&self, c: &Compositor, writer: &mut BatchStreamWriter<'_>)
fn serialize_changes(&self, c: &Compositor, writer: &mut BatchStreamWriter<'_>)
c.Source§fn serialization_key(&self) -> *const ()
fn serialization_key(&self) -> *const ()
Source§fn prepare_serialization(&self, _c: &Compositor)
fn prepare_serialization(&self, _c: &Compositor)
c. Read moreSource§impl IRegisterForSerialization for DropShadow
impl IRegisterForSerialization for DropShadow
fn register_for_serialization(&self)
Auto Trait Implementations§
impl !Freeze for DropShadow
impl !RefUnwindSafe for DropShadow
impl !Send for DropShadow
impl !Sync for DropShadow
impl !UnwindSafe for DropShadow
impl Unpin for DropShadow
impl UnsafeUnpin for DropShadow
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