pub struct DebugDisplay;Available on crate feature
debug-window only.Expand description
Entry point for the debug display system.
This struct provides the run() method, which takes
over the main thread for the winit event loop and runs user code on a
background thread.
Implementations§
Source§impl DebugDisplay
impl DebugDisplay
Sourcepub fn run<F>(user_fn: F)
pub fn run<F>(user_fn: F)
Run the debug display system.
Takes over the main thread for the winit event loop. The user’s
code runs in the provided closure on a background thread, which
receives a DisplayContext handle for displaying images.
The event loop exits when:
- All windows are closed by the user, OR
- The user closure returns (an
Exitcommand is sent automatically).
§Examples
use fovea_display::{DebugDisplay, AutoContrast, Identity};
use fovea::image::Image;
use fovea::pixel::Srgba8;
DebugDisplay::run(|ctx| {
let img = Image::fill(640, 480, Srgba8::new(128, 64, 200, 255));
ctx.show("Preview", &img, Identity);
ctx.wait_key();
});§Panics
Panics if the event loop cannot be created (e.g. no display server available). On macOS, panics if called from a non-main thread.
Auto Trait Implementations§
impl Freeze for DebugDisplay
impl RefUnwindSafe for DebugDisplay
impl Send for DebugDisplay
impl Sync for DebugDisplay
impl Unpin for DebugDisplay
impl UnsafeUnpin for DebugDisplay
impl UnwindSafe for DebugDisplay
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> ConvertPixelExt for T
impl<T> ConvertPixelExt for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromLinear<T> for T
impl<T> FromLinear<T> for T
Source§fn from_linear(acc: T) -> T
fn from_linear(acc: T) -> T
Converts a linear-space accumulator value back to this pixel type, applying rounding and clamping. Read more