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>

source

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>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>