pub trait ViewerLiveSource {
// Required methods
fn capabilities(&self) -> ViewerLiveCapabilities;
fn open(&mut self, runtime: &Runtime) -> Result<()>;
fn update(&mut self, delta_ms: f32) -> Result<()>;
fn render(&mut self, ui: &mut Ui<'_>, width: u32, height: u32) -> Result<()>;
fn close(&mut self) -> Result<()>;
// Provided methods
fn canvas_texture(&self) -> Option<&Texture> { ... }
fn canvas_controls_rect(
&self,
_width: u32,
_height: u32,
_scale: f32,
) -> Option<PixelRect> { ... }
fn on_event(&mut self, _event: &InputEvent) -> Result<()> { ... }
}Expand description
Non-owning live GPU producer attached to the Viewer lifecycle.
Donor: oa::ViewerLiveSource.
Required Methods§
fn capabilities(&self) -> ViewerLiveCapabilities
Sourcefn open(&mut self, runtime: &Runtime) -> Result<()>
fn open(&mut self, runtime: &Runtime) -> Result<()>
Called once when the Viewer obtains an Runtime.
Sourcefn update(&mut self, delta_ms: f32) -> Result<()>
fn update(&mut self, delta_ms: f32) -> Result<()>
Per-frame update. delta_ms is the frame time in milliseconds.
Provided Methods§
Sourcefn canvas_texture(&self) -> Option<&Texture>
fn canvas_texture(&self) -> Option<&Texture>
Optional camera/image surface presented by the Viewer’s shared GPU 2D
canvas. The Viewer owns navigation, fit, zoom, pan and channel selection;
render draws only the source’s overlays when this is provided.
Sourcefn canvas_controls_rect(
&self,
_width: u32,
_height: u32,
_scale: f32,
) -> Option<PixelRect>
fn canvas_controls_rect( &self, _width: u32, _height: u32, _scale: f32, ) -> Option<PixelRect>
Source controls that own pointer gesture starts over the canvas. Motion and release from an existing canvas drag still reach Navigation.
Sourcefn on_event(&mut self, _event: &InputEvent) -> Result<()>
fn on_event(&mut self, _event: &InputEvent) -> Result<()>
Raw platform event (only called when receives_events is true).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".