XamlLight
struct · ferroui-base · v0.5.0
struct XamlLight
A light of the object model (WinUI Microsoft.UI.Xaml.Media.XamlLight).
A subclass gives the light an id (get_id) and
creates its composition light when the light is connected to the element
that holds it (on_connected), setting it
with set_composition_light. The light
then lights, in the subtree of that element:
- the elements that target its id (
add_target_element): their composition visuals are targets of the composition light, which lights their content; - the XAML brushes that target its id (
add_target_brush): the scene lighting effects of those brushes receive the light.
The composition light is in the coordinates of the element that holds
it (its CoordinateSpace is the composition visual of that element).
Members
TYPEto_refget_idon_connectedon_disconnectedconstructidcomposition_lightset_composition_lighthostis_connectedadd_target_elementremove_target_elementadd_target_brushremove_target_brush
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<XamlLight>
Returns a strong reference to this object.
get_id
fn get_id(self: &Self) -> String
GetId: the id the elements and brushes the light lights target.
on_connected
fn on_connected(self: &Self, new_element: &Visual)
OnConnected: the light is in the Lights of new_element, which
is in a visual tree.
on_disconnected
fn on_disconnected(self: &Self, old_element: &Visual)
OnDisconnected: the light left old_element, or the element
left its visual tree.
construct
fn construct() -> Self
Creates the class data.
id
fn id(self: &Self) -> String
The id of the light (GetId).
composition_light
fn composition_light(self: &Self) -> Option<Rc<CompositionLight>>
CompositionLight.
set_composition_light
fn set_composition_light(self: &Self, light: Option<Rc<CompositionLight>>)
Sets the composition light (None removes it). While the light is
connected, the composition light is bound to the element that holds
it: its coordinate space is that element, and it lights the targets
of the id of the light in its subtree.
host
fn host(self: &Self) -> Option<Ref<Visual>>
The element whose Lights holds the light, while it is connected.
is_connected
fn is_connected(self: &Self) -> bool
Whether the light is connected to an element.
add_target_element
fn add_target_element(id: &str, element: &Visual)
AddTargetElement(id, element): the XAML lights of id id light
element (its content and its subtree) where it is in the subtree of
the element that holds them.
remove_target_element
fn remove_target_element(id: &str, element: &Visual)
RemoveTargetElement(id, element).
add_target_brush
fn add_target_brush(id: &str, brush: &Rc<dyn IBrush>)
AddTargetBrush(id, brush): the XAML lights of id id light brush
where it is drawn in the subtree of the element that holds them. Only
a XAML composition brush can be lit (its scene lighting effects
receive the light); other brushes are left as they are.
remove_target_brush
fn remove_target_brush(id: &str, brush: &Rc<dyn IBrush>)
RemoveTargetBrush(id, brush).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeXamlLightImplExtFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<XamlLight>StaticTypeObjectTypeSubclassable<T>FerroObjectImplXamlLightImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.