pub trait FnFinish<'a>: FnMut(String, usize, usize, PixelFormat, Vec<f32>) -> Error + 'a { }
Expand description
A closure which is called once per
OutputDriver
instance.
It is passed to ɴsɪ via the "callback.finish"
attribute on that node.
The closure is called once, before after renderer has finished sending pixels to the output driver.
Example
let finish = nsi::output::FinishCallback::new(
|name: String,
width: usize,
height: usize,
pixel_format: nsi::output::PixelFormat,
pixel_data: Vec<f32>| {
println!(
"The top, left pixel of the first channel in the {:?} layer has the value {}.",
pixel_format[0].name(),
pixel_data[0],
);
nsi::output::Error::None
},
);
ctx.set_attribute(
"oxidized_output_driver",
&[
nsi::string!("drivername", "ferris"),
// When done, send all pixels to the finish closure.
nsi::callback!("callback.finish", finish),
],
);