Skip to main content

Figure

Struct Figure 

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

Grid figure container.

Created without an Runtime; the Runtime is supplied only at sink time.

Implementations§

Source§

impl Figure

Source

pub fn new(config: FigureConfig) -> Self

Construct a new figure with the given configuration.

Source

pub fn default_config() -> Self

Construct with default configuration.

Source

pub fn ax(&mut self, row: i32, col: i32) -> &mut Axes

Access the (row, col) axes — both 0-indexed.

Source

pub fn axes(&self) -> &[Axes]

Recorded axes in row-major cell order.

Source

pub fn title(&mut self, text: &str)

Set the figure-level title (also replaces the window title in show).

Source

pub fn x_label(&mut self, text: &str)

Set the figure-level horizontal axis label (rendered below the grid).

Donor: oa::plot::Figure::xLabel.

Source

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.

Source

pub fn config(&self) -> &FigureConfig

Return the figure configuration.

Donor: oa::plot::Figure::config().

Source

pub fn rows(&self) -> i32

Return the row count.

Donor: oa::plot::Figure::rows().

Source

pub fn cols(&self) -> i32

Return the column count.

Donor: oa::plot::Figure::cols().

Source

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.

Source

pub fn save_to(&self, path: &str) -> Result<()>

Source

pub fn save_to_on(&self, runtime: &Runtime, 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.

Source

pub fn render(&self) -> Result<Image>

Source

pub fn render_on(&self, runtime: &Runtime) -> Result<Image>

Headless GPU render → oa::Image (normalized Float32 [1, 4, H, W]).

GPU→Image readback is Experimental.

Source

pub fn show(&self) -> Result<()>

Source

pub fn show_on(&self, runtime: &Runtime) -> 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 runtime 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 runtime.

Source

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.

Source

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).

Auto Trait Implementations§

§

impl !RefUnwindSafe for Figure

§

impl !Send for Figure

§

impl !Sync for Figure

§

impl !UnwindSafe for Figure

§

impl Forget for Figure

§

impl Freeze for Figure

§

impl Move for Figure

§

impl Unpin for Figure
where *const u8 is !null: Unpin, Rc<RefCell<RuntimeState>>: Unpin, Rc<StorageInner>: Unpin, Rc<MatrixSemantic>: Unpin, Rc<()>: Unpin, Rc<NativeRgbaImage>: Unpin, Rc<RefCell<RendererState>>: Unpin, Rc<TextureSemantic>: Unpin,

§

impl UnsafeUnpin for Figure

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.