pub struct Compositor(/* private fields */);Expand description
Factory for visuals, brushes, and window targets.
Implementations§
Source§impl Compositor
impl Compositor
Sourcepub fn new() -> Result<Self>
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()?;Sourcepub fn create_desktop_window_target(
&self,
window: &Window,
is_topmost: bool,
) -> Result<DesktopWindowTarget>
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)?;Sourcepub unsafe fn create_desktop_window_target_for_hwnd(
&self,
hwnd: *mut c_void,
is_topmost: bool,
) -> Result<DesktopWindowTarget>
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.
Sourcepub fn create_container_visual(&self) -> ContainerVisual
pub fn create_container_visual(&self) -> ContainerVisual
Creates an empty container visual that hosts a child visual tree.
Sourcepub fn create_sprite_visual(&self) -> SpriteVisual
pub fn create_sprite_visual(&self) -> SpriteVisual
Creates a sprite visual that paints itself with a brush.
Sourcepub fn create_color_brush(&self, color: Color) -> CompositionColorBrush
pub fn create_color_brush(&self, color: Color) -> CompositionColorBrush
Creates a solid-color brush.
Sourcepub fn create_nine_grid_brush(&self) -> CompositionNineGridBrush
pub fn create_nine_grid_brush(&self) -> CompositionNineGridBrush
Creates a nine-grid brush.
Sourcepub fn create_shape_visual(&self) -> ShapeVisual
pub fn create_shape_visual(&self) -> ShapeVisual
Creates a shape visual that renders composition shapes.
Sourcepub fn create_container_shape(&self) -> CompositionContainerShape
pub fn create_container_shape(&self) -> CompositionContainerShape
Creates an empty container shape that groups child shapes.
Sourcepub fn create_ellipse_geometry(&self) -> CompositionEllipseGeometry
pub fn create_ellipse_geometry(&self) -> CompositionEllipseGeometry
Creates an ellipse geometry.
Sourcepub fn create_sprite_shape(
&self,
geometry: &CompositionEllipseGeometry,
) -> CompositionSpriteShape
pub fn create_sprite_shape( &self, geometry: &CompositionEllipseGeometry, ) -> CompositionSpriteShape
Creates a sprite shape that fills the given geometry with a brush.
Sourcepub fn create_scoped_batch(&self, kind: BatchKind) -> CompositionScopedBatch
pub fn create_scoped_batch(&self, kind: BatchKind) -> CompositionScopedBatch
Creates a scoped batch that tracks the completion of the given kind of work.
Sourcepub fn create_vector3_key_frame_animation(&self) -> Vector3KeyFrameAnimation
pub fn create_vector3_key_frame_animation(&self) -> Vector3KeyFrameAnimation
Creates a Vector3 key-frame animation.
Sourcepub fn create_animation_group(&self) -> CompositionAnimationGroup
pub fn create_animation_group(&self) -> CompositionAnimationGroup
Creates an empty group whose animations start together.
Sourcepub fn create_scalar_key_frame_animation(&self) -> ScalarKeyFrameAnimation
pub fn create_scalar_key_frame_animation(&self) -> ScalarKeyFrameAnimation
Creates a scalar (f32) key-frame animation.
Sourcepub fn create_linear_easing_function(&self) -> CompositionEasingFunction
pub fn create_linear_easing_function(&self) -> CompositionEasingFunction
Creates a linear easing function.
Sourcepub fn create_cubic_bezier_easing_function(
&self,
control1: Vector2,
control2: Vector2,
) -> CompositionEasingFunction
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.
Sourcepub fn create_implicit_animation_collection(
&self,
) -> ImplicitAnimationCollection
pub fn create_implicit_animation_collection( &self, ) -> ImplicitAnimationCollection
Creates an empty implicit-animation collection to attach to a visual
with Visual::set_implicit_animations.
Sourcepub fn create_graphics_device(
&self,
rendering_device: &impl Interface,
) -> Result<CompositionGraphicsDevice>
pub fn create_graphics_device( &self, rendering_device: &impl Interface, ) -> Result<CompositionGraphicsDevice>
Creates a composition graphics device backed by a Direct2D or DXGI device.
Sourcepub fn create_surface_brush(
&self,
surface: &CompositionDrawingSurface,
) -> CompositionSurfaceBrush
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
impl Clone for Compositor
Source§fn clone(&self) -> Compositor
fn clone(&self) -> Compositor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more