pub struct SurfaceTexture<W: WindowHandle> { /* private fields */ }
Expand description
A logical texture for a window surface.
Implementations§
Source§impl<W: WindowHandle> SurfaceTexture<W>
impl<W: WindowHandle> SurfaceTexture<W>
Sourcepub fn new(width: u32, height: u32, window: W) -> Self
pub fn new(width: u32, height: u32, window: W) -> Self
Create a logical texture for a window surface.
It is recommended (but not required) that the width
and height
are equivalent to the
physical dimensions of the surface
. E.g. scaled by the HiDPI factor.
§Examples
use pixels::SurfaceTexture;
use winit::event_loop::EventLoop;
use winit::window::Window;
let event_loop = EventLoop::new().unwrap();
let window = Window::new(&event_loop).unwrap();
let size = window.inner_size();
let surface_texture = SurfaceTexture::new(size.width, size.height, &window);
§Panics
Panics when width
or height
are 0.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for SurfaceTexture<W>where
W: Freeze,
impl<W> RefUnwindSafe for SurfaceTexture<W>where
W: RefUnwindSafe,
impl<W> Send for SurfaceTexture<W>
impl<W> Sync for SurfaceTexture<W>
impl<W> Unpin for SurfaceTexture<W>where
W: Unpin,
impl<W> UnwindSafe for SurfaceTexture<W>where
W: UnwindSafe,
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