pub struct AlphaMask { /* private fields */ }Expand description
The alpha mask of an element: a CompositionSurfaceBrush that shows the
alpha of what the element draws, for a DropShadow.Mask and other
composition effects.
The element embeds one and forwards to it: get from its
get_alpha_mask, update_if_available at the
end of its render (WinUI’s NotifyRenderContent).
As in WinUI the brush is created on the first request and stays the same
object for the life of the element; its surface is an image of the
element’s own drawing at the scale of its transform to the window and of
the scaling of the window (WinUI’s realization scale), with the colour
dropped (black with the alpha, as an alpha-only texture is sampled). The
image is drawn again each time the element draws its content again, so
it follows the text, the geometry, the source and the size; while the
element has no size, is not visible or is not in a tree, the brush has no
surface and paints nothing. Its Stretch is Fill, so a visual of the
size of the element shows the mask over itself.
Implementations§
Source§impl AlphaMask
impl AlphaMask
pub fn new() -> Self
Sourcepub fn get(&self, element: &Visual) -> Option<Rc<CompositionBrush>>
pub fn get(&self, element: &Visual) -> Option<Rc<CompositionBrush>>
GetAlphaMask: the brush of the mask of element, created on the
first call and drawn at once when the element can be drawn (WinUI’s
AlphaMask::Ensure). None when no compositor is available for the
element.
Sourcepub fn is_present(&self) -> bool
pub fn is_present(&self) -> bool
Whether the brush was created.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the brush shows an image of the element.
Sourcepub fn update_if_available(&self, element: &Visual)
pub fn update_if_available(&self, element: &Visual)
Draws the mask of element again when the brush was created (WinUI’s
AlphaMask::UpdateIfAvailable, called by the render walk for an
element whose content is drawn again): an element with a size, in a
tree and visible gets a new image; otherwise the brush loses its
surface.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AlphaMask
impl !RefUnwindSafe for AlphaMask
impl !Send for AlphaMask
impl !Sync for AlphaMask
impl !UnwindSafe for AlphaMask
impl Unpin for AlphaMask
impl UnsafeUnpin for AlphaMask
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