Skip to main content

CompositionVisual

Struct CompositionVisual 

Source
pub struct CompositionVisual { /* private fields */ }
Expand description

A node of the composition visual tree.

Implementations§

Source§

impl CompositionVisual

Source

pub fn rotation_angle_in_degrees(&self) -> f32

The rotation about the rotation axis in degrees: a view of rotation_angle.

Deviation (winui-composition.md): not an animation target of its own; animate RotationAngle.

Source

pub fn set_rotation_angle_in_degrees(&self, value: f32)

Source

pub fn rotation_axis(&self) -> Vector3D

The axis rotation_angle rotates about (default (0, 0, 1); animatable as RotationAxis).

Deviation (winui-composition.md): an axis along Z (or a zero axis) rotates in the plane; any other axis rotates in 3D, of which the 2D renderers show the projection, as for Orientation.

Source

pub fn set_rotation_axis(&self, value: Vector3D)

Source

pub fn relative_offset_adjustment(&self) -> Vector3D

The part of the size of the parent added to the offset: the offset of the visual is Offset + RelativeOffsetAdjustment * parent size (animatable as RelativeOffsetAdjustment; Z is not adjusted, the parent has no depth).

Source

pub fn set_relative_offset_adjustment(&self, value: Vector3D)

Source

pub fn relative_size_adjustment(&self) -> Vector

The part of the size of the parent added to the size: the size of the visual is Size + RelativeSizeAdjustment * parent size (animatable as RelativeSizeAdjustment). (1, 1) with a zero Size makes the visual as large as its parent.

Source

pub fn set_relative_size_adjustment(&self, value: Vector)

Source

pub fn effective_size(&self) -> Vector

The size of the visual with its relative size adjustment applied: what is rendered and hit tested. size is the Size property alone.

Source

pub fn is_hit_test_visible(&self) -> bool

Whether the visual and its subtree take part in hit testing (default true).

Source

pub fn set_is_hit_test_visible(&self, value: bool)

Source

pub fn is_pixel_snapping_enabled(&self) -> bool

Whether the offset of the visual is snapped to device pixels.

Deviation (winui-composition.md): the translation of the transform of the visual relative to its parent is rounded to device pixels of its target, not its position in the window.

Source

pub fn set_is_pixel_snapping_enabled(&self, value: bool)

Source

pub fn border_mode(&self) -> CompositionBorderMode

How the edges of the visual are antialiased. Stored only.

Source

pub fn set_border_mode(&self, value: CompositionBorderMode)

Source

pub fn backface_visibility(&self) -> CompositionBackfaceVisibility

Whether the back of the visual is shown when it is turned in 3D. Stored only.

Source

pub fn set_backface_visibility(&self, value: CompositionBackfaceVisibility)

Source

pub fn composite_mode(&self) -> CompositionCompositeMode

How the visual is blended with what is behind it. Stored only.

Source

pub fn set_composite_mode(&self, value: CompositionCompositeMode)

Source

pub fn parent_for_transform(&self) -> Option<Rc<CompositionVisual>>

The visual whose coordinate space the transform of this visual is relative to, instead of its parent: the visual is drawn where its parent is, in the place its offset and transform give it inside parent_for_transform.

Deviation (winui-composition.md): the two visuals must be in one tree (otherwise the transform is relative to the parent); clips and opacity still come from the parent chain.

Source

pub fn set_parent_for_transform(&self, value: Option<Rc<CompositionVisual>>)

Source§

impl CompositionVisual

Source

pub fn visible(&self) -> bool

Source

pub fn set_visible(&self, value: bool)

Source

pub fn opacity(&self) -> f32

Source

pub fn set_opacity(&self, value: f32)

Source

pub fn clip(&self) -> Option<Arc<dyn IGeometryImpl>>

The geometry the visual is clipped with.

Source

pub fn set_clip(&self, value: Option<Arc<dyn IGeometryImpl>>)

Source

pub fn clip_to_bounds(&self) -> bool

Source

pub fn set_clip_to_bounds(&self, value: bool)

Source

pub fn offset(&self) -> Vector3D

Source

pub fn set_offset(&self, value: Vector3D)

Source

pub fn translation(&self) -> Vector3D

Source

pub fn set_translation(&self, value: Vector3D)

Source

pub fn size(&self) -> Vector

Source

pub fn set_size(&self, value: Vector)

Source

pub fn anchor_point(&self) -> Vector

Source

pub fn set_anchor_point(&self, value: Vector)

Source

pub fn center_point(&self) -> Vector3D

Source

pub fn set_center_point(&self, value: Vector3D)

Source

pub fn rotation_angle(&self) -> f32

Source

pub fn set_rotation_angle(&self, value: f32)

Source

pub fn orientation(&self) -> Quaternion

Source

pub fn set_orientation(&self, value: Quaternion)

Source

pub fn scale(&self) -> Vector3D

Source

pub fn set_scale(&self, value: Vector3D)

Source

pub fn transform_matrix(&self) -> Matrix

Source

pub fn set_transform_matrix(&self, value: Matrix)

Source

pub fn adorner_is_clipped(&self) -> bool

Whether the adorner is clipped by the clips of the adorned visual and its ancestors.

Source

pub fn set_adorner_is_clipped(&self, value: bool)

Source

pub fn effect(&self) -> Option<Arc<dyn IImmutableEffect>>

Source

pub fn set_effect(&self, value: Option<Arc<dyn IImmutableEffect>>)

Source

pub fn render_options(&self) -> RenderOptions

Source

pub fn set_render_options(&self, value: RenderOptions)

Source

pub fn text_options(&self) -> TextOptions

Source

pub fn set_text_options(&self, value: TextOptions)

Source§

impl CompositionVisual

Source

pub fn visual_props(&self) -> &CompositionVisualProps

The generated properties of the visual class.

Source

pub fn compositor(&self) -> &Rc<Compositor>

Source

pub fn object(&self) -> &CompositionObject

The embedded CompositionObject.

Source

pub fn implicit_animations(&self) -> Option<Rc<ImplicitAnimationCollection>>

The collection of implicit animations attached to this object.

Source

pub fn set_implicit_animations( &self, value: Option<Rc<ImplicitAnimationCollection>>, )

Source

pub fn server(&self) -> ServerObjectId

The id of the server-side visual.

Source

pub fn is_disposed(&self) -> bool

Source

pub fn dispose(&self)

Source

pub fn children(&self) -> &Rc<CompositionVisualCollection>

The children of the visual.

Source

pub fn root(&self) -> Option<Rc<CompositionTarget>>

The composition target the visual is attached to.

Source

pub fn parent(&self) -> Option<Rc<CompositionVisual>>

Source

pub fn adorned_visual(&self) -> Option<Rc<CompositionVisual>>

The visual this visual is an adorner of: its transform follows that visual.

Source

pub fn set_adorned_visual(&self, value: Option<Rc<CompositionVisual>>)

Source

pub fn cache_mode(&self) -> Option<Rc<CompositionBitmapCache>>

Source

pub fn set_cache_mode(&self, value: Option<Rc<CompositionBitmapCache>>)

Source

pub fn composition_clip(&self) -> Option<Rc<CompositionClip>>

The WinUI clip of the visual (Visual.Clip): an InsetClip or a RectangleClip, applied in the coordinates of the visual, after its transform, to its content and children.

Deviation (winui-composition.md): WinUI names it Clip; here clip is the geometry clip of the upstream compositor, so the WinUI member is composition_clip. Both may be set; the visible area is their intersection.

Source

pub fn set_composition_clip(&self, value: Option<Rc<CompositionClip>>)

Source

pub fn disable_sub_tree_bounds_hit_test_optimization(&self) -> bool

Source

pub fn opacity_mask(&self) -> Option<Rc<dyn IBrush>>

Source

pub fn set_opacity_mask(&self, value: Option<Rc<dyn IBrush>>)

Source

pub fn try_get_valid_readback(&self) -> Option<ReadbackData>

The data the server wrote back for this visual, if it is valid for the current read revision.

Source

pub fn tag(&self) -> Option<Rc<dyn Any>>

Source

pub fn set_tag(&self, value: Option<Rc<dyn Any>>)

Source

pub fn hit_test(&self, point: Point) -> bool

Whether the content of the visual is hit at a point in its own coordinates.

Source

pub fn hit_test_geometry(&self, geometry: &Ref<Geometry>) -> IntersectionResult

How the content of the visual intersects a geometry in its own coordinates.

Trait Implementations§

Source§

impl AsCompositionObject for CompositionVisual

Source§

fn as_composition_object(&self) -> &CompositionObject

The embedded CompositionObject.
Source§

fn composition_type_name(&self) -> &'static str

The name of the class of the object, for messages.
Source§

fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>

The object as a property set, if it is one (the is CompositionPropertySet test of upstream).
Source§

impl CompositionContainerVisualHooks for CompositionVisual

Source§

impl CompositionExperimentalAcrylicVisualHooks for CompositionVisual

Source§

fn base_serialize_changes_core(&self, writer: &mut BatchStreamWriter<'_>)

base.SerializeChangesCore(writer): serializes the changes of the hand-written base class CompositionDrawListVisual.
Source§

fn initialize_defaults_extra(&self)

Source§

fn validate_material_change( &self, _old_value: ImmutableExperimentalAcrylicMaterial, _new_value: ImmutableExperimentalAcrylicMaterial, )

Source§

fn on_material_changed(&self)

Source§

fn on_material_changing(&self)

Source§

fn validate_corner_radius_change( &self, _old_value: CornerRadius, _new_value: CornerRadius, )

Source§

fn on_corner_radius_changed(&self)

Source§

fn on_corner_radius_changing(&self)

Source§

impl CompositionSolidColorVisualHooks for CompositionVisual

Source§

impl CompositionSurfaceVisualHooks for CompositionVisual

Source§

impl CompositionVisualCollectionHooks<CompositionVisual> for CompositionVisualCollection

Source§

impl CompositionVisualHooks for CompositionVisual

Source§

fn on_root_changed(&self)

Source§

fn on_parent_changing(&self)

Source§

fn on_parent_changed(&self)

Source§

fn initialize_defaults_extra(&self)

Source§

fn validate_root_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )

Source§

fn on_root_changing(&self)

Source§

fn validate_parent_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )

Source§

fn validate_visible_change(&self, _old_value: bool, _new_value: bool)

Source§

fn on_visible_changed(&self)

Source§

fn on_visible_changing(&self)

Source§

fn validate_opacity_change(&self, _old_value: f32, _new_value: f32)

Source§

fn on_opacity_changed(&self)

Source§

fn on_opacity_changing(&self)

Source§

fn validate_clip_change( &self, _old_value: &Option<Arc<dyn IGeometryImpl>>, _new_value: &Option<Arc<dyn IGeometryImpl>>, )

Source§

fn on_clip_changed(&self)

Source§

fn on_clip_changing(&self)

Source§

fn validate_clip_to_bounds_change(&self, _old_value: bool, _new_value: bool)

Source§

fn on_clip_to_bounds_changed(&self)

Source§

fn on_clip_to_bounds_changing(&self)

Source§

fn validate_offset_change(&self, _old_value: Vector3D, _new_value: Vector3D)

Source§

fn on_offset_changed(&self)

Source§

fn on_offset_changing(&self)

Source§

fn validate_translation_change( &self, _old_value: Vector3D, _new_value: Vector3D, )

Source§

fn on_translation_changed(&self)

Source§

fn on_translation_changing(&self)

Source§

fn validate_size_change(&self, _old_value: Vector, _new_value: Vector)

Source§

fn on_size_changed(&self)

Source§

fn on_size_changing(&self)

Source§

fn validate_anchor_point_change(&self, _old_value: Vector, _new_value: Vector)

Source§

fn on_anchor_point_changed(&self)

Source§

fn on_anchor_point_changing(&self)

Source§

fn validate_center_point_change( &self, _old_value: Vector3D, _new_value: Vector3D, )

Source§

fn on_center_point_changed(&self)

Source§

fn on_center_point_changing(&self)

Source§

fn validate_rotation_angle_change(&self, _old_value: f32, _new_value: f32)

Source§

fn on_rotation_angle_changed(&self)

Source§

fn on_rotation_angle_changing(&self)

Source§

fn validate_orientation_change( &self, _old_value: Quaternion, _new_value: Quaternion, )

Source§

fn on_orientation_changed(&self)

Source§

fn on_orientation_changing(&self)

Source§

fn validate_scale_change(&self, _old_value: Vector3D, _new_value: Vector3D)

Source§

fn on_scale_changed(&self)

Source§

fn on_scale_changing(&self)

Source§

fn validate_transform_matrix_change( &self, _old_value: Matrix, _new_value: Matrix, )

Source§

fn on_transform_matrix_changed(&self)

Source§

fn on_transform_matrix_changing(&self)

Source§

fn validate_adorned_visual_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )

Source§

fn on_adorned_visual_changed(&self)

Source§

fn on_adorned_visual_changing(&self)

Source§

fn validate_adorner_is_clipped_change(&self, _old_value: bool, _new_value: bool)

Source§

fn on_adorner_is_clipped_changed(&self)

Source§

fn on_adorner_is_clipped_changing(&self)

Source§

fn validate_opacity_mask_brush_change( &self, _old_value: &Option<BatchResource<dyn IBrush>>, _new_value: &Option<BatchResource<dyn IBrush>>, )

Source§

fn on_opacity_mask_brush_changed(&self)

Source§

fn on_opacity_mask_brush_changing(&self)

Source§

fn validate_effect_change( &self, _old_value: &Option<Arc<dyn IImmutableEffect>>, _new_value: &Option<Arc<dyn IImmutableEffect>>, )

Source§

fn on_effect_changed(&self)

Source§

fn on_effect_changing(&self)

Source§

fn validate_render_options_change( &self, _old_value: RenderOptions, _new_value: RenderOptions, )

Source§

fn on_render_options_changed(&self)

Source§

fn on_render_options_changing(&self)

Source§

fn validate_text_options_change( &self, _old_value: TextOptions, _new_value: TextOptions, )

Source§

fn on_text_options_changed(&self)

Source§

fn on_text_options_changing(&self)

Source§

fn validate_cache_mode_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )

Source§

fn on_cache_mode_changed(&self)

Source§

fn on_cache_mode_changing(&self)

Source§

fn validate_composition_clip_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )

Source§

fn on_composition_clip_changed(&self)

Source§

fn on_composition_clip_changing(&self)

Source§

fn validate_rotation_axis_change( &self, _old_value: Vector3D, _new_value: Vector3D, )

Source§

fn on_rotation_axis_changed(&self)

Source§

fn on_rotation_axis_changing(&self)

Source§

fn validate_relative_offset_adjustment_change( &self, _old_value: Vector3D, _new_value: Vector3D, )

Source§

fn on_relative_offset_adjustment_changed(&self)

Source§

fn on_relative_offset_adjustment_changing(&self)

Source§

fn validate_relative_size_adjustment_change( &self, _old_value: Vector, _new_value: Vector, )

Source§

fn on_relative_size_adjustment_changed(&self)

Source§

fn on_relative_size_adjustment_changing(&self)

Source§

fn validate_is_hit_test_visible_change( &self, _old_value: bool, _new_value: bool, )

Source§

fn on_is_hit_test_visible_changed(&self)

Source§

fn on_is_hit_test_visible_changing(&self)

Source§

fn validate_is_pixel_snapping_enabled_change( &self, _old_value: bool, _new_value: bool, )

Source§

fn on_is_pixel_snapping_enabled_changed(&self)

Source§

fn on_is_pixel_snapping_enabled_changing(&self)

Source§

fn validate_border_mode_change( &self, _old_value: CompositionBorderMode, _new_value: CompositionBorderMode, )

Source§

fn on_border_mode_changed(&self)

Source§

fn on_border_mode_changing(&self)

Source§

fn validate_backface_visibility_change( &self, _old_value: CompositionBackfaceVisibility, _new_value: CompositionBackfaceVisibility, )

Source§

fn on_backface_visibility_changed(&self)

Source§

fn on_backface_visibility_changing(&self)

Source§

fn validate_composite_mode_change( &self, _old_value: CompositionCompositeMode, _new_value: CompositionCompositeMode, )

Source§

fn on_composite_mode_changed(&self)

Source§

fn on_composite_mode_changing(&self)

Source§

fn validate_parent_for_transform_change( &self, _old_value: &Option<Rc<dyn ICompositionObject>>, _new_value: &Option<Rc<dyn ICompositionObject>>, )

Source§

fn on_parent_for_transform_changed(&self)

Source§

fn on_parent_for_transform_changing(&self)

Source§

impl ICompositionObject for CompositionVisual

Source§

fn server(&self) -> ServerObjectId

The id of the server-side counterpart of the object.
Source§

fn as_any(&self) -> &dyn Any

Source§

fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>

Source§

impl ICompositionObjectAnimations for CompositionVisual

Source§

fn try_start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, ) -> bool

StartAnimation(propertyName, animation, finalValue) of the class: returns false for a property the class does not know.
Source§

fn get_composition_property( &self, property_name: &str, ) -> Option<&'static CompositionProperty>

The composition property with the given name.
Source§

fn composition_object(&self) -> &CompositionObject

The embedded CompositionObject.
Source§

fn start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, )

Connects an animation with the named property of the object and starts the animation.
Source§

fn start_animation_with_final_value( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, )

See start_animation. property_name may name a sub-channel of a vector property (Offset.X, Scale.XY, components X, Y, Z, W in any case): the animation then animates a value of the sub-channel’s type (a scalar for one component, a Vector2 for two, …) and leaves the other components alone. Several sub-channels of one property run together; an animation of the whole property replaces them.
Source§

fn start_animation_with_controller( &self, property_name: &str, animation: &dyn ICompositionAnimation, controller: &Rc<AnimationController>, )

StartAnimation(propertyName, animation, animationController): starts the animation under controller, which can pause, resume, scrub and speed it up. property_name may name a sub-channel, as for start_animation.
Source§

fn try_get_animation_controller( &self, property_name: &str, ) -> Option<Rc<AnimationController>>

The controller of the animation of the named property (TryGetAnimationController): the controller it was started with, or a new controller that takes the running animation over. None when no animation was started on the property through this object, or it was stopped.
Source§

fn stop_animation(&self, property_name: &str)

Disconnects an animation from the named property and stops it, applying its stop behavior. property_name may name a sub-channel (Offset.X): the animations of the sub-channels that share a component with it are stopped.
Source§

fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)

Starts an animation group. The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup. All the animations in the group will be started at the same time on the object.
Source§

fn start_animation_group_part( &self, animation: &dyn ICompositionAnimation, target: &str, final_value: ExpressionVariant, ) -> bool

StartAnimationGroupPart.
Source§

fn start_animation_group_for( &self, grp: &dyn ICompositionAnimationBase, target: &str, final_value: ExpressionVariant, ) -> bool

Starts an animation or an animation group triggered by the change of property target to final_value. Returns whether one of the animations targets that property.
Source§

fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)

Stops an animation group.
Source§

impl ICompositionObjectHost for CompositionVisual

Source§

fn server(&self) -> ServerObjectId

The id of the server-side counterpart of the object.
Source§

fn pending_animations(&self) -> &PendingAnimations

The animations waiting to be sent with the next batch.
Source§

fn implicit_animation( &self, property_name: &str, ) -> Option<Rc<dyn ICompositionAnimationBase>>

The implicit animation attached to a property of the object, if there is one (ImplicitAnimations?.TryGetValue(name)).
Source§

fn start_animation_group( &self, grp: &Rc<dyn ICompositionAnimationBase>, target: &str, final_value: ExpressionVariant, ) -> bool

Starts an animation or an animation group triggered by the change of property target to final_value. Returns whether one of the animations targets that property.
Source§

impl ICompositorSerializable for CompositionVisual

Source§

fn try_get_server(&self, c: &Compositor) -> Option<ServerObjectId>

The server-side counterpart of the object on compositor c, if it has one.
Source§

fn serialize_changes(&self, c: &Compositor, writer: &mut BatchStreamWriter<'_>)

Writes the pending changes of the object for compositor c.
Source§

fn serialization_key(&self) -> *const ()

The identity of the object, by which a compositor avoids queueing it twice. The default is the address of the implementing value; an adapter around an object returns the identity of that object.
Source§

fn prepare_serialization(&self, _c: &Compositor)

Called before the changes of the object are written for compositor c. Read more
Source§

impl IRegisterForSerialization for CompositionVisual

Source§

impl LayerVisualHooks for CompositionVisual

Source§

impl RedirectVisualHooks for CompositionVisual

Source§

impl ShapeVisualHooks for CompositionVisual

Source§

impl SpriteVisualHooks for CompositionVisual

Source§

impl VisualUnorderedCollectionHooks<CompositionVisual> for VisualUnorderedCollection

Source§

fn initialize_defaults_extra(&self)

Source§

fn on_before_added(&self, _item: &Rc<TItem>)

Source§

fn on_added(&self, _item: &Rc<TItem>)

Source§

fn on_removed(&self, _item: &Rc<TItem>)

Source§

fn on_before_clear(&self)

Source§

fn on_before_replace(&self, _old_item: &Rc<TItem>, _new_item: &Rc<TItem>)

Source§

fn on_replace(&self, _old_item: &Rc<TItem>, _new_item: &Rc<TItem>)

Source§

fn on_clear(&self)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.