pub struct ServerCompositionVisualSurface { /* private fields */ }Expand description
The server-side counterpart of a
CompositionVisualSurface:
a live image of the subtree of a visual.
The subtree is rendered where the surface is drawn, as the bitmap cache renders it: the visibility, opacity, transform and clip of the source visual itself are ignored, so a hidden source still shows. A surface that shows an ancestor of the visual that draws it would draw itself again inside that drawing; the second drawing is skipped.
The compositor keeps a list of the visual surfaces and, once per frame
before the targets are updated, invalidates the surfaces whose source
subtree changed (update_live_surfaces),
which redraws the visuals that show them.
A frozen surface shows the image of the source taken when it was frozen:
the UI-thread surface asks for the freeze with its next batch, and the
compositor renders the image in the same pass (freeze).
Implementations§
Source§impl ServerCompositionVisualSurface
impl ServerCompositionVisualSurface
Sourcepub fn new(
compositor: &Rc<ServerCompositor>,
) -> Rc<ServerCompositionVisualSurface>
pub fn new( compositor: &Rc<ServerCompositor>, ) -> Rc<ServerCompositionVisualSurface>
Creates the surface, active, and registers it with the compositor for the live updates.
Sourcepub fn props(&self) -> &ServerCompositionVisualSurfaceProps
pub fn props(&self) -> &ServerCompositionVisualSurfaceProps
The properties of the surface.
pub fn is_disposed(&self) -> bool
Sourcepub fn source_visual(&self) -> Option<Rc<ServerCompositionVisual>>
pub fn source_visual(&self) -> Option<Rc<ServerCompositionVisual>>
The visual whose subtree the surface shows.
Sourcepub fn source_rect(&self) -> Option<Rect>
pub fn source_rect(&self) -> Option<Rect>
The area of the source visual the surface shows, in the coordinates
of the source: SourceOffset and SourceSize, where a zero
SourceSize is the size of the source visual. None when the area
is empty or there is no source.
Sourcepub fn request_freeze(&self)
pub fn request_freeze(&self)
Asks for the surface to be frozen by the next pass of the compositor
(what the batch of a UI-thread freeze
carries).
Sourcepub fn update_live_surfaces(
compositor: &ServerCompositor,
surfaces: &RefCell<Vec<Weak<ServerCompositionVisualSurface>>>,
) -> bool
pub fn update_live_surfaces( compositor: &ServerCompositor, surfaces: &RefCell<Vec<Weak<ServerCompositionVisualSurface>>>, ) -> bool
The surfaces that were asked to freeze are frozen, and the live
surfaces whose source changed since the last update of its target are
invalidated, which redraws the visuals that show them. Run once per
frame by the compositor, after the own properties of the visuals were
recomputed and before the targets are updated. Returns whether a
surface changed. Dropped surfaces are removed from surfaces.
Sourcepub fn set_follows_source_bounds(&self, value: bool)
pub fn set_follows_source_bounds(&self, value: bool)
Makes a change of the extent of the source subtree a change of the surface (what a redirect visual, whose bounds cover its source, needs; not from upstream).
Sourcepub fn render_source_subtree(
&self,
canvas: &mut dyn IDrawingContextImpl,
clip: LtrbRect,
)
pub fn render_source_subtree( &self, canvas: &mut dyn IDrawingContextImpl, clip: LtrbRect, )
Renders the whole subtree of the source onto canvas, whose transform
maps the coordinates of the source, as the bitmap cache renders it
(the visibility, opacity, transform and clip of the source itself are
ignored), unless the surface is rendering its source already: what a
redirect visual draws (not from upstream). clip is in the
coordinates of the device.
Sourcepub fn freeze(&self, compositor: &ServerCompositor)
pub fn freeze(&self, compositor: &ServerCompositor)
Renders the source into an offscreen layer once, and shows that layer from now on (not a public member in WinUI; the connected animation freezes the image of its source). Runs on the render thread, with the bounds of the source subtree as of the last frame: best effort, a source that was never rendered in a target has no bounds for its children yet.
Sourcepub fn is_rendering(&self) -> bool
pub fn is_rendering(&self) -> bool
Whether the source is being rendered by this surface: the drawing of the surface inside it is skipped.
Trait Implementations§
Source§impl IAnimatedServerObject for ServerCompositionVisualSurface
impl IAnimatedServerObject for ServerCompositionVisualSurface
Source§fn server_object(&self) -> &ServerObject
fn server_object(&self) -> &ServerObject
ServerObject part.Source§fn get_composition_property(
&self,
field_name: &str,
) -> Option<&'static CompositionProperty>
fn get_composition_property( &self, field_name: &str, ) -> Option<&'static CompositionProperty>
Source§fn as_server_object_dyn(&self) -> &dyn IServerObject
fn as_server_object_dyn(&self) -> &dyn IServerObject
Source§fn read_property_variant(
&self,
property: &'static CompositionProperty,
) -> ExpressionVariant
fn read_property_variant( &self, property: &'static CompositionProperty, ) -> ExpressionVariant
CompositionProperty::get_variant; an object with dynamic properties (a property set)
reads its own storage.Source§fn write_property_variant(
&self,
property: &'static CompositionProperty,
value: ExpressionVariant,
)
fn write_property_variant( &self, property: &'static CompositionProperty, value: ExpressionVariant, )
CompositionProperty::set_variant; an object with dynamic properties writes its own
storage.Source§impl IServerAnimatedPropertyHost for ServerCompositionVisualSurface
impl IServerAnimatedPropertyHost for ServerCompositionVisualSurface
Source§fn set_animated_value(
&self,
property: &'static CompositionProperty,
current_value: ExpressionVariant,
committed_at: Duration,
animation: Rc<dyn IAnimationInstance>,
)
fn set_animated_value( &self, property: &'static CompositionProperty, current_value: ExpressionVariant, committed_at: Duration, animation: Rc<dyn IAnimationInstance>, )
SetAnimatedValue(prop, ref field, committedAt, animation): starts
animation on the property. current_value is the value of the
field as a variant; the animation writes the field through
CompositionProperty::set_variant.Source§fn remove_animation_for_property(&self, property: &'static CompositionProperty)
fn remove_animation_for_property(&self, property: &'static CompositionProperty)
SetAnimatedValue(prop, out field, value): the field
has been assigned directly, so the animation of the property, if
any, is removed.Source§fn notify_animated_value_changed(&self, _property: &'static CompositionProperty)
fn notify_animated_value_changed(&self, _property: &'static CompositionProperty)
property.Source§impl IServerCompositionSurface for ServerCompositionVisualSurface
impl IServerCompositionSurface for ServerCompositionVisualSurface
Source§fn bitmap(&self) -> Option<Arc<SharedBitmapImpl>>
fn bitmap(&self) -> Option<Arc<SharedBitmapImpl>>
A visual surface has no bitmap: its content is drawn by
draw.
Source§fn draw(&self, canvas: &mut dyn IDrawingContextImpl, dest: Rect, opacity: f64)
fn draw(&self, canvas: &mut dyn IDrawingContextImpl, dest: Rect, opacity: f64)
Draws the source area of the source visual into dest: the frozen
image, or the subtree rendered with the transform that maps the
source area onto dest, clipped to dest.
Source§fn changed(&self) -> &ServerCompositionSurfaceChanged
fn changed(&self) -> &ServerCompositionSurfaceChanged
Source§fn natural_size(&self) -> Option<Size>
fn natural_size(&self) -> Option<Size>
None
while the surface has no content. The default is the size of the
bitmap at its DPI.Source§impl IServerObject for ServerCompositionVisualSurface
impl IServerObject for ServerCompositionVisualSurface
Source§fn deserialize_changes_core(
&self,
reader: &mut BatchStreamReader<'_>,
committed_at: Duration,
)
fn deserialize_changes_core( &self, reader: &mut BatchStreamReader<'_>, committed_at: Duration, )
Source§fn values_invalidated(&self)
fn values_invalidated(&self)
Source§fn as_render_resource(self: Rc<Self>) -> Option<Rc<dyn IServerRenderResource>>
fn as_render_resource(self: Rc<Self>) -> Option<Rc<dyn IServerRenderResource>>
Source§fn as_surface(self: Rc<Self>) -> Option<Rc<dyn IServerCompositionSurface>>
fn as_surface(self: Rc<Self>) -> Option<Rc<dyn IServerCompositionSurface>>
Source§fn as_animated(self: Rc<Self>) -> Option<Rc<dyn IAnimatedServerObject>>
fn as_animated(self: Rc<Self>) -> Option<Rc<dyn IAnimatedServerObject>>
Source§fn get_props(&self, type_id: TypeId) -> Option<&dyn Any>
fn get_props(&self, type_id: TypeId) -> Option<&dyn Any>
find_props; composition properties locate their
fields through it.fn as_any(&self) -> &dyn Any
fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>
Source§fn deserialize_changes(
&self,
reader: &mut BatchStreamReader<'_>,
committed_at: Duration,
)
fn deserialize_changes( &self, reader: &mut BatchStreamReader<'_>, committed_at: Duration, )
Source§fn as_brush(self: Rc<Self>) -> Option<Rc<dyn IBrush>>
fn as_brush(self: Rc<Self>) -> Option<Rc<dyn IBrush>>
Source§fn as_pen(self: Rc<Self>) -> Option<Rc<dyn IPen>>
fn as_pen(self: Rc<Self>) -> Option<Rc<dyn IPen>>
Source§fn as_render_data_geometry(
self: Rc<Self>,
) -> Option<Rc<dyn IRenderDataGeometry>>
fn as_render_data_geometry( self: Rc<Self>, ) -> Option<Rc<dyn IRenderDataGeometry>>
Source§fn as_transform(self: Rc<Self>) -> Option<Rc<dyn ITransform>>
fn as_transform(self: Rc<Self>) -> Option<Rc<dyn ITransform>>
Source§fn as_gradient_stop(self: Rc<Self>) -> Option<Rc<dyn IGradientStop>>
fn as_gradient_stop(self: Rc<Self>) -> Option<Rc<dyn IGradientStop>>
Source§impl IServerPropertyHost for ServerCompositionVisualSurface
impl IServerPropertyHost for ServerCompositionVisualSurface
Source§fn server_compositor(&self) -> Option<Rc<ServerCompositor>>
fn server_compositor(&self) -> Option<Rc<ServerCompositor>>
Source§fn set_value(
&self,
_property: &'static CompositionProperty,
change: ServerValueChange<'_>,
)
fn set_value( &self, _property: &'static CompositionProperty, change: ServerValueChange<'_>, )
SetValue(prop, ref field, value) as the class of the object
defines it. A plain server object assigns; an animated object also
invalidates the subscriptions of the property; a render resource
goes through super::ServerRenderResourceCore::set_value.Source§impl IServerRenderResource for ServerCompositionVisualSurface
impl IServerRenderResource for ServerCompositionVisualSurface
fn add_observer(&self, observer: &Rc<dyn IServerRenderResourceObserver>)
fn remove_observer(&self, observer: &Rc<dyn IServerRenderResourceObserver>)
fn queued_invalidate(&self)
Source§impl IServerRenderResourceHost for ServerCompositionVisualSurface
impl IServerRenderResourceHost for ServerCompositionVisualSurface
Source§fn compositor(&self) -> Option<Rc<ServerCompositor>>
fn compositor(&self) -> Option<Rc<ServerCompositor>>
Source§fn as_render_resource_rc(&self) -> Option<Rc<dyn IServerRenderResource>>
fn as_render_resource_rc(&self) -> Option<Rc<dyn IServerRenderResource>>
Source§fn resource_property_changed(&self)
fn resource_property_changed(&self)
Source§impl IServerRenderResourceObserver for ServerCompositionVisualSurface
impl IServerRenderResourceObserver for ServerCompositionVisualSurface
fn dependency_queued_invalidate(&self, _sender: &dyn IServerRenderResource)
Source§impl ServerCompositionVisualSurfaceHooks for ServerCompositionVisualSurface
impl ServerCompositionVisualSurfaceHooks for ServerCompositionVisualSurface
Source§fn deserialize_changes_extra(&self, reader: &mut BatchStreamReader<'_>)
fn deserialize_changes_extra(&self, reader: &mut BatchStreamReader<'_>)
The request to freeze, written by the UI-thread surface before its properties.
fn on_fields_deserialized( &self, _changed: CompositionVisualSurfaceChangedFields, )
fn on_source_visual_changed(&self)
fn on_source_visual_changing(&self)
Auto Trait Implementations§
impl !Freeze for ServerCompositionVisualSurface
impl !RefUnwindSafe for ServerCompositionVisualSurface
impl !Send for ServerCompositionVisualSurface
impl !Sync for ServerCompositionVisualSurface
impl !UnwindSafe for ServerCompositionVisualSurface
impl Unpin for ServerCompositionVisualSurface
impl UnsafeUnpin for ServerCompositionVisualSurface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more