Struct SwWindow

Source
pub struct SwWindow { /* private fields */ }
Expand description

A software-rendered window.

This is a safe wrapper around Surface and winit::window::Window. For each method, only a synopsis is provided here. See Surface’s documentation for a full documentation.

Implementations§

Source§

impl SwWindow

Source

pub fn new(window: Window, context: &Context, config: &Config) -> Self

Construct a SwWindow by wrapping an existing Window.

Source

pub fn into_window(self) -> Window

Detach the surface and get the wrapped winit::window::Window.

Source

pub unsafe fn split(self) -> (Surface, Window)

Split the Window apart from the Surface.

Unsafety: The Surface must be dropped before the Window.

Source

pub fn window(&self) -> &Window

Get a reference to the wrapped winit::window::Window.

Source

pub fn update_surface(&self, extent: [u32; 2], format: Format)

Update the properties of the surface.

Source

pub fn update_surface_to_fit(&self, format: Format)

Update the properties of the surface. The surface size is automatically derived based on the window size.

Source

pub fn supported_formats(&self) -> impl Iterator<Item = Format> + '_

Enumerate supported pixel formats.

Source

pub fn image_info(&self) -> ImageInfo

Get the ImageInfo describing the current swapchain images.

Source

pub fn num_images(&self) -> usize

Get the number of swapchain images.

Source

pub fn does_preserve_image(&self) -> bool

Get a flag indicating whether swapchain images preserve their contents when their indices are used again.

Source

pub fn poll_next_image(&self) -> Option<usize>

Get the index of the next available swapchain image. Blocks the current thread.

Source

pub fn lock_image(&self, i: usize) -> impl Deref<Target = [u8]> + DerefMut + '_

Lock a swapchain image at index i to access its contents.

Source

pub fn present_image(&self, i: usize)

Enqueue the presentation of a swapchain image at index i.

Trait Implementations§

Source§

impl Debug for SwWindow

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for SwWindow

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> Erased for T