Skip to main content

Crate windows_composition

Crate windows_composition 

Source
Expand description

§windows-composition

Windows Composition wraps the retained-mode Windows composition engine for standalone windows and WinUI 3 applications.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-composition]
version = "0.100"
use windows_composition::*;

fn build(compositor: &Compositor) -> SpriteVisual {
    let visual = compositor.create_sprite_visual();
    visual.set_size(200.0, 120.0);

    let brush = compositor.create_color_brush(Color::rgb(0, 120, 215));
    visual.set_brush(&brush);
    visual
}

Structs§

Color
A 32-bit sRGB color with premultiplied alpha semantics, matching the composition Color ABI (Windows.UI.Color).
CompositionAnimation
The base type shared by every composition animation. An Animation can be turned into one via Animation::as_animation to start it on a visual with Visual::start_animation.
CompositionAnimationGroup
A set of animations that start together.
CompositionBrush
The base type shared by every composition brush. A Brush can be turned into one via Brush::as_brush to paint a visual or fill a shape.
CompositionColorBrush
A brush that paints with a single solid color.
CompositionContainerShape
A shape that groups a child shapes collection.
CompositionDrawingSurface
Composition surface that Direct2D content is drawn into.
CompositionEasingFunction
An easing function that shapes a key frame’s interpolation curve.
CompositionEllipseGeometry
An ellipse (or circle) geometry, defined by its radii.
CompositionGeometry
The base type shared by every composition geometry.
CompositionGraphicsDevice
Direct2D-backed composition device that allocates drawing surfaces.
CompositionNineGridBrush
A brush that stretches its source as a nine-grid: the four corners keep their size, the edges stretch along one axis, and the center stretches (or is left hollow) to fill the remaining space.
CompositionScopedBatch
Groups the animations started while it is open so they can be sealed together with end.
CompositionShape
The base type shared by every composition shape. A Shape can be turned into one via Shape::as_shape to append it to a CompositionShapeCollection.
CompositionShapeCollection
An ordered collection of shapes owned by a ShapeVisual or a CompositionContainerShape.
CompositionSpriteShape
A shape that fills a geometry with a Brush.
CompositionSurfaceBrush
Brush that paints a visual with a CompositionDrawingSurface.
Compositor
Factory for visuals, brushes, and window targets.
ContainerVisual
A visual that hosts a child visual tree via its children.
DesktopWindowTarget
A composition target that hosts a visual tree inside a window.
DispatcherQueueController
Owns a dispatcher queue on the current thread.
ImplicitAnimationCollection
A map of property-name -> animation applied to a visual so that changes to those properties animate automatically.
ScalarKeyFrameAnimation
A key-frame animation that interpolates a scalar (f32) property (such as a visual’s Opacity) through a series of key frames.
ShapeVisual
A visual that renders a collection of composition shapes. Derefs to Visual, so a shape visual can be positioned and sized directly.
SpriteVisual
Visual that paints its bounds with a Brush and can host child visuals.
Vector2
Vector3
Vector3KeyFrameAnimation
A key-frame animation that interpolates a Vector3 property (such as a visual’s Scale) through a series of key frames.
Visual
Base type for every composition visual.
VisualCollection
An ordered collection of child visuals under a ContainerVisual.

Enums§

BatchKind
The kinds of work a CompositionScopedBatch can track for completion.
BorderMode
How a visual’s edges are rendered relative to its clip.

Traits§

Animation
An animation that can be started on a visual property.
Brush
A brush that can paint a SpriteVisual, fill a CompositionSpriteShape, or serve as the source of a CompositionNineGridBrush.
Shape
A shape that can be appended to a CompositionShapeCollection.

Type Aliases§

Result
A specialized Result type that provides Windows error information.