2020-08-13 20:13:58 +00:00
|
|
|
use cstr_core::CString;
|
2020-08-12 15:53:50 +00:00
|
|
|
|
|
|
|
use libnotcurses_sys as nc;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2020-08-20 14:40:15 +00:00
|
|
|
let ncd = nc::ncdirect_start();
|
2020-08-12 15:53:50 +00:00
|
|
|
|
|
|
|
render_image(&mut *ncd, nc::ncblitter_e_NCBLIT_1x1);
|
|
|
|
render_image(&mut *ncd, nc::ncblitter_e_NCBLIT_2x1);
|
|
|
|
render_image(&mut *ncd, nc::ncblitter_e_NCBLIT_BRAILLE);
|
|
|
|
|
|
|
|
nc::ncdirect_stop(ncd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn render_image(ncd: &mut nc::ncdirect, blit: nc::ncblitter_e) {
|
|
|
|
unsafe {
|
|
|
|
if nc::ncdirect_render_image(
|
|
|
|
ncd,
|
2020-08-17 15:54:07 +00:00
|
|
|
CString::new("image-16x16.png").unwrap().as_ptr(),
|
2020-08-12 15:53:50 +00:00
|
|
|
nc::ncalign_e_NCALIGN_CENTER,
|
|
|
|
blit,
|
|
|
|
nc::ncscale_e_NCSCALE_NONE,
|
|
|
|
) != 0
|
|
|
|
{
|
|
|
|
panic!("ERR: ncdirect_render_image. \
|
|
|
|
Make sure you are running this example from the examples folder");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|