Compositor
struct · ferroui-base · v0.5.0
struct Compositor
The compositor: manages the composition objects of the UI thread and commits their changes to the server compositor in batches.
Members
MAX_GLOBAL_PLAYBACK_RATEMIN_GLOBAL_PLAYBACK_RATEcreate_animation_controllerglobal_playback_rateset_global_playback_ratecreate_cubic_bezier_easing_functioncreate_linear_easing_functioncreate_step_easing_functioncreate_step_easing_function_with_step_countcreate_scalar_key_frame_animationcreate_double_key_frame_animationcreate_boolean_key_frame_animationcreate_color_key_frame_animationcreate_vector_key_frame_animationcreate_vector2_key_frame_animationcreate_vector3_key_frame_animationcreate_vector3d_key_frame_animationcreate_vector4_key_frame_animationcreate_quaternion_key_frame_animationcreate_relative_point_key_frame_animationcreate_relative_scalar_key_frame_animationcreate_spring_scalar_animationcreate_spring_vector2_animationcreate_spring_vector3_animationcreate_effect_factorycreate_effect_factory_with_propertiescreate_backdrop_brushcreate_host_backdrop_brushcreate_scoped_batchcreate_property_setcreate_ambient_lightcreate_distant_lightcreate_point_lightcreate_spot_lightcreate_shape_visualcreate_sprite_shapecreate_sprite_shape_with_geometrycreate_container_shapecreate_rectangle_geometrycreate_rounded_rectangle_geometrycreate_ellipse_geometrycreate_line_geometrycreate_path_geometrycreate_path_geometry_with_pathcreate_view_boxcreate_geometric_clipcreate_geometric_clip_with_geometrycreate_sprite_visualcreate_color_brushcreate_color_brush_with_colorcreate_surface_brushcreate_surface_brush_with_surfacecreate_visual_surfacecreate_drop_shadowcreate_inset_clipcreate_inset_clip_with_insetscreate_rectangle_clipcreate_rectangle_clip_withcreate_rectangle_clip_with_radiicreate_layer_visualcreate_redirect_visualcreate_redirect_visual_with_source_visualcreate_nine_grid_brushcreate_mask_brushcreate_color_gradient_stopcreate_color_gradient_stop_defaultcreate_container_visualcreate_expression_animationcreate_expression_animation_withcreate_implicit_animation_collectioncreate_animation_groupcreate_solid_color_visualcreate_custom_visualcreate_drawing_surfacecreate_surface_visualcreate_solid_color_brushcreate_solid_color_brush_withcreate_linear_gradient_brushcreate_conic_gradient_brushcreate_radial_gradient_brushcreate_gradient_stop_withcreate_gradient_stopuse_ui_thread_for_synchronous_commitsrender_on_this_threadrenders_on_render_threadis_confined_to_render_threaddispatcherclock_elapsedafter_commitrequest_composition_updatetry_get_default_compositor
MAX_GLOBAL_PLAYBACK_RATE
const MAX_GLOBAL_PLAYBACK_RATE: f32
The highest global playback rate (WinUI MaxGlobalPlaybackRate).
MIN_GLOBAL_PLAYBACK_RATE
const MIN_GLOBAL_PLAYBACK_RATE: f32
The lowest global playback rate (WinUI MinGlobalPlaybackRate).
create_animation_controller
fn create_animation_controller(self: &Self) -> Rc<AnimationController>
Creates an animation controller (WinUI CreateAnimationController).
global_playback_rate
fn global_playback_rate(self: &Self) -> f32
The rate at which the time of every animation of the compositor runs
(WinUI GlobalPlaybackRate): 1 by default, 0.5 for half speed.
set_global_playback_rate
fn set_global_playback_rate(self: &Self, value: f32)
Sets the global playback rate, clamped to
MIN_GLOBAL_PLAYBACK_RATE..MAX_GLOBAL_PLAYBACK_RATE.
It applies from the next frame to running animations and to those
started later: their time from then on runs at the new rate.
create_cubic_bezier_easing_function
fn create_cubic_bezier_easing_function(self: &Self, control_point1: Vector2, control_point2: Vector2) -> Rc<CubicBezierEasingFunction>
A cubic Bezier curve with the given control points (WinUI
CreateCubicBezierEasingFunction).
create_linear_easing_function
fn create_linear_easing_function(self: &Self) -> Rc<LinearEasingFunction>
The linear curve (WinUI CreateLinearEasingFunction).
create_step_easing_function
fn create_step_easing_function(self: &Self) -> Rc<StepEasingFunction>
A step function with one step (WinUI CreateStepEasingFunction()).
create_step_easing_function_with_step_count
fn create_step_easing_function_with_step_count(self: &Self, step_count: i32) -> Rc<StepEasingFunction>
A step function with step_count steps (WinUI
CreateStepEasingFunction(stepCount)).
create_scalar_key_frame_animation
fn create_scalar_key_frame_animation(self: &Self) -> Rc<ScalarKeyFrameAnimation>
create_double_key_frame_animation
fn create_double_key_frame_animation(self: &Self) -> Rc<DoubleKeyFrameAnimation>
create_boolean_key_frame_animation
fn create_boolean_key_frame_animation(self: &Self) -> Rc<BooleanKeyFrameAnimation>
create_color_key_frame_animation
fn create_color_key_frame_animation(self: &Self) -> Rc<ColorKeyFrameAnimation>
create_vector_key_frame_animation
fn create_vector_key_frame_animation(self: &Self) -> Rc<VectorKeyFrameAnimation>
create_vector2_key_frame_animation
fn create_vector2_key_frame_animation(self: &Self) -> Rc<Vector2KeyFrameAnimation>
create_vector3_key_frame_animation
fn create_vector3_key_frame_animation(self: &Self) -> Rc<Vector3KeyFrameAnimation>
create_vector3d_key_frame_animation
fn create_vector3d_key_frame_animation(self: &Self) -> Rc<Vector3DKeyFrameAnimation>
create_vector4_key_frame_animation
fn create_vector4_key_frame_animation(self: &Self) -> Rc<Vector4KeyFrameAnimation>
create_quaternion_key_frame_animation
fn create_quaternion_key_frame_animation(self: &Self) -> Rc<QuaternionKeyFrameAnimation>
create_relative_point_key_frame_animation
fn create_relative_point_key_frame_animation(self: &Self) -> Rc<RelativePointKeyFrameAnimation>
create_relative_scalar_key_frame_animation
fn create_relative_scalar_key_frame_animation(self: &Self) -> Rc<RelativeScalarKeyFrameAnimation>
create_spring_scalar_animation
fn create_spring_scalar_animation(self: &Self) -> Rc<SpringScalarNaturalMotionAnimation>
Creates a SpringScalarNaturalMotionAnimation.
create_spring_vector2_animation
fn create_spring_vector2_animation(self: &Self) -> Rc<SpringVector2NaturalMotionAnimation>
Creates a SpringVector2NaturalMotionAnimation.
create_spring_vector3_animation
fn create_spring_vector3_animation(self: &Self) -> Rc<SpringVector3NaturalMotionAnimation>
Creates a SpringVector3NaturalMotionAnimation.
create_effect_factory
fn create_effect_factory(self: &Self, effect: impl Into<GraphicsEffect>) -> Rc<CompositionEffectFactory>
CreateEffectFactory(graphicsEffect): a factory of brushes that draw
effect, without animatable properties.
create_effect_factory_with_properties
fn create_effect_factory_with_properties(self: &Self, effect: impl Into<GraphicsEffect>, animatable_properties: &[&str]) -> Rc<CompositionEffectFactory>
CreateEffectFactory(graphicsEffect, animatableProperties): a factory
of brushes that draw effect, whose properties named in
animatable_properties (EffectName.PropertyName, as
Blur.BlurAmount) can be changed and animated on the brushes.
create_backdrop_brush
fn create_backdrop_brush(self: &Self) -> CompositionBackdropBrush
CreateBackdropBrush: a brush that shows what is behind the visual
that paints it: the compositor draws again what was drawn under the
visual (winui-materials.md, the backdrop).
create_host_backdrop_brush
fn create_host_backdrop_brush(self: &Self) -> CompositionHostBackdropBrush
CreateHostBackdropBrush: a brush that shows what is behind the
window (see CompositionHostBackdropBrush).
create_scoped_batch
fn create_scoped_batch(self: &Self, batch_type: CompositionBatchTypes) -> Rc<CompositionScopedBatch>
Creates a scoped batch that aggregates the animations of the given
types started from now on (WinUI CreateScopedBatch).
create_property_set
fn create_property_set(self: &Self) -> Rc<CompositionPropertySet>
Creates a property set (WinUI CreatePropertySet).
create_ambient_light
fn create_ambient_light(self: &Self) -> AmbientLight
CreateAmbientLight.
create_distant_light
fn create_distant_light(self: &Self) -> DistantLight
CreateDistantLight.
create_point_light
fn create_point_light(self: &Self) -> PointLight
CreatePointLight.
create_spot_light
fn create_spot_light(self: &Self) -> SpotLight
CreateSpotLight.
create_shape_visual
fn create_shape_visual(self: &Self) -> ShapeVisual
CreateShapeVisual: a visual that draws shapes.
create_sprite_shape
fn create_sprite_shape(self: &Self) -> CompositionSpriteShape
CreateSpriteShape: a shape without a geometry.
create_sprite_shape_with_geometry
fn create_sprite_shape_with_geometry(self: &Self, geometry: Option<Rc<CompositionGeometry>>) -> CompositionSpriteShape
CreateSpriteShape(geometry): a shape that draws geometry.
create_container_shape
fn create_container_shape(self: &Self) -> CompositionContainerShape
CreateContainerShape: a shape that groups shapes.
create_rectangle_geometry
fn create_rectangle_geometry(self: &Self) -> CompositionRectangleGeometry
CreateRectangleGeometry: an empty rectangle at the origin.
create_rounded_rectangle_geometry
fn create_rounded_rectangle_geometry(self: &Self) -> CompositionRoundedRectangleGeometry
CreateRoundedRectangleGeometry: an empty rounded rectangle at the
origin.
create_ellipse_geometry
fn create_ellipse_geometry(self: &Self) -> CompositionEllipseGeometry
CreateEllipseGeometry: an ellipse with zero radii at the origin.
create_line_geometry
fn create_line_geometry(self: &Self) -> CompositionLineGeometry
CreateLineGeometry: a line from the origin to the origin.
create_path_geometry
fn create_path_geometry(self: &Self) -> CompositionPathGeometry
CreatePathGeometry: a geometry without a path.
create_path_geometry_with_path
fn create_path_geometry_with_path(self: &Self, path: Option<CompositionPath>) -> CompositionPathGeometry
CreatePathGeometry(path): a geometry that shows path.
create_view_box
fn create_view_box(self: &Self) -> Rc<CompositionViewBox>
CreateViewBox: a view box with a zero size.
create_geometric_clip
fn create_geometric_clip(self: &Self) -> GeometricClip
CreateGeometricClip: a clip without a geometry.
create_geometric_clip_with_geometry
fn create_geometric_clip_with_geometry(self: &Self, geometry: Option<Rc<CompositionGeometry>>) -> GeometricClip
CreateGeometricClip(geometry): a clip to the inside of geometry.
create_sprite_visual
fn create_sprite_visual(self: &Self) -> SpriteVisual
CreateSpriteVisual: a visual that paints its size with a brush.
create_color_brush
fn create_color_brush(self: &Self) -> CompositionSolidColorBrush
CreateColorBrush: the WinUI name of
create_solid_color_brush.
create_color_brush_with_color
fn create_color_brush_with_color(self: &Self, color: Color) -> CompositionSolidColorBrush
CreateColorBrush(color): the WinUI name of
create_solid_color_brush_with.
create_surface_brush
fn create_surface_brush(self: &Self) -> CompositionSurfaceBrush
CreateSurfaceBrush: a brush that paints a surface, without a
surface.
create_surface_brush_with_surface
fn create_surface_brush_with_surface(self: &Self, surface: Rc<dyn ICompositionSurface>) -> CompositionSurfaceBrush
CreateSurfaceBrush(surface): a brush that paints surface.
create_visual_surface
fn create_visual_surface(self: &Self) -> Rc<CompositionVisualSurface>
CreateVisualSurface: a live image of the subtree of a visual.
create_drop_shadow
fn create_drop_shadow(self: &Self) -> Rc<DropShadow>
CreateDropShadow: a shadow for a sprite visual.
create_inset_clip
fn create_inset_clip(self: &Self) -> InsetClip
CreateInsetClip: a clip with zero insets.
create_inset_clip_with_insets
fn create_inset_clip_with_insets(self: &Self, left: f32, top: f32, right: f32, bottom: f32) -> InsetClip
CreateInsetClip(leftInset, topInset, rightInset, bottomInset).
create_rectangle_clip
fn create_rectangle_clip(self: &Self) -> RectangleClip
CreateRectangleClip: a clip whose edges are all zero (it leaves
nothing visible until its edges are set).
create_rectangle_clip_with
fn create_rectangle_clip_with(self: &Self, left: f32, top: f32, right: f32, bottom: f32) -> RectangleClip
CreateRectangleClip(left, top, right, bottom).
create_rectangle_clip_with_radii
fn create_rectangle_clip_with_radii(self: &Self, left: f32, top: f32, right: f32, bottom: f32, top_left_radius: Vector, top_right_radius: Vector, bottom_right_radius: Vector, bottom_left_radius: Vector) -> RectangleClip
CreateRectangleClip(left, top, right, bottom, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius).
create_layer_visual
fn create_layer_visual(self: &Self) -> LayerVisual
CreateLayerVisual: a container visual whose children are composed
into one layer.
create_redirect_visual
fn create_redirect_visual(self: &Self) -> RedirectVisual
CreateRedirectVisual: a visual that shows the subtree of another
visual, without a source.
create_redirect_visual_with_source_visual
fn create_redirect_visual_with_source_visual(self: &Self, source: Option<Rc<CompositionVisual>>) -> RedirectVisual
CreateRedirectVisual(source): a visual that shows the subtree of
source.
create_nine_grid_brush
fn create_nine_grid_brush(self: &Self) -> CompositionNineGridBrush
CreateNineGridBrush: a brush that paints another brush as a
nine-grid.
create_mask_brush
fn create_mask_brush(self: &Self) -> CompositionMaskBrush
CreateMaskBrush: a brush that paints a brush through the alpha of
another.
create_color_gradient_stop
fn create_color_gradient_stop(self: &Self, offset: f32, color: Color) -> Rc<CompositionGradientStop>
CreateColorGradientStop(offset, color): the WinUI name of
create_gradient_stop_with.
create_color_gradient_stop_default
fn create_color_gradient_stop_default(self: &Self) -> Rc<CompositionGradientStop>
CreateColorGradientStop(): the WinUI name of
create_gradient_stop.
create_container_visual
fn create_container_visual(self: &Self) -> Rc<CompositionContainerVisual>
create_expression_animation
fn create_expression_animation(self: &Self) -> Rc<ExpressionAnimation>
create_expression_animation_with
fn create_expression_animation_with(self: &Self, expression: &str) -> Rc<ExpressionAnimation>
create_implicit_animation_collection
fn create_implicit_animation_collection(self: &Self) -> Rc<ImplicitAnimationCollection>
create_animation_group
fn create_animation_group(self: &Self) -> Rc<CompositionAnimationGroup>
create_solid_color_visual
fn create_solid_color_visual(self: &Self) -> CompositionSolidColorVisual
create_custom_visual
fn create_custom_visual(self: &Self, handler: impl FnOnce() -> Rc<dyn ICompositionCustomVisualHandler> + Send + 'static) -> CompositionCustomVisual
The handler belongs to the render thread: handler creates it there.
create_drawing_surface
fn create_drawing_surface(self: &Self) -> CompositionDrawingSurface
create_surface_visual
fn create_surface_visual(self: &Self) -> CompositionSurfaceVisual
create_solid_color_brush
fn create_solid_color_brush(self: &Self) -> CompositionSolidColorBrush
create_solid_color_brush_with
fn create_solid_color_brush_with(self: &Self, color: Color) -> CompositionSolidColorBrush
create_linear_gradient_brush
fn create_linear_gradient_brush(self: &Self) -> CompositionLinearGradientBrush
create_conic_gradient_brush
fn create_conic_gradient_brush(self: &Self) -> CompositionConicGradientBrush
create_radial_gradient_brush
fn create_radial_gradient_brush(self: &Self) -> CompositionRadialGradientBrush
create_gradient_stop_with
fn create_gradient_stop_with(self: &Self, offset: f64, color: Color) -> Rc<CompositionGradientStop>
create_gradient_stop
fn create_gradient_stop(self: &Self) -> Rc<CompositionGradientStop>
use_ui_thread_for_synchronous_commits
fn use_ui_thread_for_synchronous_commits(self: &Self) -> bool
render_on_this_thread
fn render_on_this_thread(self: &Self) -> bool
Renders a frame on this thread, under the compositor lock: what the
synchronous points do (Server.Render upstream).
Panics
When the compositor is confined to its render thread: this thread waits for a frame there, it never renders one.
renders_on_render_thread
fn renders_on_render_thread(self: &Self) -> bool
Whether the thread that ticks the render loop renders the frames, not the thread of this compositor.
is_confined_to_render_thread
fn is_confined_to_render_thread(self: &Self) -> bool
Whether the thread that ticks the render loop is the only one that
renders: the render-thread mode without
use_ui_thread_for_synchronous_commits, on a loop that runs in the
background (the condition under which the reference waits for the
render thread at the synchronous points).
The render targets, the graphics context and everything else that
belongs to the thread that draws are then created, used and dropped
by the render thread alone. This thread still enters the compositor
lock (with_server), for what does not render:
it commits batches, posts jobs and waits for them.
dispatcher
fn dispatcher(self: &Self) -> &Arc<Dispatcher>
The dispatcher of the thread the compositor belongs to.
clock_elapsed
fn clock_elapsed(self: &Self) -> Duration
The time elapsed on the compositor clock.
after_commit
fn after_commit(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Subscribes to the notification raised after each commit. Dropping the
returned guard removes the handler; Subscription::detach keeps it
for the life of the compositor.
request_composition_update
fn request_composition_update(self: &Self, action: impl FnOnce() -> () + 'static)
Enqueues a callback to be run before the next commit.
try_get_default_compositor
fn try_get_default_compositor() -> Option<Rc<Compositor>>
The compositor registered in the service locator, if any.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherDrop
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.