Skip to main content

Plot3DContext

Struct Plot3DContext 

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

Plot3D context wrapper

This manages the ImPlot3D context lifetime. Create one instance per application and keep it alive for the duration of your program.

§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

Set this context as the current ImPlot3D context. Get a raw pointer to the current ImPlot3D style

This is an advanced function for direct style manipulation. Prefer using the safe style functions in the style module. Get the raw ImPlot3D context pointer.

§Safety

The caller must ensure the pointer is used safely and not stored beyond the lifetime of this context wrapper.

Source

pub fn get_plot_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 is tied to the lifetime of the Ui frame.

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

Return the number of color entries in a colormap.

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

pub fn next_colormap_color(&self) -> [f32; 4]

Return the next color from this context’s current colormap and advance its color cursor.

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more