XamlCompositionBrushBase
struct · ferroui-base · v0.5.0
struct XamlCompositionBrushBase
A brush that paints an area with a composition brush (WinUI
Microsoft.UI.Xaml.Media.XamlCompositionBrushBase).
A subclass creates its composition_brush
when the brush is first used in a window that has a compositor
(OnConnected) and releases it when no element of such a window uses it
any more (OnDisconnected). The compositor paints the composition brush
inside the shape the brush fills, as the brushes of WinUI's composition
are painted; where no composition brush is set, and where the brush is
drawn without a compositor (an image of a visual drawn by the immediate
renderer), the area is filled with fallback_color.
Members
TYPEto_refon_connectedon_disconnectedfallback_color_propertyconstructfallback_colorset_fallback_colorcomposition_brushset_composition_brushneeds_transparent_windowset_needs_transparent_windowcompositoris_connectedlight_target_idsadd_light_target_idremove_light_target_idofas_brush
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<XamlCompositionBrushBase>
Returns a strong reference to this object.
on_connected
fn on_connected(self: &Self)
OnConnected: the brush is used in a window with a compositor for
the first time; the subclass creates its composition brush.
on_disconnected
fn on_disconnected(self: &Self)
OnDisconnected: no element of a window with a compositor uses
the brush any more; the subclass releases its composition brush.
fallback_color_property
fn fallback_color_property() -> &'static StyledProperty<Color>
FallbackColor: the colour the brush fills with when it has no
composition brush, or cannot use it.
construct
fn construct() -> Self
Creates the class data; see FerroObject::construct.
fallback_color
fn fallback_color(self: &Self) -> Color
FallbackColor.
set_fallback_color
fn set_fallback_color(self: &Self, value: Color)
composition_brush
fn composition_brush(self: &Self) -> Option<Rc<CompositionBrush>>
CompositionBrush: the composition brush the brush paints with, set
by the subclass.
set_composition_brush
fn set_composition_brush(self: &Self, brush: Option<Rc<CompositionBrush>>)
Sets the composition brush the brush paints with (None paints the
fallback colour). It must belong to the compositor the brush is
connected to.
needs_transparent_window
fn needs_transparent_window(self: &Self) -> bool
Whether the composition brush shows what is behind the window (a host backdrop): where the window of the element is opaque, the platform shows nothing behind it, and the fallback colour is painted instead.
set_needs_transparent_window
fn set_needs_transparent_window(self: &Self, value: bool)
compositor
fn compositor(self: &Self) -> Option<Rc<Compositor>>
The compositor the brush is connected to (None while it is not).
is_connected
fn is_connected(self: &Self) -> bool
Whether the brush is connected (OnConnected was called and
OnDisconnected was not since).
light_target_ids
fn light_target_ids(self: &Self) -> Vec<String>
The ids of the XAML lights that target the brush.
add_light_target_id
fn add_light_target_id(self: &Self, id: &str)
XamlLight.AddTargetBrush(id, this): the XAML lights of id id
light the brush.
remove_light_target_id
fn remove_light_target_id(self: &Self, id: &str)
XamlLight.RemoveTargetBrush(id, this).
of
fn of(brush: &dyn IBrush) -> Option<Ref<XamlCompositionBrushBase>>
The XAML composition brush brush is, if it is one.
as_brush
fn as_brush(self: &Self) -> Rc<dyn IBrush>
The brush as Rc<dyn IBrush>.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBrushImplExtXamlCompositionBrushBaseImplExtFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<XamlCompositionBrushBase>StaticTypeObjectTypeSubclassable<T>FerroObjectImplBrushImplXamlCompositionBrushBaseImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.