[−][src]Struct nannou::wgpu::TextureSnapshot
A snapshot captured by a Capturer.
A snapshot is a thin wrapper around a wgpu::BufferImage that knows that the image format is specifically non-linear sRGBA8.
Methods
impl Snapshot
[src]
pub fn read<F>(&self, callback: F) where
F: 'static + FnOnce(Result<Rgba8AsyncMappedImageBuffer, ()>),
[src]
F: 'static + FnOnce(Result<Rgba8AsyncMappedImageBuffer, ()>),
Reads the non-linear sRGBA image from mapped memory.
Specifically, this asynchronously maps the buffer of bytes from GPU to host memory and,
once mapped, calls the given user callback with the data represented as an
Rgba8AsyncMapping
.
Note: The given callback will not be called until the memory is mapped and the device is polled. You should not rely on the callback being called immediately.
The given callback will be called on the current thread. If you would like the callback to
be processed on a thread pool, see the read_threaded
method.
pub fn read_threaded<F>(&self, callback: F) where
F: 'static + Send + FnOnce(Result<ImageBuffer<Rgba<u8>, Vec<u8>>, ()>),
[src]
F: 'static + Send + FnOnce(Result<ImageBuffer<Rgba<u8>, Vec<u8>>, ()>),
Similar to read
, but rather than delivering the mapped memory directly to the callback,
this method will first clone the mapped data, send it to another thread and then call the
callback from the other thread.
This is useful when the callback performs an operation that could take a long or unknown amount of time (e.g. writing the image to disk).
Note however that if this method is called repeatedly (e.g. every frame) and the given callback takes longer than the interval between calls, then the underlying thread will fall behind and may take a while to complete by the time the application has exited.
Auto Trait Implementations
impl !RefUnwindSafe for Snapshot
impl !Send for Snapshot
impl !Sync for Snapshot
impl Unpin for Snapshot
impl UnwindSafe for Snapshot
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
fn convert_into(self) -> U
[src]
fn convert_unclamped_into(self) -> U
[src]
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,