pub struct Figure { /* private fields */ }Expand description
Grid figure container.
Created without an Engine; the Engine is supplied only at sink time.
Implementations§
Source§impl Figure
impl Figure
Sourcepub fn new(config: FigureConfig) -> Self
pub fn new(config: FigureConfig) -> Self
Construct a new figure with the given configuration.
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Construct with default configuration.
Sourcepub fn ax(&mut self, row: i32, col: i32) -> &mut Axes
pub fn ax(&mut self, row: i32, col: i32) -> &mut Axes
Access the (row, col) axes — both 0-indexed.
Sourcepub fn title(&mut self, text: &str)
pub fn title(&mut self, text: &str)
Set the figure-level title (also replaces the window title in show).
Sourcepub fn x_label(&mut self, text: &str)
pub fn x_label(&mut self, text: &str)
Set the figure-level horizontal axis label (rendered below the grid).
Donor: oa::plot::Figure::xLabel.
Sourcepub fn y_label(&mut self, text: &str)
pub fn y_label(&mut self, text: &str)
Set the figure-level vertical axis label (rendered left of the grid).
Donor: oa::plot::Figure::yLabel.
Sourcepub fn config(&self) -> &FigureConfig
pub fn config(&self) -> &FigureConfig
Return the figure configuration.
Donor: oa::plot::Figure::config().
Sourcepub fn cell_rect(&self, row: i32, col: i32, w: u32, h: u32) -> CellRect
pub fn cell_rect(&self, row: i32, col: i32, w: u32, h: u32) -> CellRect
Compute the pixel rect of the (row, col) cell inside a canvas of
(w × h) pixels, after all figure-level title/label bands are reserved.
Donor: oa::plot::Figure::cellRect.
pub fn save_to(&self, path: &str) -> Result<()>
Sourcepub fn save_to_on(&self, engine: &Engine, path: &str) -> Result<()>
pub fn save_to_on(&self, engine: &Engine, path: &str) -> Result<()>
Headless GPU render → PNG/JPEG/WebP file.
GPU composition → file encode is Experimental. The current implementation produces a composed Texture and saves it.
pub fn render(&self) -> Result<Image>
Sourcepub fn render_on(&self, engine: &Engine) -> Result<Image>
pub fn render_on(&self, engine: &Engine) -> Result<Image>
Headless GPU render → oa::Image (normalized Float32 [1, 4, H, W]).
GPU→Image readback is Experimental.
pub fn show(&self) -> Result<()>
Sourcepub fn show_on(&self, engine: &Engine) -> Result<()>
pub fn show_on(&self, engine: &Engine) -> Result<()>
Compose the figure once and open it in the OA image viewer.
The window uses the image canvas with pan, zoom and fit controls. The supplied engine must support desktop presentation. This call returns when the viewer closes.
§Errors
Returns an error if composition fails or the viewer cannot open or present the texture on the supplied engine.
Sourcepub fn render_frame(&self, w: u32, h: u32, ui: &mut Ui<'_>) -> Result<()>
pub fn render_frame(&self, w: u32, h: u32, ui: &mut Ui<'_>) -> Result<()>
Replay the complete figure into an already-open Ui GPU frame.
This is the public seam used by ViewerLiveSource implementations that
manage their own window/presenter lifecycle. The configured aspect ratio
and all title/label bands remain stable on resize.
Donor: oa::plot::Figure::renderFrame.
Sourcepub fn render_frame_at(&self, rect: PixelRect, ui: &mut Ui<'_>) -> Result<()>
pub fn render_frame_at(&self, rect: PixelRect, ui: &mut Ui<'_>) -> Result<()>
Replay the figure inside rect of an already-open Ui GPU frame.
Same contract as Figure::render_frame, but the figure layout is
computed for rect’s extent and translated to its origin, so the
figure can be embedded as a pane inside a composed surface (e.g. a
crate::viewer::Workspace leaf).