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
ColorABI (Windows.UI.Color). - Composition
Animation - The base type shared by every composition animation. An
Animationcan be turned into one viaAnimation::as_animationto start it on a visual withVisual::start_animation. - Composition
Animation Group - A set of animations that start together.
- Composition
Brush - The base type shared by every composition brush. A
Brushcan be turned into one viaBrush::as_brushto paint a visual or fill a shape. - Composition
Color Brush - A brush that paints with a single solid color.
- Composition
Container Shape - A shape that groups a child
shapescollection. - Composition
Drawing Surface - Composition surface that Direct2D content is drawn into.
- Composition
Easing Function - An easing function that shapes a key frame’s interpolation curve.
- Composition
Ellipse Geometry - An ellipse (or circle) geometry, defined by its radii.
- Composition
Geometry - The base type shared by every composition geometry.
- Composition
Graphics Device - Direct2D-backed composition device that allocates drawing surfaces.
- Composition
Nine Grid Brush - 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.
- Composition
Scoped Batch - Groups the animations started while it is open so they can be sealed
together with
end. - Composition
Shape - The base type shared by every composition shape. A
Shapecan be turned into one viaShape::as_shapeto append it to aCompositionShapeCollection. - Composition
Shape Collection - An ordered collection of shapes owned by a
ShapeVisualor aCompositionContainerShape. - Composition
Sprite Shape - A shape that fills a geometry with a
Brush. - Composition
Surface Brush - Brush that paints a visual with a
CompositionDrawingSurface. - Compositor
- Factory for visuals, brushes, and window targets.
- Container
Visual - A visual that hosts a child visual tree via its
children. - Desktop
Window Target - A composition target that hosts a visual tree inside a window.
- Dispatcher
Queue Controller - Owns a dispatcher queue on the current thread.
- Implicit
Animation Collection - A map of property-name -> animation applied to a visual so that changes to those properties animate automatically.
- Scalar
KeyFrame Animation - A key-frame animation that interpolates a scalar (
f32) property (such as a visual’sOpacity) through a series of key frames. - Shape
Visual - A visual that renders a collection of composition
shapes. Derefs toVisual, so a shape visual can be positioned and sized directly. - Sprite
Visual - Visual that paints its bounds with a
Brushand can host child visuals. - Vector2
- Vector3
- Vector3
KeyFrame Animation - A key-frame animation that interpolates a
Vector3property (such as a visual’sScale) through a series of key frames. - Visual
- Base type for every composition visual.
- Visual
Collection - An ordered collection of child visuals under a
ContainerVisual.
Enums§
- Batch
Kind - The kinds of work a
CompositionScopedBatchcan track for completion. - Border
Mode - 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 aCompositionSpriteShape, or serve as the source of aCompositionNineGridBrush. - Shape
- A shape that can be appended to a
CompositionShapeCollection.