ElementCompositionPreview
struct · ferroui-controls · v0.5.0
struct ElementCompositionPreview
Access to the composition visuals of elements and to the composition-driven behaviours of
elements (Microsoft.UI.Xaml.Hosting.ElementCompositionPreview).
Members
get_element_visualget_element_child_visualset_element_child_visualset_implicit_show_animationset_implicit_hide_animationset_is_translation_enabledget_scroll_viewer_manipulation_property_setget_pointer_position_property_set
get_element_visual
fn get_element_visual(element: &Visual) -> Option<Rc<CompositionVisual>>
GetElementVisual: the composition visual of element (WinUI's handoff visual). The
same visual is returned while the element stays in the tree; None while the element is
not in a tree rendered by a compositor.
The renderer writes the Offset, Size, Opacity, IsVisible, clip and
TransformMatrix of this visual when the element is rendered again, as WinUI's layout
writes the handoff visual; Translation, Scale, CenterPoint, RotationAngle,
Orientation and AnchorPoint belong to the application.
get_element_child_visual
fn get_element_child_visual(element: &Visual) -> Option<Rc<CompositionVisual>>
GetElementChildVisual: the visual set with
set_element_child_visual (WinUI's hand-in visual).
set_element_child_visual
fn set_element_child_visual(element: &Visual, visual: Option<Rc<CompositionVisual>>)
SetElementChildVisual: shows visual as the last child of the composition visual of
element, above the element's content and children. None removes it.
set_implicit_show_animation
fn set_implicit_show_animation(element: &Visual, animation: Option<Rc<dyn ICompositionAnimationBase>>)
SetImplicitShowAnimation: the animation (or animation group) started on the visual of
element when the element is added to the tree or its IsVisible becomes true.
set_implicit_hide_animation
fn set_implicit_hide_animation(element: &Visual, animation: Option<Rc<dyn ICompositionAnimationBase>>)
SetImplicitHideAnimation: the animation (or animation group) started on the visual of
element when the element is removed from the tree or its IsVisible becomes false.
The element stays visible until the animation completes.
set_is_translation_enabled
fn set_is_translation_enabled(element: &Visual, value: bool)
SetIsTranslationEnabled.
In WinUI the handoff visual gains a Translation entry in its property set, which the
framework then folds into the transform of the element. Here every composition visual has
a Translation property, applied after its other transforms, so translation is always
enabled; the call records the request and changes nothing else.
get_scroll_viewer_manipulation_property_set
fn get_scroll_viewer_manipulation_property_set(scroll_viewer: &ScrollViewer) -> Option<Rc<CompositionPropertySet>>
GetScrollViewerManipulationPropertySet: a property set that follows the scrolling and the
zoom of scroll_viewer, with the entries of WinUI's manipulation transform
(ManipulationTransform.cpp): Translation (the translation of the content: the negated
offset, in zoomed units, as a Vector3), Pan (the same: the zoom is about the origin of
the content), Scale ((ZoomFactor, ZoomFactor, 1)), CenterPoint (the centre of that
scale, the origin) and Matrix (the scale followed by the translation, a Matrix4x4).
The same set is returned for the same scroll viewer.
Typical uses: an expression animation of a header's Offset or Translation that reads
scroller.Translation.Y for a parallax effect, or scroller.Scale.X to keep an overlay
at the same size while the content zooms.
Deviation (winui-composition.md): in WinUI the compositor updates the set during a
manipulation without the UI thread; here the set is written when the offset or the zoom
of the scroll viewer changes, on the UI thread, in the batch of the frame in which the
content moves (FerroUI scrolls on the UI thread, and its compositor runs there too).
None when no compositor is available.
get_pointer_position_property_set
fn get_pointer_position_property_set(element: &Visual) -> Option<Rc<CompositionPropertySet>>
GetPointerPositionPropertySet: a property set with a Position entry (a Vector3)
that follows the pointer over the window of element, in the coordinates of element.
A new set is returned on each call, as in WinUI.
WinUI drives the set from the compositor's hover input; here it is updated by the moves
of the pointer that the window of the element receives, handled or not, on the UI thread.
The set follows the element into another window. None when no compositor is
available.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.