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
impl Plot3DContext
Sourcepub fn try_create(imgui: &Context) -> ImGuiResult<Self>
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.
Sourcepub unsafe fn raw(&self) -> *mut ImPlot3DContext
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.
Sourcepub fn get_plot_ui<'ui>(&self, ui: &'ui Ui) -> Plot3DUi<'ui>
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
impl Plot3DContext
Sourcepub fn colormap_count(&self) -> usize
pub fn colormap_count(&self) -> usize
Return the number of available ImPlot3D colormaps.
Sourcepub fn colormap_name(&self, index: impl Into<ColormapIndex>) -> String
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.
Sourcepub fn colormap_size(&self, index: impl Into<ColormapIndex>) -> usize
pub fn colormap_size(&self, index: impl Into<ColormapIndex>) -> usize
Return the number of color entries in a colormap.
Sourcepub fn style_colormap_index(&self) -> Option<ColormapIndex>
pub fn style_colormap_index(&self) -> Option<ColormapIndex>
Return the default colormap stored in this ImPlot3D context’s style.
Sourcepub fn style_colormap_name(&self) -> Option<String>
pub fn style_colormap_name(&self) -> Option<String>
Return this context’s default colormap name.
Sourcepub fn set_style_colormap(&self, index: impl Into<ColormapIndex>)
pub fn set_style_colormap(&self, index: impl Into<ColormapIndex>)
Permanently set the default colormap used by this ImPlot3D context.
Sourcepub fn colormap_index_by_name(&self, name: &str) -> Option<ColormapIndex>
pub fn colormap_index_by_name(&self, name: &str) -> Option<ColormapIndex>
Look up a colormap index by its name.
Sourcepub fn set_style_colormap_by_name(&self, name: &str)
pub fn set_style_colormap_by_name(&self, name: &str)
Permanently set the default colormap by name. Invalid names are ignored.
Sourcepub fn colormap_color(&self, index: ColormapColorIndex) -> [f32; 4]
pub fn colormap_color(&self, index: ColormapColorIndex) -> [f32; 4]
Return a color from this context’s active colormap.
Sourcepub fn next_colormap_color(&self) -> [f32; 4]
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
impl Plot3DContext
Sourcepub fn style_colors_dark(&self)
pub fn style_colors_dark(&self)
Apply ImPlot3D’s dark style palette to this context.
Sourcepub fn style_colors_light(&self)
pub fn style_colors_light(&self)
Apply ImPlot3D’s light style palette to this context.
Sourcepub fn style_colors_classic(&self)
pub fn style_colors_classic(&self)
Apply ImPlot3D’s classic style palette to this context.
Sourcepub fn style_colors_auto(&self)
pub fn style_colors_auto(&self)
Apply ImPlot3D’s auto style palette to this context.