FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    MAX_GLOBAL_PLAYBACK_RATE

    const MAX_GLOBAL_PLAYBACK_RATE: f32
    

    The highest global playback rate (WinUI MaxGlobalPlaybackRate).

    Source

    MIN_GLOBAL_PLAYBACK_RATE

    const MIN_GLOBAL_PLAYBACK_RATE: f32
    

    The lowest global playback rate (WinUI MinGlobalPlaybackRate).

    Source

    create_animation_controller

    fn create_animation_controller(self: &Self) -> Rc<AnimationController>
    

    Creates an animation controller (WinUI CreateAnimationController).

    Source

    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.

    Source

    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.

    Source

    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).

    Source

    create_linear_easing_function

    fn create_linear_easing_function(self: &Self) -> Rc<LinearEasingFunction>
    

    The linear curve (WinUI CreateLinearEasingFunction).

    Source

    create_step_easing_function

    fn create_step_easing_function(self: &Self) -> Rc<StepEasingFunction>
    

    A step function with one step (WinUI CreateStepEasingFunction()).

    Source

    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)).

    Source

    create_scalar_key_frame_animation

    fn create_scalar_key_frame_animation(self: &Self) -> Rc<ScalarKeyFrameAnimation>
    

    Source

    create_double_key_frame_animation

    fn create_double_key_frame_animation(self: &Self) -> Rc<DoubleKeyFrameAnimation>
    

    Source

    create_boolean_key_frame_animation

    fn create_boolean_key_frame_animation(self: &Self) -> Rc<BooleanKeyFrameAnimation>
    

    Source

    create_color_key_frame_animation

    fn create_color_key_frame_animation(self: &Self) -> Rc<ColorKeyFrameAnimation>
    

    Source

    create_vector_key_frame_animation

    fn create_vector_key_frame_animation(self: &Self) -> Rc<VectorKeyFrameAnimation>
    

    Source

    create_vector2_key_frame_animation

    fn create_vector2_key_frame_animation(self: &Self) -> Rc<Vector2KeyFrameAnimation>
    

    Source

    create_vector3_key_frame_animation

    fn create_vector3_key_frame_animation(self: &Self) -> Rc<Vector3KeyFrameAnimation>
    

    Source

    create_vector3d_key_frame_animation

    fn create_vector3d_key_frame_animation(self: &Self) -> Rc<Vector3DKeyFrameAnimation>
    

    Source

    create_vector4_key_frame_animation

    fn create_vector4_key_frame_animation(self: &Self) -> Rc<Vector4KeyFrameAnimation>
    

    Source

    create_quaternion_key_frame_animation

    fn create_quaternion_key_frame_animation(self: &Self) -> Rc<QuaternionKeyFrameAnimation>
    

    Source

    create_relative_point_key_frame_animation

    fn create_relative_point_key_frame_animation(self: &Self) -> Rc<RelativePointKeyFrameAnimation>
    

    Source

    create_relative_scalar_key_frame_animation

    fn create_relative_scalar_key_frame_animation(self: &Self) -> Rc<RelativeScalarKeyFrameAnimation>
    

    Source

    create_spring_scalar_animation

    fn create_spring_scalar_animation(self: &Self) -> Rc<SpringScalarNaturalMotionAnimation>
    

    Creates a SpringScalarNaturalMotionAnimation.

    Source

    create_spring_vector2_animation

    fn create_spring_vector2_animation(self: &Self) -> Rc<SpringVector2NaturalMotionAnimation>
    

    Creates a SpringVector2NaturalMotionAnimation.

    Source

    create_spring_vector3_animation

    fn create_spring_vector3_animation(self: &Self) -> Rc<SpringVector3NaturalMotionAnimation>
    

    Creates a SpringVector3NaturalMotionAnimation.

    Source

    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.

    Source

    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.

    Source

    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).

    Source

    create_host_backdrop_brush

    fn create_host_backdrop_brush(self: &Self) -> CompositionHostBackdropBrush
    

    CreateHostBackdropBrush: a brush that shows what is behind the window (see CompositionHostBackdropBrush).

    Source

    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).

    Source

    create_property_set

    fn create_property_set(self: &Self) -> Rc<CompositionPropertySet>
    

    Creates a property set (WinUI CreatePropertySet).

    Source

    create_ambient_light

    fn create_ambient_light(self: &Self) -> AmbientLight
    

    CreateAmbientLight.

    Source

    create_distant_light

    fn create_distant_light(self: &Self) -> DistantLight
    

    CreateDistantLight.

    Source

    create_point_light

    fn create_point_light(self: &Self) -> PointLight
    

    CreatePointLight.

    Source

    create_spot_light

    fn create_spot_light(self: &Self) -> SpotLight
    

    CreateSpotLight.

    Source

    create_shape_visual

    fn create_shape_visual(self: &Self) -> ShapeVisual
    

    CreateShapeVisual: a visual that draws shapes.

    Source

    create_sprite_shape

    fn create_sprite_shape(self: &Self) -> CompositionSpriteShape
    

    CreateSpriteShape: a shape without a geometry.

    Source

    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.

    Source

    create_container_shape

    fn create_container_shape(self: &Self) -> CompositionContainerShape
    

    CreateContainerShape: a shape that groups shapes.

    Source

    create_rectangle_geometry

    fn create_rectangle_geometry(self: &Self) -> CompositionRectangleGeometry
    

    CreateRectangleGeometry: an empty rectangle at the origin.

    Source

    create_rounded_rectangle_geometry

    fn create_rounded_rectangle_geometry(self: &Self) -> CompositionRoundedRectangleGeometry
    

    CreateRoundedRectangleGeometry: an empty rounded rectangle at the origin.

    Source

    create_ellipse_geometry

    fn create_ellipse_geometry(self: &Self) -> CompositionEllipseGeometry
    

    CreateEllipseGeometry: an ellipse with zero radii at the origin.

    Source

    create_line_geometry

    fn create_line_geometry(self: &Self) -> CompositionLineGeometry
    

    CreateLineGeometry: a line from the origin to the origin.

    Source

    create_path_geometry

    fn create_path_geometry(self: &Self) -> CompositionPathGeometry
    

    CreatePathGeometry: a geometry without a path.

    Source

    create_path_geometry_with_path

    fn create_path_geometry_with_path(self: &Self, path: Option<CompositionPath>) -> CompositionPathGeometry
    

    CreatePathGeometry(path): a geometry that shows path.

    Source

    create_view_box

    fn create_view_box(self: &Self) -> Rc<CompositionViewBox>
    

    CreateViewBox: a view box with a zero size.

    Source

    create_geometric_clip

    fn create_geometric_clip(self: &Self) -> GeometricClip
    

    CreateGeometricClip: a clip without a geometry.

    Source

    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.

    Source

    create_sprite_visual

    fn create_sprite_visual(self: &Self) -> SpriteVisual
    

    CreateSpriteVisual: a visual that paints its size with a brush.

    Source

    create_color_brush

    fn create_color_brush(self: &Self) -> CompositionSolidColorBrush
    

    CreateColorBrush: the WinUI name of create_solid_color_brush.

    Source

    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.

    Source

    create_surface_brush

    fn create_surface_brush(self: &Self) -> CompositionSurfaceBrush
    

    CreateSurfaceBrush: a brush that paints a surface, without a surface.

    Source

    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.

    Source

    create_visual_surface

    fn create_visual_surface(self: &Self) -> Rc<CompositionVisualSurface>
    

    CreateVisualSurface: a live image of the subtree of a visual.

    Source

    create_drop_shadow

    fn create_drop_shadow(self: &Self) -> Rc<DropShadow>
    

    CreateDropShadow: a shadow for a sprite visual.

    Source

    create_inset_clip

    fn create_inset_clip(self: &Self) -> InsetClip
    

    CreateInsetClip: a clip with zero insets.

    Source

    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).

    Source

    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).

    Source

    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).

    Source

    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).

    Source

    create_layer_visual

    fn create_layer_visual(self: &Self) -> LayerVisual
    

    CreateLayerVisual: a container visual whose children are composed into one layer.

    Source

    create_redirect_visual

    fn create_redirect_visual(self: &Self) -> RedirectVisual
    

    CreateRedirectVisual: a visual that shows the subtree of another visual, without a source.

    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.

    Source

    create_nine_grid_brush

    fn create_nine_grid_brush(self: &Self) -> CompositionNineGridBrush
    

    CreateNineGridBrush: a brush that paints another brush as a nine-grid.

    Source

    create_mask_brush

    fn create_mask_brush(self: &Self) -> CompositionMaskBrush
    

    CreateMaskBrush: a brush that paints a brush through the alpha of another.

    Source

    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.

    Source

    create_color_gradient_stop_default

    fn create_color_gradient_stop_default(self: &Self) -> Rc<CompositionGradientStop>
    

    CreateColorGradientStop(): the WinUI name of create_gradient_stop.

    Source

    create_container_visual

    fn create_container_visual(self: &Self) -> Rc<CompositionContainerVisual>
    

    Source

    create_expression_animation

    fn create_expression_animation(self: &Self) -> Rc<ExpressionAnimation>
    

    Source

    create_expression_animation_with

    fn create_expression_animation_with(self: &Self, expression: &str) -> Rc<ExpressionAnimation>
    

    Source

    create_implicit_animation_collection

    fn create_implicit_animation_collection(self: &Self) -> Rc<ImplicitAnimationCollection>
    

    Source

    create_animation_group

    fn create_animation_group(self: &Self) -> Rc<CompositionAnimationGroup>
    

    Source

    create_solid_color_visual

    fn create_solid_color_visual(self: &Self) -> CompositionSolidColorVisual
    

    Source

    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.

    Source

    create_drawing_surface

    fn create_drawing_surface(self: &Self) -> CompositionDrawingSurface
    

    Source

    create_surface_visual

    fn create_surface_visual(self: &Self) -> CompositionSurfaceVisual
    

    Source

    create_solid_color_brush

    fn create_solid_color_brush(self: &Self) -> CompositionSolidColorBrush
    

    Source

    create_solid_color_brush_with

    fn create_solid_color_brush_with(self: &Self, color: Color) -> CompositionSolidColorBrush
    

    Source

    create_linear_gradient_brush

    fn create_linear_gradient_brush(self: &Self) -> CompositionLinearGradientBrush
    

    Source

    create_conic_gradient_brush

    fn create_conic_gradient_brush(self: &Self) -> CompositionConicGradientBrush
    

    Source

    create_radial_gradient_brush

    fn create_radial_gradient_brush(self: &Self) -> CompositionRadialGradientBrush
    

    Source

    create_gradient_stop_with

    fn create_gradient_stop_with(self: &Self, offset: f64, color: Color) -> Rc<CompositionGradientStop>
    

    Source

    create_gradient_stop

    fn create_gradient_stop(self: &Self) -> Rc<CompositionGradientStop>
    

    Source

    use_ui_thread_for_synchronous_commits

    fn use_ui_thread_for_synchronous_commits(self: &Self) -> bool
    

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    dispatcher

    fn dispatcher(self: &Self) -> &Arc<Dispatcher>
    

    The dispatcher of the thread the compositor belongs to.

    Source

    clock_elapsed

    fn clock_elapsed(self: &Self) -> Duration
    

    The time elapsed on the compositor clock.

    Source

    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.

    Source

    request_composition_update

    fn request_composition_update(self: &Self, action: impl FnOnce() -> () + 'static)
    

    Enqueues a callback to be run before the next commit.

    Source

    try_get_default_compositor

    fn try_get_default_compositor() -> Option<Rc<Compositor>>
    

    The compositor registered in the service locator, if any.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither
    • Drop

    Availability

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