FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<XamlCompositionBrushBase>
    

    Returns a strong reference to this object.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see FerroObject::construct.

    Source

    fallback_color

    fn fallback_color(self: &Self) -> Color
    

    FallbackColor.

    Source

    set_fallback_color

    fn set_fallback_color(self: &Self, value: Color)
    

    Source

    composition_brush

    fn composition_brush(self: &Self) -> Option<Rc<CompositionBrush>>
    

    CompositionBrush: the composition brush the brush paints with, set by the subclass.

    Source

    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.

    Source

    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.

    Source

    set_needs_transparent_window

    fn set_needs_transparent_window(self: &Self, value: bool)
    

    Source

    compositor

    fn compositor(self: &Self) -> Option<Rc<Compositor>>
    

    The compositor the brush is connected to (None while it is not).

    Source

    is_connected

    fn is_connected(self: &Self) -> bool
    

    Whether the brush is connected (OnConnected was called and OnDisconnected was not since).

    Source

    light_target_ids

    fn light_target_ids(self: &Self) -> Vec<String>
    

    The ids of the XAML lights that target the brush.

    Source

    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.

    Source

    remove_light_target_id

    fn remove_light_target_id(self: &Self, id: &str)
    

    XamlLight.RemoveTargetBrush(id, this).

    Source

    of

    fn of(brush: &dyn IBrush) -> Option<Ref<XamlCompositionBrushBase>>
    

    The XAML composition brush brush is, if it is one.

    Source

    as_brush

    fn as_brush(self: &Self) -> Rc<dyn IBrush>
    

    The brush as Rc<dyn IBrush>.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.