pub struct BrowserSurface { /* private fields */ }Expand description
The state every surface of a view has: its canvas, its compositor and its size in device pixels and logical units.
Implementations§
Source§impl BrowserSurface
impl BrowserSurface
Sourcepub fn new(js_surface: CanvasSurface, compositor: Rc<Compositor>) -> Self
pub fn new(js_surface: CanvasSurface, compositor: Rc<Compositor>) -> Self
Creates the surface state for a canvas of the page.
Sourcepub fn compositor(&self) -> Rc<Compositor>
pub fn compositor(&self) -> Rc<Compositor>
The compositor that renders to the surface.
Sourcepub fn client_size(&self) -> Size
pub fn client_size(&self) -> Size
The size in logical units.
Sourcepub fn render_size(&self) -> PixelSize
pub fn render_size(&self) -> PixelSize
The size in device pixels.
Sourcepub fn size_changed(&self, handler: Rc<dyn Fn()>) -> u64
pub fn size_changed(&self, handler: Rc<dyn Fn()>) -> u64
Subscribes to changes of the client size.
Sourcepub fn scaling_changed(&self, handler: Rc<dyn Fn()>) -> u64
pub fn scaling_changed(&self, handler: Rc<dyn Fn()>) -> u64
Subscribes to changes of the scaling.
Sourcepub fn initial_size(&self) -> Option<(f64, f64, f64)>
pub fn initial_size(&self) -> Option<(f64, f64, f64)>
The size and the scaling the canvas has right now, as
(pixel width, pixel height, scaling); None once disposed.
Sourcepub fn on_size_changed(&self, pixel_width: f64, pixel_height: f64, dpr: f64)
pub fn on_size_changed(&self, pixel_width: f64, pixel_height: f64, dpr: f64)
Records the size of the canvas and raises the change events.
pixel_width and pixel_height are in device pixels; dpr is the
device pixel ratio.
Auto Trait Implementations§
impl !Freeze for BrowserSurface
impl !RefUnwindSafe for BrowserSurface
impl !Send for BrowserSurface
impl !Sync for BrowserSurface
impl !UnwindSafe for BrowserSurface
impl Unpin for BrowserSurface
impl UnsafeUnpin for BrowserSurface
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
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more