Skip to main content

Compositor

Struct Compositor 

Source
pub struct Compositor(/* private fields */);
Expand description

Factory for visuals, brushes, and window targets.

Implementations§

Source§

impl Compositor

Source

pub fn new() -> Result<Self>

Creates a compositor. A dispatcher queue must exist on the current thread.

use windows_composition::{Compositor, DispatcherQueueController};

let _queue = DispatcherQueueController::create_on_current_thread()?;
let compositor = Compositor::new()?;
Source

pub fn create_desktop_window_target( &self, window: &Window, is_topmost: bool, ) -> Result<DesktopWindowTarget>

Creates a window target. Keep it alive while the visual tree is shown.

use windows_composition::{Compositor, DispatcherQueueController};
use windows_window::Window;

let window = Window::new("Composition").create()?;
let _queue = DispatcherQueueController::create_on_current_thread()?;
let compositor = Compositor::new()?;
let target = compositor.create_desktop_window_target(&window, false)?;
Source

pub unsafe fn create_desktop_window_target_for_hwnd( &self, hwnd: *mut c_void, is_topmost: bool, ) -> Result<DesktopWindowTarget>

Creates a composition target for a raw window handle.

§Safety

hwnd must be a valid, live window handle owned by the calling thread.

Source

pub fn create_container_visual(&self) -> ContainerVisual

Creates an empty container visual that hosts a child visual tree.

Source

pub fn create_sprite_visual(&self) -> SpriteVisual

Creates a sprite visual that paints itself with a brush.

Source

pub fn create_color_brush(&self, color: Color) -> CompositionColorBrush

Creates a solid-color brush.

Source

pub fn create_nine_grid_brush(&self) -> CompositionNineGridBrush

Creates a nine-grid brush.

Source

pub fn create_shape_visual(&self) -> ShapeVisual

Creates a shape visual that renders composition shapes.

Source

pub fn create_container_shape(&self) -> CompositionContainerShape

Creates an empty container shape that groups child shapes.

Source

pub fn create_ellipse_geometry(&self) -> CompositionEllipseGeometry

Creates an ellipse geometry.

Source

pub fn create_sprite_shape( &self, geometry: &CompositionEllipseGeometry, ) -> CompositionSpriteShape

Creates a sprite shape that fills the given geometry with a brush.

Source

pub fn create_scoped_batch(&self, kind: BatchKind) -> CompositionScopedBatch

Creates a scoped batch that tracks the completion of the given kind of work.

Source

pub fn create_vector3_key_frame_animation(&self) -> Vector3KeyFrameAnimation

Creates a Vector3 key-frame animation.

Source

pub fn create_animation_group(&self) -> CompositionAnimationGroup

Creates an empty group whose animations start together.

Source

pub fn create_scalar_key_frame_animation(&self) -> ScalarKeyFrameAnimation

Creates a scalar (f32) key-frame animation.

Source

pub fn create_linear_easing_function(&self) -> CompositionEasingFunction

Creates a linear easing function.

Source

pub fn create_cubic_bezier_easing_function( &self, control1: Vector2, control2: Vector2, ) -> CompositionEasingFunction

Creates a cubic-bezier easing function through the two control points (each in 0.0..=1.0), matching the CSS cubic-bezier() convention.

Source

pub fn create_implicit_animation_collection( &self, ) -> ImplicitAnimationCollection

Creates an empty implicit-animation collection to attach to a visual with Visual::set_implicit_animations.

Source

pub fn create_graphics_device( &self, rendering_device: &impl Interface, ) -> Result<CompositionGraphicsDevice>

Creates a composition graphics device backed by a Direct2D or DXGI device.

Source

pub fn create_surface_brush( &self, surface: &CompositionDrawingSurface, ) -> CompositionSurfaceBrush

Creates a brush that paints a visual with a composition drawing surface.

Trait Implementations§

Source§

impl Clone for Compositor

Source§

fn clone(&self) -> Compositor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.