Struct pixels::SurfaceTexture
source · pub struct SurfaceTexture<'win, W: HasRawWindowHandle + HasRawDisplayHandle> { /* private fields */ }
Expand description
A logical texture for a window surface.
Implementations§
source§impl<'win, W: HasRawWindowHandle + HasRawDisplayHandle> SurfaceTexture<'win, W>
impl<'win, W: HasRawWindowHandle + HasRawDisplayHandle> SurfaceTexture<'win, W>
sourcepub fn new(width: u32, height: u32, window: &'win W) -> Self
pub fn new(width: u32, height: u32, window: &'win 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();
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§
source§impl<'win, W: Debug + HasRawWindowHandle + HasRawDisplayHandle> Debug for SurfaceTexture<'win, W>
impl<'win, W: Debug + HasRawWindowHandle + HasRawDisplayHandle> Debug for SurfaceTexture<'win, W>
Auto Trait Implementations§
impl<'win, W> RefUnwindSafe for SurfaceTexture<'win, W>where W: RefUnwindSafe,
impl<'win, W> Send for SurfaceTexture<'win, W>where W: Sync,
impl<'win, W> Sync for SurfaceTexture<'win, W>where W: Sync,
impl<'win, W> Unpin for SurfaceTexture<'win, W>
impl<'win, W> UnwindSafe for SurfaceTexture<'win, W>where W: RefUnwindSafe,
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