Trait UiImage2d

Source
pub trait UiImage2d {
    // Required method
    fn image2d<F>(
        &self,
        ctx: &F,
        name: &ImStr,
        image: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>,
        state: &mut State,
    ) -> Result<(), Error>
       where F: Facade;
}
Expand description

Implementation of a UI to visualize a 2D image with ImGui and OpenGL

Required Methods§

Source

fn image2d<F>( &self, ctx: &F, name: &ImStr, image: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>, state: &mut State, ) -> Result<(), Error>
where F: Facade,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'ui> UiImage2d for Ui<'ui>

Source§

fn image2d<F>( &self, ctx: &F, name: &ImStr, image: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>, state: &mut State, ) -> Result<(), Error>
where F: Facade,

Show image given as input. name is used as an ID to register the provided image as an OpenGL texture in Ui.

§Example
#[macro_use] extern crate imgui;
extern crate imgui_glium_renderer;
extern crate ndarray;
extern crate ui_image2d;

use imgui::Ui;
use imgui_glium_renderer::AppContext;
use ndarray::Array2;
use ui_image2d::UiImage2d;

fn run(ui: &Ui, ctx: &AppContext) -> Result<(), ui_image2d::Error> {
    let data = Array2::eye(10);
    let mut state = ui_image2d::State::default();
    ui.image2d(ctx, im_str!("Show my image!"), &data, &mut state)
}

Implementors§