ferroui_base/rendering/composition/
composition_surface.rs1use super::server::ServerObjectId;
2use super::{CompositionObject, Compositor, ICompositionObject};
3use std::any::Any;
4use std::rc::Rc;
5
6pub struct CompositionSurface {
9 object: CompositionObject,
10}
11
12impl CompositionSurface {
13 pub fn new(compositor: &Rc<Compositor>, server: ServerObjectId) -> Rc<CompositionSurface> {
16 Rc::new(CompositionSurface { object: CompositionObject::new(compositor, Some(server)) })
17 }
18
19 pub fn compositor(&self) -> &Rc<Compositor> {
20 self.object.compositor()
21 }
22
23 pub fn is_disposed(&self) -> bool {
24 self.object.is_disposed()
25 }
26
27 pub fn dispose(&self) {
28 self.object.dispose();
29 }
30}
31
32impl ICompositionObject for CompositionSurface {
33 fn server(&self) -> ServerObjectId {
34 self.object.required_server()
35 }
36
37 fn as_any(&self) -> &dyn Any {
38 self
39 }
40
41 fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any> {
42 self
43 }
44}