pub struct CompositionLight { /* private fields */ }Expand description
A light (WinUI Microsoft.UI.Composition.CompositionLight): it lights
the visuals of targets and their subtrees, minus the
visuals of exclusions_from_targets
and their subtrees, while it is_enabled. A visual
that some enabled light reaches shows its content multiplied by the sum
of the lights that reach it, so it is dark where none of them shines.
Deviation (winui-composition.md): the lighting is a light map drawn over
the content of each lit visual, see server::LitContent.
Implementations§
Source§impl CompositionLight
impl CompositionLight
Sourcepub fn light_props(&self) -> &CompositionLightProps
pub fn light_props(&self) -> &CompositionLightProps
The generated properties of CompositionLight.
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 light.
pub fn is_disposed(&self) -> bool
Sourcepub fn dispose(&self)
pub fn dispose(&self)
Disposes the light and its two collections: the visuals it lit are drawn without it from the next frame.
Sourcepub fn targets(&self) -> &Rc<VisualUnorderedCollection>
pub fn targets(&self) -> &Rc<VisualUnorderedCollection>
Targets: the visuals the light lights, with their subtrees.
Sourcepub fn exclusions_from_targets(&self) -> &Rc<VisualUnorderedCollection>
pub fn exclusions_from_targets(&self) -> &Rc<VisualUnorderedCollection>
ExclusionsFromTargets: the visuals, with their subtrees, the light
does not light although they are in the subtree of a target.
Sourcepub fn set_xaml_binding(
&self,
id: Option<String>,
scope: Option<Rc<CompositionVisual>>,
)
pub fn set_xaml_binding( &self, id: Option<String>, scope: Option<Rc<CompositionVisual>>, )
Binds the light to a XAML light (XamlLight.CompositionLight): the
light then also lights the XAML brushes that target the id id
(XamlLight.AddTargetBrush) where they are drawn in the subtree of
scope, the visual of the element whose Lights holds the XAML
light. None unbinds it. Called by XamlLight.
Sourcepub fn xaml_id(&self) -> Option<String>
pub fn xaml_id(&self) -> Option<String>
The id of the XAML light the light is bound to, if any.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
IsEnabled (default true): a disabled light lights nothing, and
the visuals it targets are drawn as if it did not exist.
pub fn set_is_enabled(&self, value: bool)
Trait Implementations§
Source§impl AmbientLightHooks for CompositionLight
impl AmbientLightHooks for CompositionLight
fn initialize_defaults_extra(&self)
fn validate_color_change(&self, _old_value: Color, _new_value: Color)
fn on_color_changed(&self)
fn on_color_changing(&self)
fn validate_intensity_change(&self, _old_value: f32, _new_value: f32)
fn on_intensity_changed(&self)
fn on_intensity_changing(&self)
Source§impl AsCompositionObject for CompositionLight
impl AsCompositionObject for CompositionLight
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 CompositionLightHooks for CompositionLight
impl CompositionLightHooks for CompositionLight
fn initialize_defaults_extra(&self)
fn validate_targets_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )
fn on_targets_changed(&self)
fn on_targets_changing(&self)
fn validate_exclusions_from_targets_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )
fn on_exclusions_from_targets_changed(&self)
fn on_exclusions_from_targets_changing(&self)
fn validate_is_enabled_change(&self, _old_value: bool, _new_value: bool)
fn on_is_enabled_changed(&self)
fn on_is_enabled_changing(&self)
Source§impl DistantLightHooks for CompositionLight
impl DistantLightHooks for CompositionLight
fn initialize_defaults_extra(&self)
fn validate_color_change(&self, _old_value: Color, _new_value: Color)
fn on_color_changed(&self)
fn on_color_changing(&self)
fn validate_coordinate_space_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )
fn on_coordinate_space_changed(&self)
fn on_coordinate_space_changing(&self)
fn validate_direction_change(&self, _old_value: Vector3D, _new_value: Vector3D)
fn on_direction_changed(&self)
fn on_direction_changing(&self)
fn validate_intensity_change(&self, _old_value: f32, _new_value: f32)
fn on_intensity_changed(&self)
fn on_intensity_changing(&self)
Source§impl ICompositionObjectAnimations for CompositionLight
impl ICompositionObjectAnimations for CompositionLight
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 CompositionLight
impl ICompositionObjectHost for CompositionLight
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 CompositionLight
impl ICompositorSerializable for CompositionLight
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 CompositionLight
impl IRegisterForSerialization for CompositionLight
fn register_for_serialization(&self)
Source§impl PointLightHooks for CompositionLight
impl PointLightHooks for CompositionLight
fn initialize_defaults_extra(&self)
fn validate_color_change(&self, _old_value: Color, _new_value: Color)
fn on_color_changed(&self)
fn on_color_changing(&self)
fn validate_constant_attenuation_change(&self, _old_value: f32, _new_value: f32)
fn on_constant_attenuation_changed(&self)
fn on_constant_attenuation_changing(&self)
fn validate_linear_attenuation_change(&self, _old_value: f32, _new_value: f32)
fn on_linear_attenuation_changed(&self)
fn on_linear_attenuation_changing(&self)
fn validate_quadratic_attenuation_change( &self, _old_value: f32, _new_value: f32, )
fn on_quadratic_attenuation_changed(&self)
fn on_quadratic_attenuation_changing(&self)
fn validate_coordinate_space_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )
fn on_coordinate_space_changed(&self)
fn on_coordinate_space_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_intensity_change(&self, _old_value: f32, _new_value: f32)
fn on_intensity_changed(&self)
fn on_intensity_changing(&self)
fn validate_min_attenuation_cutoff_change( &self, _old_value: f32, _new_value: f32, )
fn on_min_attenuation_cutoff_changed(&self)
fn on_min_attenuation_cutoff_changing(&self)
fn validate_max_attenuation_cutoff_change( &self, _old_value: f32, _new_value: f32, )
fn on_max_attenuation_cutoff_changed(&self)
fn on_max_attenuation_cutoff_changing(&self)
Source§impl SpotLightHooks for CompositionLight
impl SpotLightHooks for CompositionLight
fn initialize_defaults_extra(&self)
fn validate_constant_attenuation_change(&self, _old_value: f32, _new_value: f32)
fn on_constant_attenuation_changed(&self)
fn on_constant_attenuation_changing(&self)
fn validate_linear_attenuation_change(&self, _old_value: f32, _new_value: f32)
fn on_linear_attenuation_changed(&self)
fn on_linear_attenuation_changing(&self)
fn validate_quadratic_attenuation_change( &self, _old_value: f32, _new_value: f32, )
fn on_quadratic_attenuation_changed(&self)
fn on_quadratic_attenuation_changing(&self)
fn validate_coordinate_space_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )
fn on_coordinate_space_changed(&self)
fn on_coordinate_space_changing(&self)
fn validate_direction_change(&self, _old_value: Vector3D, _new_value: Vector3D)
fn on_direction_changed(&self)
fn on_direction_changing(&self)
fn validate_inner_cone_angle_change(&self, _old_value: f32, _new_value: f32)
fn on_inner_cone_angle_changed(&self)
fn on_inner_cone_angle_changing(&self)
fn validate_inner_cone_color_change(&self, _old_value: Color, _new_value: Color)
fn on_inner_cone_color_changed(&self)
fn on_inner_cone_color_changing(&self)
fn validate_inner_cone_intensity_change(&self, _old_value: f32, _new_value: f32)
fn on_inner_cone_intensity_changed(&self)
fn on_inner_cone_intensity_changing(&self)
fn validate_outer_cone_angle_change(&self, _old_value: f32, _new_value: f32)
fn on_outer_cone_angle_changed(&self)
fn on_outer_cone_angle_changing(&self)
fn validate_outer_cone_color_change(&self, _old_value: Color, _new_value: Color)
fn on_outer_cone_color_changed(&self)
fn on_outer_cone_color_changing(&self)
fn validate_outer_cone_intensity_change(&self, _old_value: f32, _new_value: f32)
fn on_outer_cone_intensity_changed(&self)
fn on_outer_cone_intensity_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_min_attenuation_cutoff_change( &self, _old_value: f32, _new_value: f32, )
fn on_min_attenuation_cutoff_changed(&self)
fn on_min_attenuation_cutoff_changing(&self)
fn validate_max_attenuation_cutoff_change( &self, _old_value: f32, _new_value: f32, )
fn on_max_attenuation_cutoff_changed(&self)
fn on_max_attenuation_cutoff_changing(&self)
Auto Trait Implementations§
impl !Freeze for CompositionLight
impl !RefUnwindSafe for CompositionLight
impl !Send for CompositionLight
impl !Sync for CompositionLight
impl !UnwindSafe for CompositionLight
impl Unpin for CompositionLight
impl UnsafeUnpin for CompositionLight
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