Trait nsi::FnOpen

source ·
pub trait FnOpen<'a>: FnMut(&str, usize, usize, &PixelFormat) -> Error + 'a { }
Expand description

A closure which is called once per OutputDriver instance.

It is passed to ɴsɪ via the "callback.open" attribute on that node.

The closure is called once, before the renderer starts sending pixels to the output driver.

Arguments

The pixel_format parameter is an array of strings that details the composition of the f32 data that the renderer will send to the FnWrite and/or FnFinish closures.

Example

let open = nsi::output::OpenCallback::new(
    |name: &str,
     width: usize,
     height: usize,
     pixel_format: &nsi::output::PixelFormat| {
        println!(
            "Resolution: {}×{}\nPixel Format:\n{:?}",
            width, height, pixel_format
        );
        nsi::output::Error::None
    },
);

Implementors§