Skip to main content

Plot3DContext

Struct Plot3DContext 

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

Plot3D context wrapper

Plotting requires the originating Dear ImGui context. The native plot allocation reserves its owner thread until this Plot3DContext is dropped.

§Example

use dear_imgui_rs::*;
use dear_implot3d::*;

let mut imgui_ctx = Context::create();
let plot3d_ctx = Plot3DContext::create(&imgui_ctx);

// In your main loop:
let ui = imgui_ctx.frame();
let plot_ui = plot3d_ctx.get_plot_ui(ui);

Implementations§

Source§

impl Plot3DContext

Source

pub fn try_create(imgui: &Context) -> ImGuiResult<Self>

Try to create a new ImPlot3D context.

This should be called once after creating your ImGui context.

Source

pub fn create(imgui: &Context) -> Self

Create a new ImPlot3D context (panics on error).

Source

pub unsafe fn raw(&self) -> *mut ImPlot3DContext

Get the raw ImPlot3D context pointer without changing the current context.

§Safety

Both contexts must be alive and correctly bound. Keep wrapper-owned plots, cached items and style stacks intact. Balance raw Begin/End and Push/Pop pairs within their own scopes. This wrapper retains sole ownership of the native allocation.

Source

pub fn get_plot_ui<'ui>(&'ui self, ui: &'ui Ui) -> Plot3DUi<'ui>

Get a per-frame plotting interface

Call this once per frame to get access to plotting functions. The returned Plot3DUi borrows both this plot context and the frame.

ⓘ
use dear_imgui_rs::Ui;
use dear_implot3d::{Plot3DContext, Plot3DUi};
fn view(ui: &Ui, plot: Plot3DContext) -> Plot3DUi<'_> {
    plot.get_plot_ui(ui)
}
Source§

impl Plot3DContext

Source

pub fn colormap_count(&self) -> usize

Return the number of available ImPlot3D colormaps.

Source

pub fn colormap_name(&self, index: impl Into<ColormapIndex>) -> String

Return a colormap name, or an empty string if the index is invalid for this context.

Source

pub fn colormap_size(&self, index: impl Into<ColormapIndex>) -> usize

Returns the number of color entries, or zero for an index outside this context.

Source

pub fn style_colormap_index(&self) -> Option<ColormapIndex>

Return the default colormap stored in this ImPlot3D context’s style.

Source

pub fn style_colormap_name(&self) -> Option<String>

Return this context’s default colormap name.

Source

pub fn set_style_colormap(&self, index: impl Into<ColormapIndex>)

Permanently set the default colormap used by this ImPlot3D context.

Source

pub fn colormap_index_by_name(&self, name: &str) -> Option<ColormapIndex>

Look up a colormap index by its name.

Source

pub fn set_style_colormap_by_name(&self, name: &str)

Permanently set the default colormap by name. Invalid names are ignored.

Source

pub fn colormap_color(&self, index: ColormapColorIndex) -> [f32; 4]

Return a color from this context’s active colormap.

Source§

impl Plot3DContext

Source

pub fn style_colors_dark(&self)

Apply ImPlot3D’s dark style palette to this context.

Source

pub fn style_colors_light(&self)

Apply ImPlot3D’s light style palette to this context.

Source

pub fn style_colors_classic(&self)

Apply ImPlot3D’s classic style palette to this context.

Source

pub fn style_colors_auto(&self)

Apply ImPlot3D’s auto style palette to this context.

Trait Implementations§

Source§

impl Drop for Plot3DContext

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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